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
04024d83618e0c8abbd94c2f60803b849cc65d48
tinatsaitp/2020-Spring
/CS Q04.py
UTF-8
242
3.65625
4
[]
no_license
#Name: Yun-Ting Tsai #Email: Yun-Ting.Tsai01@myhunter.cuny.edu #Date: 02.11.2020 #This program is to draw a flower. import turtle tess = turtle.Turtle() for i in range(150): tess.forward(0.5) tess.penup() tess.forward(0.5) tess.pendown() tess.left(110)
true
f06fec18d70c85c35bbf58d71fe6f0f8bd8db2de
rjkerrison/feelold
/tests.py
UTF-8
915
2.65625
3
[]
no_license
import json import random from datetime import datetime import event def test_old_enough(age, d1): today = datetime.today twoageyearsago = datetime(today.year - 2*age, today.month, today.day) return twoageyearsago <= d1 def test_age(age, d1): assert(test_old_enough(age, d1) and not test_old_enough(age...
true
524428f40a5647cfd9351208fca08bcb4e8a1f78
dheeraj-mishra/HigherLowerGame-with-YouTube-Live-chat
/hig-Low.py
UTF-8
2,495
2.578125
3
[]
no_license
from selenium import webdriver import time from selenium.webdriver.chrome.options import Options import pytchat braveLocation = 'C:\Program Files\BraveSoftware\Brave-Browser\Application\Brave.exe' driverPath = 'C:\Program Files (x86)\webDriver\chromedriver.exe' #path location of webDriver webName = 'http://www....
true
dbb7d69f1354bb44bbf8846a0a042b315e5581ca
jireh-father/tensorflow-triplet-loss
/model/tfrecord_input_fn.py
UTF-8
5,099
2.59375
3
[ "MIT" ]
permissive
"""Create the input data pipeline using `tf.data`""" from model import tfrecords_dataset as td import tensorflow as tf def train_input_fn(data_dir, params): """Train input function for the MNIST dataset. Args: data_dir: (string) path to the data directory params: (Params) contains hyperparam...
true
bf05d83c95ad65ad4be86b696753b0e5af345148
Aasthaengg/IBMdataset
/Python_codes/p03651/s932698798.py
UTF-8
220
2.609375
3
[]
no_license
from fractions import gcd n,k=map(int,input().split()) *a,=map(int,input().split()) g=a[0] for i in range(1,n): g=gcd(g,a[i]) if k in a or (k%g==0 and k<=max(a)): print('POSSIBLE') else: print('IMPOSSIBLE')
true
b4e4e23d9342387eee2c54e0e1a767fbdc71f790
VariusWorldTechLtd/Wallet-ML
/Development/Data/generate_data.py
UTF-8
353
2.75
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt #def random_table_generator(): df = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD')) #df1['randNumCol'] = np.random.randint(0,5, size=len(df1)) s = np.random.poisson(10,10000) count, bins, ignored = plt.hist(s, 14, den...
true
89134155b9af3285ae132a418c6c335b0de2fd8b
nicolascrossi/MerkleSimpleCoin
/block.py
UTF-8
2,355
2.890625
3
[]
no_license
import hashlib import time import base64 import queue class Block: class MerkleNode: def __init__(self): self.left = None self.right = None self.hash = None def genHash(self): sha = hashlib.sha256(): sha.update(str(self.left.hash).encod...
true
90433cdada4002e75324eeb9cf6cfa5f7e918b0d
FYP-2018/Text-Processing
/Dict.py
UTF-8
5,697
2.984375
3
[]
no_license
import os import math from collections import defaultdict import matplotlib.pyplot as plt from PreprocessUtils import readFile class Dict(): def __init__(self): pass def _zero_list(self, length): """ A function passing to defaultdict Args: param1...
true
36b2ec41eac330ea40c85589f026903e52864c93
yuninje/Algorithm_Solve
/Baekjoon/[ 01018 ] 체스판 다시 칠하기.py
UTF-8
591
2.796875
3
[]
no_license
# https://www.acmicpc.net/problem/1018 # 8 <= N , M <= 50 R, C = map(int, input().split()) Map = [list(input()) for _ in range(R)] N = 8 MIN = 999999999 for rr in range(R-N+1): for cc in range(C-N+1): # 시작점 w , b = 0,0 for r in range(rr,rr + N): for c in range(cc, cc+N): ...
true
706bbf25ce48165a43c882738a33e8d610960348
songseonghun/kagglestruggle
/python3/051-100/088-import-vs-local.py
UTF-8
136
3.03125
3
[]
no_license
from mylib import f #using the function from mylib print(f(5)) #10 #locavl function def f(x): return 3 * x print(f(5)) #15
true
12a16ef251af685d8d0d20d4e4d956bdaf77f707
Aberdeen-Skunkworks/AccousticTracker
/PythonController/Functions.py
UTF-8
26,510
3.265625
3
[]
no_license
## Functions used in the main acoustic tracker program def square_wave_gen(number_half_waves, resolution, samples_per_wave): """ Takes in number of half waves and resolution in multiples of 12 samples per wave 1 = 12 samples per wave 2 = 24 so on Output square wave oscillating at 40,000 Hz with the x axis...
true
73ceb09eab199e1222735a8c0cd4d1f6684eed7e
whieronymus/Py-Zap-Tester
/src/template.py
UTF-8
1,273
2.921875
3
[]
no_license
from zap import StoreClient import requests # This Template Replicates Zapier's Environment # If your code inbetween the "ZAPIER CODE" Tags works locally, # You should be able to Copy/Paste it to your Zapier Code Step # Fill input_data with test values you'll bring in form previous Zap Steps # Do this above the "ZAPI...
true
3992bcfa6c09c042f53501b0038b8a3dba744910
alexanderwe/ios-starter
/{{cookiecutter.projectDirectory}}/.githooks/verify_conventional_commit
UTF-8
845
2.640625
3
[]
no_license
#!/usr/bin/env python import re, sys, os def main(): # examples: # feat(login): added the ability to log in, into the application # feat(login/XXX-123): Login button implementation # fix(XXX-123): Fix bug in login mechanism # chore: Add file try: pattern = r'(feat|fix|docs|style|refacto...
true
08f4e3144f7d1e78a4b7a8b96d5063273a7b5c09
SnehaMishra28/BigData_Programming_Summer2018
/ICP/Module2_ICP#3/Source/Pyspark_ICP3/test2.py
UTF-8
1,883
2.984375
3
[]
no_license
from pyspark.sql import SparkSession import pandas as pd spark = SparkSession \ .builder \ .appName("Python Spark SQL basic example") \ .config("spark.some.config.option", "some-value") \ .getOrCreate() # import pyspark class Row from module sql from pyspark.sql import * #print("\nRead Data from C...
true
4dad620c4f6a0c1ce566d06f218b6d48cb6eea98
yull2ing/bloghw
/blog/views.py
UTF-8
1,464
3.015625
3
[]
no_license
from django.shortcuts import render,get_object_or_404,redirect from django.utils import timezone from .models import Blog def home(request): blogs=Blog.objects #쿼리셋 #메소드 return render(request,'home.html',{'blogs':blogs}) def detail(request,blog_id): blog_detail=get_object_or_404(Blog,pk=blog_id)#이용자가 ...
true
53a1eb9dabdb310dbbe700c97bcba3cd1b5df0da
bdkutsenko/ML-tasks
/assignment3/model.py
UTF-8
3,327
3.046875
3
[]
no_license
import numpy as np from layers import ( FullyConnectedLayer, ReLULayer, ConvolutionalLayer, MaxPoolingLayer, Flattener, softmax_with_cross_entropy, l2_regularization ) class ConvNet: """ Implements a very simple conv net Input -> Conv[3x3] -> Relu -> Maxpool[4x4] -> Conv[3x3] -> Relu...
true
5868800482ba21441a52eaad9c14eecdfe6e9c8a
mazleyou/flaskRestful
/dbtest.py
UTF-8
516
2.78125
3
[]
no_license
import pymysql # Open database connection db = pymysql.connect(host='52.141.7.91', port=8300, user='phoneticer', passwd='taiho9788', db='phonetic_db', charset='utf8', autocommit=True) # prepare a cursor object using cursor() method cursor = db.cursor() # execute SQL query u...
true
b383aacd300c913ad2672ac199e577e9550bd5fc
jakeanderson1199/AngularBaulderdash-Python-Server
/game_class.py
UTF-8
773
2.875
3
[]
no_license
from question_class import * from player_class import * from turn_class import Turn class Game: def __init__(self): self.question_list = self.get_questions() self.start = False self.players = [] self.owner_name = None self.index = 0 def get_questions(self): ...
true
120fee3b6242f8d5185cddb83684a4a36e677c8e
addenial/parse
/nmap-xml2csv-services.py
UTF-8
17,880
2.640625
3
[ "MIT" ]
permissive
#!/usr/bin/env python # Credit where credit is due... __author__ = 'Jake Miller (@LaconicWolf)' __date__ = '20171220xx~~~~~~' __version__ = '0.01Xxxxx' __description__ = """Parses the XML output from an nmap scan. The user can specify whether the data should be printed, displayed a...
true
d7325ac2b85d2e8dad23ac3e7a9c2439c62804ed
aruzhanassylkhan/tsis5
/40.py
UTF-8
73
3.09375
3
[]
no_license
import re text = str(input()) x = re.sub(r'\s+', '',text) print(x)
true
7666aebc768732d54b9e0519148a1c00e291189e
NailouZhang/AnalysisScripts
/Infernal_cmcalibrate.py
UTF-8
2,679
2.875
3
[ "MIT" ]
permissive
#Will take a directory full of covariance models and feed them to Infernal's cmcalibrate one at a time. #The resulting covariance models are put in sys.argv[3]. #This script may take several days to complete. Calibrating models of large alignments is slow. #Necessary modules: biopython, infernal #Usage: python Infer...
true
a6eb01451ac9541ab4765f9a1b8a7f60e1d70452
Krugger1982/Algoritmes_SD
/less4_postfix.py
UTF-8
1,195
3.296875
3
[]
no_license
def postfix_math(expression): C = expression.split() # Строку необходимо разделить по пробелам C.reverse() S = Stack() for i in C: S.push(i) # Преобразование списка операндов и операторов в стек S1 = Stack() while S.size() > 0: curr...
true
5ecb500924534e72e089acdcdf4c01088ecd7373
ujjwalmaity/PythonTutorial
/3 Tkinter/4_self_adjusting_widgets.py
UTF-8
225
3.15625
3
[]
no_license
from tkinter import * root = Tk() label_1 = Label(root, text='First', bg='Red', fg='White') label_2 = Label(root, text='Second', bg='Blue', fg='White') label_1.pack(fill=X) label_2.pack(side=LEFT, fill=Y) root.mainloop()
true
206473df43f657ccbe21462bc9566cb9be03f0f7
ArshidBaba/VolcanoMap
/VolcanoMap/webmap.py
UTF-8
802
2.875
3
[]
no_license
import folium import pandas as pd map4 = folium.Map(location=[1.7400339, -16.2444486], zoom_start=15, tiles='Stamen Terrain') currentFile = open('volcano_data.csv', 'rt', encoding='latin1') df = pd.read_csv(currentFile) df.dropna(inplace=True) df['VolcanoName'] = df['VolcanoName'].str.replace("'", "$#39;") ...
true
1297175266e03be523773584aaf852fae946492e
Reanimator/Client-Server-Apps-Python
/lession_1/task_4.py
UTF-8
831
3.953125
4
[]
no_license
""" 4. Преобразовать слова «разработка», «администрирование», «protocol», «standard» из строкового представления в байтовое и выполнить обратное преобразование (используя методы encode и decode). Подсказки: --- используйте списки и циклы, не дублируйте функции """ def sandwich(string): """all to bytes und back""...
true
3af8c7973cb96797f2674facfbd8d5941c3f1a3f
codeit-dotcom/Mosaic-PS1
/main.py
UTF-8
8,966
2.75
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[17]: import matplotlib.pyplot as plt import numpy as np import pandas as pd import cv2 import os from IPython.display import display as display_dataframe from skimage.segmentation import felzenszwalb, slic, quickshift, watershed from skimage.segmentation import mark_boundar...
true
56be992452a446886639862cfb891a6c3de597e9
kamonohasikamo/DeepLearningTutorial
/sampleClass.py
UTF-8
4,443
4.03125
4
[]
no_license
# 家の設計図を表す House というクラスを定義 # House クラスには、インスタンス化されたあとに、各インスタンス # すなわち誰か特定の人の家ごとに異なる値を持つ、 # namePlate という変数を持たせる。 # namePlate という変数には、 # 個別の家の表札に表示するための文字列が与えられるが、 # クラスを定義する際には「namePlate という変数を持つことができる」 # ようにしておくだけでよく、 # 実際にその変数に何か具体的な値を与える必要はない。 # クラスは、設計図であればよく、具体的な値を持たせなくてもよいので。 # 具体的な値は、個別の家を作成するとき、すな...
true
6fde0830e5e0dce8f24dd28e8ca29a52ed27bb35
m1234d/build18
/slam/whac_slam/motion.py
UTF-8
240
2.921875
3
[]
no_license
import serial import time data = serial.Serial("/dev/ttyACM0", 9600) time.sleep(2) data.write('right;') response = data.readline() print(response) time.sleep(.5) data.write('stop;') response = data.readline() print(response)
true
b98ad1b3b5f0f97af08839a9841d0b2ab4d292a2
coyotespike/algodesign
/Kosaraju.py
UTF-8
5,426
4
4
[]
no_license
""" If we can implement Depth First Search iteratively, we win. If we can consider how DFS plays with my data structure and how to begin building Kosaraju's algorithm on top of DFS, we double win and get pizza. Kosaraju's algorithm figures out which portions of a network are strongly connected. Strongly Connected Co...
true
d1b2cbadab8afec26ad1c0d1816e25d58ca47d7d
schevalier/bonobo
/bonobo/examples/types/bags.py
UTF-8
799
3.28125
3
[ "Apache-2.0" ]
permissive
""" Example on how to use :class:`bonobo.Bag` instances to pass flexible args/kwargs to the next callable. .. graphviz:: digraph { rankdir = LR; stylesheet = "../_static/graphs.css"; BEGIN [shape="point"]; BEGIN -> "extract()" -> "transform(...)" -> "load(...)"; } """ from r...
true
8a518427640d0dbe665353e9aad2acde7231c1a7
EtashGuha/CS3630Lab3
/particle_filter.py
UTF-8
4,392
2.6875
3
[]
no_license
from grid import CozGrid from particle import Particle from utils import grid_distance, rotate_point, diff_heading_deg, add_odometry_noise, add_gaussian_noise, add_marker_measurement_noise import setting import math import numpy as np import copy def motion_update(particles, odom, grid): """ Particle filter motio...
true
d76a1252c7c1b3d71e2a9fb723fa6ca31a1793e8
dongzhuoyao/video-query-in-the-wild
/misc_utils/utils_torch.py
UTF-8
3,408
2.546875
3
[ "Unlicense" ]
permissive
# Author: Tao Hu <taohu620@gmail.com> import torch from misc_utils import pytorchgo_logger as logger from termcolor import colored from tabulate import tabulate import warnings, os, sys if sys.version_info[0] >= 3: logger.warning("use reduce from functools...") from functools import reduce def set_gpu(gpu):...
true
7194685b1667f5858f79836deba1e02732e1aec1
MainakRepositor/Py-Hacker
/network_scanner.py
UTF-8
980
2.84375
3
[]
no_license
#!/usr/bin/env python import scapy.all as scapy import argparse def get_arguments(): parser = argparse.ArgumentParser() parser.add_argument("-t", "--target", dest="target", help="Sepcify target ip or ip range") options = parser.parse_args() return options def scan(ip): arp_packet = scapy.ARP(pdst...
true
ebe84d1e978ac88d2c7f41b94e91a2b931516519
wangtonylyan/Algorithms
/ds/queue.py
UTF-8
977
3.453125
3
[]
no_license
# -*- coding: utf-8 -*- # data structure: queue (FIFO) from list import List class Queue(List): def __init__(self): super(Queue, self).__init__() def push(self, value): que = self.__class__.Node(value) if self.head: it = self.head while it.next: ...
true
6f28d327bfc25c3636fa2897664b0df7a0485a15
varmaprudhvi7/Data-science
/decissiontree_assignment2.py
UTF-8
1,800
3.140625
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt import numpy as np min(company.Sales) max(company.Sales) #here we created dummy variables for US and Urban company=pd.get_dummies(company,columns=["US","Urban"],prefix=["US","urban"]) company=company.drop("US_No",axis=1) company=company.drop("urban_No",axis=1) #here ...
true
a4d143962799f5e2e1918dbdf661b60b435e5095
gtback/datascroller
/test/test_viewing_area.py
UTF-8
806
2.78125
3
[ "MIT" ]
permissive
import os import sys import io import unittest from datascroller.scroller import ViewingArea class TestViewingArea(unittest.TestCase): def test_padding(self): """Grabbing the output of print_representation""" stdout = sys.stdout sys.stdout = io.StringIO() va = ViewingArea(4, 2) ...
true
d7dc839b9217cc47a1f26f8c905ceb4b6fc3583f
MattHeffNT/axi-draw-lols
/engine.py
UTF-8
12,948
3.859375
4
[]
no_license
""" Tic-tac-toe engine code and helpers. """ from collections import Counter, defaultdict, deque from functools import lru_cache from typing import Callable, Deque, Dict, Optional, Tuple GameAgent = Callable[[str], Tuple[str, ...]] MoveCache = Dict[str, Tuple[str, ...]] @lru_cache() def move_at(board: str, index: i...
true
b477649c3acb51d5e378afd2787d60a869f73ba6
m-sterling/Kattis
/code/everywhere.py
UTF-8
207
3.734375
4
[ "MIT" ]
permissive
t = int(input()) for _ in range(t): n = int(input()) cities = [] for _ in range(n): city = input() if not city in cities: cities.append(city) print(len(cities))
true
03c4ce15d05fea74e6de7244551587dc371ebc81
git874997967/LeetCode_Python
/easy/tallestBox.py
UTF-8
566
3.125
3
[]
no_license
def tallestBox(boxes): # sort the boxes by the length x[0] boxes.sort(lambda x: x[0]) # generate one dict heights = {box: box[2] for box in boxes} for i in len(boxes): box = boxes[i] # S is the height untill now changeable S = [box[j] for j in range(i) if canBeStaked(box[j...
true
26b7948fd791bd7249cc50446e3368d78bc2a24c
flosscreatives/vectorisation_using_enc_dec
/train.py
UTF-8
852
2.515625
3
[]
no_license
from helper import get_text_dataset,get_one_hot_dataset import numpy as np import os texts, max_seq_len, tokens, num_tokens, token_index = get_text_dataset("preprocessed_corpus_file.txt") texts = texts[2000:3000] print('Number of samples:', len(texts)) print('Number of unique tokens:', num_tokens) print('Max sequenc...
true
f4d2630dc72b23dbd381ab5b9adcb7639be32ba3
msaei/coding
/LeetCode/Top Interview Questions/Dynamic Programming/Longest Increasing Subsequence.py
UTF-8
1,391
3.25
3
[]
no_license
#Longest Increasing Subsequence #https://leetcode.com/explore/interview/card/top-interview-questions-medium/111/dynamic-programming/810/ class Solution: def binarySearch(self, nums, key): right = len(nums) - 1 left = 0 while left <= right: mid = left + (right - left) /...
true
a11a0b48a778b6ba6d383bf4a203574d27bf20fb
cherishing99/InsarToolkit
/Support/RadarGeometries.py
UTF-8
6,267
3.15625
3
[]
no_license
''' SHORT DESCRIPTION Conversion factors and routines for different radar geometry conventions. FUTUTRE IMPROVEMENTS TESTING STATUS Tested. ''' ### IMPORT MODULES --- import numpy as np from IOsupport import load_gdal_dataset ### ARIA GEOMETRIES --- class aria_sensitivity_factors: def __init__(self, inc, az, v...
true
66126ec1dff3c47b4a73356519c298bb0ce7088e
JoeMazich/Networking-Project1
/http_server1.py
UTF-8
2,245
2.671875
3
[]
no_license
import socket import sys port = int(sys.argv[1]) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('localhost', port)) s.listen(5) while True: clientSock, clientAddr = s.accept() fullRequest = clientSock.recv(4096).decode() # Same header parsing as the curl clone header = {} firstLi...
true
ff6cfac37b83d322a787a4a006fc98fbd3eeddf2
Kotorinyanya/IMEGAT
/cpm.py
UTF-8
7,321
2.65625
3
[]
no_license
import pandas as pd import numpy as np from sklearn import datasets, linear_model from sklearn.linear_model import LogisticRegression import statsmodels.api as sm from scipy import stats import torch from torch_geometric.utils import to_scipy_sparse_matrix from tqdm import tqdm from sklearn.model_selection import KFold...
true
85a65d27afeb1145ae3abc5e73a51137cd205422
asxzhy/Leetcode
/leetcode/question_543/test_solution_1.py
UTF-8
319
3.09375
3
[]
no_license
from .solution_1 import Solution from .solution_1 import TreeNode def test_diameter_case_one(): # tree [1, 2, 3, 4, 5] root = TreeNode( 1, TreeNode(2, TreeNode(4), TreeNode(5)), TreeNode(3), ) res = Solution().diameter_of_binary_tree(root) assert res == 3
true
1537d126188b90c342b430218f6df33e97e1c08d
Falonie/PythonSpiders
/instagramCrawler/InstagramCrawler.py
UTF-8
2,587
2.546875
3
[]
no_license
import requests, hashlib, re, time, os, logging, pymongo from multiprocessing import Pool from concurrent import futures # path = '/media/salesmind/0002C1F9000B55A8/download_pictures' path = 'D:\download_pictures' collection = pymongo.MongoClient(host='127.0.0.1', port=27017)['Falonie']['instagram_urls_test3'] def l...
true
9b5c31a4af79e672065aac6f4b68007ab001dda4
cnmy-ro/kirchhoff-solver
/prototype/component_utils.py
UTF-8
2,525
2.953125
3
[]
no_license
class Resistor: def __init__(self, name, node_1, node_2, value): self.name = name self.node_1 = node_1 self.node_2 = node_2 self.value = value def __str__(self): return f"{self.name} -- {self.node_1} {self.node_2} -- {self.value}" def get_edge(self): retur...
true
b5c6cdba03c1226703d3c25b8d58939ae0a3c379
trgreenman88/CS_21
/greenman_scan_and_explore.py
UTF-8
4,680
4.0625
4
[]
no_license
# Trent Greenman # CS 21, Fall 2018 # Program: scan and explore def scan(matrix, num_rows, num_cols): # Requirement 4 (Bad inputs) # makes sure that matrix is a list if type(matrix) != list: return None # makes sure that matrix is not empty elif matrix == []: return None ...
true
16237b013c3111ab2f76f6186088e9d77f862deb
jsergey/goodesign
/denalysis/analyzer.py
UTF-8
1,140
2.5625
3
[]
no_license
from denalysis.db_version.git_parser import GitParser from denalysis.analysis.code_age import CodeAge from denalysis.analysis.authors import Authors import logging import sys logging.basicConfig(level = logging.ERROR, stream=sys.stdout) #git log --all --numstat --date=short --pretty=format:'--%h--%ad--%aN' --no-renam...
true
575363b95e4b44cefba3b1ab47864eaa306d5c84
VonC/fulltext
/fulltext/backends/__json.py
UTF-8
1,235
2.71875
3
[ "MIT" ]
permissive
import json import sys import re from six import StringIO from six import string_types from six import integer_types from fulltext.util import BaseBackend STRIP_JSON = re.compile(r'[{}\'":\[\] ]+') SCALAR_TYPES = string_types + integer_types ENCODING = sys.getfilesystemencoding() def to_text(text, obj): if isi...
true
9c54c892ea84914d6329e91603b901b7146a433e
SimeonGetnetGesese/alx-higher_level_programming
/0x0C-python-almost_a_circle/models/square.py
UTF-8
2,750
3.71875
4
[]
no_license
#!/usr/bin/python3 # square.py """Defines the square class """ from models.rectangle import Rectangle class Square(Rectangle): """Class Square inherits from Rectangle Args: size, x=0, y=0, id=None Raisses: """ def __init__(self, size, x=0, y=0, id=None): """Intiates the square obj...
true
a1aaf94c37d1effbeb64e0a8a3b2eb02c94ee1af
nedunurisaiamulya/first
/format.py
UTF-8
553
3.90625
4
[]
no_license
#To print Decimal, Octal, Hexadecimal and Binary Format of numbers from 1 to 101 #integer value for the limit.Here it is 101, can be changed. n=17 #For spacing between the each column, based on the integer limit given. spacing = len(bin(n)[2:]) print "Decimal".rjust(spacing, ' ')+"Octal".rjust(spacing+1, ' ')+"HexaDe...
true
76d724cd498c8817f9733a6e811e39f9d26bb990
brandondelpozo/algorithm-problems
/add_one.py
UTF-8
782
3.8125
4
[]
no_license
"""Add One to List - easy Easy You are given a list of integers nums, representing a decimal number and nums[i] is between [0, 9]. For example, [1, 3, 9] represents the number 139. Return the same list in the same representation except modified so that 1 is added to the number. Constraints 1 ≤ n ≤ 100,000 whe...
true
abad7fc51ffb0f768e067cb7963d4f55d3c7bc1d
AutWind/wgcca
/src/wgccaTest.py
UTF-8
3,218
2.875
3
[ "MIT" ]
permissive
''' Test suite for weighted generalized canonical correlation analysis. Adrian Benton 8/8/2016 ''' import os import unittest import wgcca as WGCCA import numpy as np import scipy import scipy.linalg class TestWeightedGCCA(unittest.TestCase): def setUp(self): ### Generate sample data with 3 views ### self...
true
c3c4eda43d1bf3bdea1405e7000829a1b326e6eb
Vivekyadv/450-DSA
/1. Array/27. trapping rain water.py
UTF-8
1,563
4.25
4
[]
no_license
# Given an array which represents the heights of blocks. If width of each block is 1, # compute how much water can be trapped between the blocks during rainy season # Example: # arr = [3,0,0,2,0,4] water trapped = 10 units # Algorithm # 1. find highest block on left and on right # 2. take smaller of two heights # 3....
true
e6d34b1b0b10fe9a036b56531b5a9aa2e607db69
prashant97sikarwar/leetcode
/Array/Check_if_ArrayIsSortedAndRotated.py
UTF-8
531
3.640625
4
[]
no_license
#Problem Link:- https://leetcode.com/problems/check-if-array-is-sorted-and-rotated/ """Given an array nums, return true if the array was originally sorted in non-decreasing order, then rotated some number of positions (including zero). Otherwise, return false. There may be duplicates in the original array.""" class ...
true
ca60631df6fc76514ed9e7fe5bd2f4686fbb39f5
SleepyChild1005/PythonPractice
/custom_util/custom_class.py
UTF-8
949
2.578125
3
[]
no_license
from torch.nn import Linear, ReLU, CrossEntropyLoss, Sequential, Conv2d, MaxPool2d, Module, Softmax, BatchNorm2d, Dropout class Net(Module): def __init__(self): super(Net, self).__init__() self.cnn_layers = Sequential( # Defining a 2D convolution layer Conv2d(1, 4, kernel_s...
true
16369a991a37089977ea660a0166535580d5e1d0
HIRO76/spyder_lesson
/book_beta1/book.py
UTF-8
5,417
3.25
3
[]
no_license
# This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # This program is distributed in the hopes that it will be useful,...
true
0d0345db5e19040a54ef1366aa7d4c7351571bee
mnguyen0226/gated_transformers_nlp
/src/seq2seq_nlp/nmt_jointly_learning/main.py
UTF-8
5,128
2.9375
3
[ "MIT" ]
permissive
""" Paper: https://arxiv.org/abs/1409.0473 Unlike the traditional statistical machine translateion, NMT aims to build a single network that can be jointly tuned to maximize the translation performace The model proposed recently for nmt often belong to family of encoder-decoders and consist of encoder that encodes a so...
true
0bbcf1b1b3cb8320d2e39b3d3f07d2e51e7fe684
xrw560/ai_bf
/DecisionTree/波士顿房屋租赁价格预测.py
UTF-8
5,575
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import pandas as pd import warnings import sklearn from sklearn.linear_model import LinearRegression, LassoCV, RidgeCV from sklearn.pipeline import Pipeline from sklearn.model_selection import train_test_split from skle...
true
ed3a9189dbd295036d6998fdd71aebdcff62c699
nsid10/Project-euler
/hackerrank version/017+.py
UTF-8
1,502
4
4
[]
no_license
def cardinal(num): if num < 20: names = [ "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" ] return names[num] i...
true
b8ceecccb8e9e8d159b5b6a00d641897d4de82c0
ThomasStuart/pythonLessonJune1
/addCols.py
UTF-8
439
3.515625
4
[]
no_license
listOfList = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] AddCol1 = 0 AddCol2 = 0 AddCol3 = 0 for x in range(0,3): for y in range(0,3): if y == 0: AddCol1 = AddCol1 + listOfList[x][y] elif y == 1: AddCol2 = AddCol2 + listOfList[x][y] elif y == 2: AddCol3 = AddCol3 ...
true
af182c07d614a60fc05c946d84339e0e4f229d85
neko-niko/leetcode
/剑指offer/快速排序/solution.py
UTF-8
577
3.015625
3
[]
no_license
def kspx(lst, start, end): if start >= end: return else: flag = lst[start] ptr1 = start + 1 ptr2 = start + 1 while ptr2 <= end: if (lst[ptr2] <= flag): lst[ptr2], lst[ptr1] = lst[ptr1], lst[ptr2] ptr1 += 1 ptr2 ...
true
dd298244ca781e65cdee1718d1cae2f39bbbdbc1
mckeeml/CrimePrediction
/Testtwit.py
UTF-8
3,248
2.9375
3
[]
no_license
import GetOldTweets3 as got totalTweets = 0 # init totalTweets variable numTweets = 0 # init numTweets variable keywords = ['arson', 'assault', 'child abuse', 'genocide', 'homicide', 'kidnapping', 'manslaughter', 'mugging', 'murder', 'crazy af', 'brawl', 'scrap', 'assaulted', 'rape', 'riot', 'kill',...
true
e449188642d7f8fdd414d366ee50f81a3b56477b
catapult-project/catapult
/dashboard/dashboard/pinpoint/models/change/change.py
UTF-8
11,511
2.625
3
[ "BSD-3-Clause" ]
permissive
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from __future__ import print_function from __future__ import division from __future__ import absolute_import import collections import json try: from ite...
true
53f8c0ce44e4db41b0893405d68162b692a433e6
EY-X/python_exercise_day7
/exercise5.py
UTF-8
739
4.4375
4
[]
no_license
# Exercise 1 # def double(my_number): # return my_number * 2 # Exercise 2 # def negative(numba): # if numba > 0: # return True # else: # return False # print(negative(-7)) # print(negative(8)) # Exercise 3 # def is_even(numba): # if numba % 2 == 1: # return False # else:...
true
f01a6d2f39a887b33c984a0191f1858da86479be
nulinspiratie/Qcodes
/docs/user/meta.py
UTF-8
3,053
2.796875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
" MWE of meta instrument (with debugging enabled) " import concurrent.futures as futures import logging import multiprocessing as mp import time from functools import partial from qcodes import Instrument # agreesive logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s- %(message)s') class MyInstr...
true
8a0da24fb1a518103ded3fd3417cbb5cbeb998b1
marcobius/pruebas_cnn
/clasif_SVM.py
UTF-8
3,522
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Aug 13 10:25:15 2016 @author: dpbou """ #Parser de argumentos # Lo coloco antes para evitar la carga innecesaria de librerías import argparse ap = argparse.ArgumentParser( description = "Clasificador de imagenes. Es necesario incluir en linea de comando la imagen o direct...
true
c27a44be59c02d3107fcda21ce4497b911f0ba33
pmrv/genevo
/bin/genevo
UTF-8
3,388
2.875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import pygame, random, sys from pygame.locals import * from random import randint from genevo.bitint import BitInt from genevo.engine import Engine GREEN = Color (000, 255, 000) WHITE = Color (255, 255, 255) BLACK = Color (000, 000, 000) WIDTH = 600 HEIGHT = 600 CELLXNR = 60 # numbe...
true
38b738fe648554826dc8b0e4aec536a88e8bcd0e
marrow/schema
/marrow/schema/testing.py
UTF-8
1,283
2.890625
3
[ "MIT" ]
permissive
"""Utilities for assisting in testing validators. These are used by Marrow Schema's validation tests and is exported for use in your own. """ import pytest from .exc import Concern def pytest_generate_tests(metafunc): """Automatically bind valid/invalid class attribute fixtures to the provided test templates. ...
true
3115c0da973774c4a8defd315bd5c28c2ff46045
agostinhoramos/BruteforceMD5
/src/lib/algorithm/hack_MD5.py
UTF-8
4,989
2.71875
3
[ "MIT" ]
permissive
from ..algorithm.app import App import itertools import threading import queue import re Que = queue.Queue() #FIFO list class decrypt(App): def __init__(self, obj): self.OBJ = obj['obj'] self.SQL = obj['sql'] self.numThread = 0 self.numTry = 0 self.numFound = 0 hash...
true
2d09daf05df54916c63b84ed598ad42022ad97ec
WillKeWang/DBDP
/DigitalBiomarkers-Preprocessing/Signal-Alignment/minus12_dtw_result.py
UTF-8
4,736
2.515625
3
[ "Apache-2.0" ]
permissive
import matplotlib.pyplot as plt import pandas as pd import numpy as np from scipy.spatial.distance import seuclidean from dtw import dtw import visualization as vs import math def get_link(x, y, path, vertical_mov, shift_time): # make use of the feature of continuous increasing # make sure that x and y are 2D...
true
30cfcdb6b844cce2550d441478c773ebc6b8d8f6
dazzlefish/I-I-Teaching
/dijkstrastudent/pathfinder.py
UTF-8
34,120
3.625
4
[]
no_license
''' An implemenation of a breadth-first-search pathfinding algorithm. The pathfinder can be configured in many ways, but the default configuration leads to the use of the A* pathfinding algorithm (say 'A-star'). A well known configuration is the lazy breadth first search algorithm, better known under the name of Dijks...
true
8b9ef39f6369347c50cac0f7e83a40a70a77afd6
attapol/brown_coref_implicit
/tpl/pdtb_tools/relation.py
UTF-8
8,489
2.875
3
[]
no_license
"""Relation class wrapper for PDTB discourse relation tokens The JSON structure created by Corpus class is a bit messy to access because the optional fields might not exist. """ import json from tpl.testing import assert_ge class Relation(object): def __init__(self, relation_dict): self.data_dict = relation_dict ...
true
798a7d7603e9c932b9a1671e9b227015fd872f01
aseth99/doc2vec
/doc2vec.py
UTF-8
1,683
2.59375
3
[]
no_license
#Import all the dependencies import gensim from gensim.models.doc2vec import Doc2Vec, TaggedDocument from nltk.tokenize import word_tokenize # import DocIterator as DocIt # import nltk # nltk.download() with open('testData.txt', 'r') as f: data = f.readlines() tagged_data = [TaggedDocument(words=word_tokenize(_...
true
36b197299557eb7986d81b7151b136a94a4d45f6
songdoyouho/cat_and_dog
/cat_and_dog.py
UTF-8
8,122
2.65625
3
[]
no_license
from keras.utils import np_utils from keras.models import load_model from sklearn.model_selection import train_test_split import numpy as np import csv, os, cv2, random, glob, h5py, keras import matplotlib.pyplot as plt from keras.callbacks import LearningRateScheduler, ModelCheckpoint np.set_printoptions(suppress=Tr...
true
67da7e83f6c94c4d49ed8858bb8c60d1a37e0093
LucasSwitz/Ez_Pi_Robot_Lib
/command/Command.py
UTF-8
1,789
2.90625
3
[]
no_license
import abc class Command: def __init__(self, parallel=False): self._parallel = parallel self._valid = True self.switches = { "-p": Command.set_parallel(self, True) } self._used_system = None self._interruptable = True self._was_interrupted = Fals...
true
aec4a20bb38d36a500250f0c4337f236921699da
sktometometo/imada_forcegauge
/scripts/print.py
UTF-8
718
2.71875
3
[]
no_license
#! /usr/bin/env python # coding: utf-8 """ Imada の フォースゲージのドライバとなるクラス """ import serial import time import sys from forcegauge import ForceGauge if __name__=="__main__": if len( sys.argv ) < 2: print("print force gauge data") print("usage:program <serial port> <print rate (optional default: 10H...
true
afdf251fbfbcff5eff56940f82ce38c926404466
wonnor-pro/idontpanic
/playground/camera_test.py
UTF-8
546
2.578125
3
[]
no_license
import cv2 cap = cv2.VideoCapture(1) # External(1) Internal(0) # cap.set(10, 120) # brightness # cap.set(11, 128) # contrast # cap.set(12, 160) # saturation shot = True while True: _, frame = cap.read() if (shot): print(frame.shape) cv2.imwrite('snapshot1.jpg', frame) shot = False ...
true
5cdf4b1b6a831d0137c2b3c7a9b97348c9187b56
RexFault/ast-dns
/server/server.py
UTF-8
1,125
2.671875
3
[]
no_license
#!/usr/bin/python import sys import threading import os.path import ast_db import ast_network def print_usage(): print("Usage: {0} <db_file> <port number>\r\n".format(sys.argv[0])) print("Starts the AST DNS Server using <db_file> as the database file and listens on <port number> for clients") # Main s...
true
366873f27e85d615a5f9a4be7de5f9e405e7568d
alesdotio/django-shop
/shop/models_bases/managers.py
UTF-8
5,878
2.59375
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- from django.contrib.auth.models import AnonymousUser from django.db import models, transaction from django.db.models.aggregates import Count from polymorphic.manager import PolymorphicManager from shop.order_signals import processing #==========================================================...
true
ee210e72e7d74a308580d8fc830c5573e3aa76be
JesperLM/SEIRD_Model_COVID-19
/SEIRD_model.py
UTF-8
8,132
3.140625
3
[ "MIT" ]
permissive
import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from scipy.integrate import solve_ivp def movingAverage(series, window_size, exclude = 1): """ This function averages the data series over a set of datapoints (window_size). It can also exlude a s...
true
6a0817de6d37b900e513e7a276c517a8c8dd3ce6
allfed/Seaweed-Growth-Model
/tests/test_postprocessing.py
UTF-8
1,101
3.421875
3
[ "Apache-2.0" ]
permissive
import pandas as pd import pytest from src.utilities import weighted_quantile def test_weighted_quantile(): """ Tests the weighted quantile function """ # Generate two pandas series with 5 values each s1 = pd.Series([1, 2, 3, 4, 5]) s2 = pd.Series([0.5, 1.5, 2, 0.5, 1]) # calculate the we...
true
285da85f5460c86452a67bf3dbe2c3c59f2d354e
kaitokuroba7/Pytorch_lightning_Learning
/model/linear.py
UTF-8
1,157
2.90625
3
[]
no_license
#!/usr/bin/env python # encoding: utf-8 """ @author: J.Zhang @contact: 1027380683@qq.com @site: https://github.com/kaitokuroba7 @software: PyCharm @file: linear.py @time: 2021/6/10 15:37 """ import torch from torch.nn import functional as F from torch import nn from pytorch_lightning.core.lightning import LightningMod...
true
5960cd23616bbf28e49ecf4133a1f1ed8a321eec
skyn310198/MSA2021
/source_dir/echo_score.py
UTF-8
1,772
2.609375
3
[]
no_license
# Load libraries import base64 import json import os import numpy as np import sklearn from tensorflow import keras from tensorflow.keras import layers from sklearn.feature_extraction.text import TfidfVectorizer # 1. Requried init function def init(): # Create a global variable for loading the model global ...
true
8fa0b7183abc29c1f0eefd55b33e5b0c00519f54
Sujeily-Fonseca/TechnoCapabilities
/Signal and Tone Generator Module/Tone Generator (Python)/ToneGenerator_Test.py
UTF-8
2,811
3.53125
4
[]
no_license
# Project: Hands-Free Intraoral Electrolarynx # Module: Signal and Tone Generator # Description: This script was developed to test the ToneGenerator script. # Author: Sujeily P. Fonseca-Gonzalez # Username: Sujeily-Fonseca import time from ToneGenerator import toneGenerator from ToneGenerator import increaseVolume fro...
true
59854d406447b707aa37c7c79e322169fc583ed7
DrKwint/pyroclast
/pyroclast/cpvae/ddt.py
UTF-8
4,115
2.515625
3
[]
no_license
import os import numpy as np import sklearn import tensorflow as tf import tensorflow_probability as tfp from tqdm import tqdm import sklearn tfd = tfp.distributions class DDT(tf.Module): """Differentiable decision tree which classifies on the parameters of a Gaussian""" def __init__(self, max_depth): ...
true
38f763ff6441f6e0a3c569c6dc4635297d2ee3be
A01745549/hkprueba
/eje1.py
UTF-8
665
2.515625
3
[ "MIT" ]
permissive
pwd ls #buscarlibreria cd desktop cd /mnt/ ls # todas las carpetas cd desktop # entrar al escritorio y buscar la imagen pwd cp/mnt/d/escritotio/00.003.jpg imagen.jpg ls git status git add git commit-m "Agregar nuevos archivos" git push vim ejemplo1 import cv2 imagen=cv2.imread('imagen.jpg') imagen =cv2.cvtcolor(i...
true
0890b51a63ac84fd537b12e2bceea44b41f8e1aa
thomasearnest/MDeepLearn
/ScikitLearn/NN.py
UTF-8
916
3.21875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ ------------------------------------------------- File Name:NN Description : 最近邻 Email : autuanliu@163.com Date:2017/12/22 """ import matplotlib.pyplot as plt import numpy as np from sklearn.neighbors import NearestNeighbors, KDTree # 无监督 # 找到两组数据集中最近邻点的...
true
5fd7bbb933ff4e74d6c3a1ecae86d432ff300b8f
altugkarakurt/NeuralHDR
/Experimental/Perceptron.py
UTF-8
489
2.875
3
[]
no_license
# -*- coding: utf-8 -*- import numpy from numpy import sign as signum # def heaviside(x): return (0.5 * (numpy.sign(x) + 1)) def heaviside(x): return (1 if x >= 0 else 0) class Perceptron: def __init__(self, *weights, activation_function=heaviside): self.activation_function = activation_function self.weights = ...
true
97943789ef45e703e3b2377993f5aceba93dbcc2
liuluyang/mk
/py3-study/网络编程课上代码/1901/10-14/文件上传下载-服务端.py
UTF-8
3,341
2.734375
3
[]
no_license
# ! /usr/bin/env python # -*- coding: utf-8 -*- # __author__ = "Miller" # Datetime: 2019/10/14 10:37 import multiprocessing import socket import os import json import time """ 文件上传下载服务端流程的实现 未做异常处理 """ basepath = os.path.dirname(os.path.abspath(__file__)) homepath = os.path.join(basepath, 'home') class FTPServer: ...
true
0bea9a941e5a982757133627b059844f702086a3
TamuraMasayuki/image_processing
/functions/light_tunnel.py
UTF-8
817
2.9375
3
[]
no_license
import cv2 import copy import os from tqdm import tqdm import numpy as np img = cv2.imread("sample.jpg") def beep(freq, dur): os.system('play -n synth %s sin %s' % (dur / 1000, freq)) # 光のトンネル def LightTunnel(img): light_tunnel = copy.deepcopy(img) a = len(img) b = len(img[0]) bar = tqdm(total...
true
0a82567e2cbc6139a16aaff846d01ec48e3c1e6d
edu-athensoft/ceit4101python
/stem1400_modules/module_9_datetime/s96_timestamp/datetime_2_datetime2timestamp.py
UTF-8
179
3.0625
3
[]
no_license
""" 6.2 datetime to timestamp """ from datetime import datetime # current date and time now = datetime.now() timestamp = datetime.timestamp(now) print("timestamp =", timestamp)
true
f21506f37e90a93e6ae38d4f324361c295425e10
RodionBukhanevych11/video_images_recognition
/lab1/lab1.py
UTF-8
2,944
2.640625
3
[]
no_license
import cv2 import numpy as np import os class Video_recorder(): def __init__(self, video_path): self.video_path = video_path self.capture = None def record(self): print("HI") self.capture = cv2.VideoCapture(0) vid_cod = cv2.VideoWriter_fourcc(*"XVID") output = c...
true
70a0dc8336da4927dc2bd1077c007705116eff4c
ashesh-0/PdfFromImages
/run.py
UTF-8
1,983
3.25
3
[ "MIT" ]
permissive
import argparse import os from images_to_pdf import ImagesToPdf from split_image import SplitImage from background_cleaning import BackgroundCleaning def get_cleaned_files(fpaths): # Remove background cleaner = BackgroundCleaning(fpaths.copy()) output = cleaner.run() cleaned_files = [] for fpath ...
true
4c2ef47c783ab42ce1050f06b61afc243770b6b7
eecs110/winter2019
/course-files/tutorials/tutorial04/drawings.py
UTF-8
512
3.203125
3
[]
no_license
from tkinter import Canvas, Tk import random import shapes gui = Tk() gui.title('Circle') # initialize canvas: canvas = Canvas(gui, width=500, height=500, background='#FFFFFF') canvas.pack() ########################## YOUR CODE BELOW THIS LINE ############################## shapes.make_circle(canvas, (250, 250), 25...
true
ade72af49b6965a4dbf633e24c4023c1e7ea9c79
cherbie/lineartools
/study_summary/src/FileReader.py
UTF-8
1,374
3.140625
3
[]
no_license
from openpyxl import load_workbook import os class FileReader: def __init__(self, filename): ''' @param filename - location of xlsx workbook file (Medrio Browse Data File) ''' if not os.path.exists(filename): raise Exception('IOERROR: Could not find the input file') ...
true
fd61ac8456f2599fc3d018d49326afc2471b87b7
hemmerling/python-coursera2012
/src/week3/week3_test.py
UTF-8
4,714
2.859375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- """ # @package coursera2012 # @author Rolf Hemmerling <hemmerling@gmx.net> # @version 1.00 # @date 2015-01-01 # @copyright Apache License, Version 2.0 # # Implementation of the game # "Stopwatch: The Game" # for the Coursera course # "An I...
true
641446af43cd7f31c169a834ceebac7ade735226
anantkaushik/Design_Patterns
/Factory/Example/autos/abs_auto.py
UTF-8
299
2.609375
3
[]
no_license
import abc class AbsAuto(metaclass=abc.ABCMeta): @property def name(self): return self._name @name.setter def name(self, name): self._name = name @abc.abstractmethod def start(self): pass @abc.abstractmethod def stop(self): pass
true
f9b1c762a505b83c16e2606fe37c77bfb41f8df3
mindgitrwx/pyrobot3
/general/gaca.py
UTF-8
3,037
2.859375
3
[]
no_license
from pyrobot.general.ca import * from pyrobot.brain.ga import * class GACAGene(Gene): def __init__(self, **args): Gene.__init__(self, **args) pos = args["pos"] popSize = args["popSize"] bias = pos / float(popSize) #random.random() self.genotype = [] for i in range(a...
true