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
f8f8648d7968df0351816bae220a02de64c287d5
dennikey/Interview-Cake
/Interview Cake/Unit 8 Linked lists/delete-node.py
UTF-8
468
4.375
4
[]
no_license
# Delete a node from a singly-linked list, given only a variable pointing to that node. class LinkedListNode(object): def __init__(self, value): self.value = value self.next = None def delete_node(node_to_delete): next_node = node_to_delete.next if next_node: node_to_delete...
true
9b4dec81902145c2cbab54299bdf78e582c7b37a
guangying94/LatencyApp
/App Server/internet-app.py
UTF-8
1,512
2.515625
3
[]
no_license
import flask from flask import request, jsonify import pyodbc import json import requests app = flask.Flask(__name__) app.config["DEBUG"] = True #DB Information server = '<SQL Server Name>' database = '<Database Name>' username = '<DB User>' password = '<DB Password>' #Main page @app.route('/',methods=['GET']) def h...
true
1adc9a53aa176dad9af5922de34da7671471067c
PrashantRaghav8920/GUVI_PROGRAM
/PLAYER/SET5/sub.py
UTF-8
55
3
3
[]
no_license
n,m=input().split() print("yes" if m in n else "no")
true
59ba1940aaf1945b35bc7f43231cbbdfd1b1feb1
amgonz/final_project
/app.py
UTF-8
5,216
2.609375
3
[]
no_license
import json import plotly import plotly.graph_objs as go import coinmktcap as coincap import redditscrape as reddit import sys from flask import Flask, render_template, flash, request import coindesk as coindesk app = Flask(__name__) coincap.get_coin_names() @app.route('/',methods=['GET', 'POST']) def search(): ...
true
35696c4854bc0347903ae1775c8ffe28ee52063f
chlien/MFIR-AP
/MFIRAP/d01_data/augment.py
UTF-8
9,448
2.8125
3
[ "MIT" ]
permissive
""" Augment negative samples by extracting non-overlapping segments. """ import argparse import os import sys import glob import numpy as np import tqdm import HTPA32x32d import copy DTYPE = "float32" VIEW_IDS = ["121", "122", "123"] def splitall(path): allparts = [] while 1: parts = os.path.split(pa...
true
ca45b5520e6fa06f63bab336cf42954ce145d614
lsjsss/PythonClass
/PythonBookAdditional/第07章 文件操作/code/7_23.py
UTF-8
1,142
3.015625
3
[ "MIT" ]
permissive
from os.path import isdir, join from os import listdir AllLines = [] #保存所有代码行 NotRepeatedLines = [] #保存非重复的代码行 file_num = 0 #文件数量 code_num = 0 #代码总行数 def LinesCount(directory): global AllLines global NotRepeatedLines global file_num global code_num for filename in listdir(directory): temp...
true
2e20354d2cc592ca02b10de6255ccd3d264354b8
nazhimkalam/Complete-Python-Crash-Couse-Tutorials-Available
/OOP tutorials/Polymorphism.py
UTF-8
1,880
4.1875
4
[]
no_license
# ====> POLYMORPHISM means many behaviours # There are four ways of implementing polymorphism # 1.) Duck Typing class PyCharm: def execute(self): print('Executing ide....') class JetBrain: def execute(self): print('Executing ide....') # obj = PyCharm() # this also has execute method # obj = ...
true
ac695328bc1be4b6967efb21a97b761fb27ad8bc
mjburgess/public-notes
/python-notes/11.OO/Demo11-4.3.Constructors.py
UTF-8
1,005
4.53125
5
[]
no_license
# CONSTRUCTORS """ NOVICE ASIDE: Why do we use constructors? To determine what data each object of a type should be given, ie., to construct those objects. """ class Person: def __init__(person): person.name = 'Michael' me = Person() print(me.name) print(vars(me)) you = Person() print(you.na...
true
6d47f4c2c9a63afcffd92502bf7f206716685671
elegance-run/spiderproject
/douban.py
UTF-8
1,069
2.59375
3
[]
no_license
from bs4 import BeautifulSoup import requests import time import pymongo client = pymongo.MongoClient('localhost', 27017) douban = client['douban'] item_info = douban['item_info'] urls = ['https://movie.douban.com/tag/爱情?start={}&type=T'.format(str(i)) for i in range(0,1500,20)] #https://movie.douban.com/tag/爱情?start...
true
bebe56771d8f863f856ecfcdaa26ea4893909e30
greenDNA/Python-Crash-Course
/Exercises/Chapter 8/12.py
UTF-8
165
2.84375
3
[]
no_license
def sandwich_wants(*wants): for want in wants: print(want) sandwich_wants('lettuce', 'tomato', 'rice') sandwich_wants('turkey') sandwich_wants('cheese')
true
16e3bc3bbf03f7a6ae197a4f32c751321a83a6ec
mscroggs/CEEFAX
/ceefax/fonts/font.py
UTF-8
3,962
2.890625
3
[ "MIT" ]
permissive
from ceefax import config class LetterBlock: def __init__(self, _str): self._str = _str def __add__(self, other): return LetterBlock( "\n".join([l1 + l2 for l1, l2 in zip(self._str.split("\n"), other._str.split("\n"))])) def _...
true
7b4b126efe5667608400f90cf3a06ff8c622c301
IGORYUCH/pygame-animations
/bouncing comet.py
UTF-8
1,080
3.125
3
[ "Unlicense" ]
permissive
import pygame class RectMove: def __init__(self,x,y,gray): self.x = x self.y = y self.x_spd = 1 self.y_spd = 2 self.gray = gray def move(self): pygame.draw.circle(screen,[self.gray,self.gray,self.gray], [self.x-2,self.y-2],10,0...
true
26e34911943da6a12f21c020c28dd65dd4518c5e
yinonrousso/intro-python
/lessons/lesson_3/for-loop-example.py
UTF-8
182
4.03125
4
[]
no_license
l = ["bud", "wiser"] #example of getting index of a list in a for loop for v in range(len(l)): print(l[v]) #example of getting item for list in for loop for i in l: print(i)
true
fe396ce9a12a4e632c5a643e9094519d6e867495
SpiderOak/file_name_set_manager
/tests/test_consumer.py
UTF-8
4,006
2.828125
3
[]
no_license
# -*- coding: utf-8 -*- """ test_consumer.py A program to consume files listed in file_name_set_manager """ import argparse import logging import os import os.path import random import sys import time import redis class CommandlineError(Exception): pass _program_description = "consume test files from watch dir...
true
627dd180b3a203ceaefab2534a343ece2b69f90c
aigerimzh/BFDjango
/Week1/CodingBat/missing-char.py
UTF-8
86
2.8125
3
[]
no_license
def missing_char(str, n): l = [] l = list (str) l.pop(n) return ("".join(l))
true
e375454f2118f9c0d34c2d50f93779859a54e388
vedant-y/moto-bootlogo
/moto-bootlogo.py
UTF-8
11,825
2.5625
3
[]
no_license
import argparse import sys import os import io import json import hashlib from PIL import Image class MotoBootLogo: def __init__(self, input, output, list): if list: if os.path.isfile(list): self.decode(list, None); return elif os.path.isfile(input): ...
true
9060d58f8f615645dbbfaea87b2ba6a4bdca2a07
Freddie-Howells/SmartSeat
/Bus_entry.py
UTF-8
3,432
2.8125
3
[]
no_license
import face_recognition import picamera import numpy as np import os import time import RPi.GPIO as GPIO from gpiozero import MotionSensor from socket import socket, AF_INET, SOCK_DGRAM import subprocess import psycopg2 #camera camera = picamera.PiCamera() camera.resolution = (320, 240) output = np.empty((240, 320, 3)...
true
2149c69c229f429c7837861cafbf6845e072f56b
Joanna-Zhou/Robotics
/Bayesian-Localization.py
UTF-8
3,921
2.953125
3
[]
no_license
class BayesianLocalization(object): def __init__(self): self.stateModel = { -1: {-2: 0.10, -1: 0.70, 0: 0.15, 1: 0.05}, 0: {-1: 0.10, 0: 0.80, 1: 0.10}, 1: {-1: 0.05, 0: 0.15, 1: 0.70, 2: 0.10}} # P(nextState|currState, currInput) self.measurementModel = {"hallwa...
true
2befef2de9a805d1c337a895680e6ff59e2c2211
chetangaur/Competitive-Coding-python-
/Merge_2_sorted_link_list.py
UTF-8
1,346
3.546875
4
[]
no_license
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: if l1==None: # if list1 is empty return list2 ...
true
57d4b8994c33caf1de52b47a77b351eac1a6836a
H1Y1B8S1/Basic-with-Classes
/03_Methods.py
UTF-8
1,943
4.28125
4
[]
no_license
""" Difference between 'REGULAR METHOD','CLASS METHODS' and 'STATIC METHODS'. """ """ --While working with classes-- (1) 'REGULAR METHOD' automatically pass the instance as a first argument and we call that 'self'. (2) 'CLASS METHODS' automatically pass the CLASS as a first argument and we cal...
true
5a0e6b83ccb37f5e92ec31c65ef208e91ab88908
niteesh2268/coding-prepation
/codechef/DSA-Learning-Series/Divide and Conquer + Binary Search/QHOUSE.py
UTF-8
1,144
3.65625
4
[]
no_license
import sys def get_square_base(): l, r = 0, 1000 value = r while l <= r: mid = (l+r)//2 print('? %d %d'%(mid, 0)) sys.stdout.flush() answer = input().strip() if answer == 'NO': r = mid - 1 else: value = mid l = mid + 1 return value def get_triangle_base(square_base): l, r = square_base, 10...
true
f2ed169c6d36db8f39b347327e824b9f4a29fc62
TateStaples/AdvCompSciNotes
/Projects/MountainPaths/Mountain.py
UTF-8
2,979
2.765625
3
[]
no_license
from AbstractAStar import AStar, Node import numpy as np import cv2 from PIL import Image class Pathfinder(AStar): show_counter = 0 frequency = 500 def __init__(self, row, file): file = np.loadtxt(file) if ".dat" in file else np.array(Image.open(file)) file = file.astype(np.float32) ...
true
0fd52c6cd02ff3e21183956870e608d7ccbcaca1
Jibbajabbafic/AdventOfCode2018
/12across.py
UTF-8
977
3.5625
4
[]
no_license
# Please write your code inside the function stub below. def solution(n, x, r): groups = [] for this_bomb in range(n): for subset in groups: for bomb in bombs_in_range(this_bomb, x, r): if bomb in subset: subset.add(this_bomb) break ...
true
f62971ffa9df4efb0472ff88570e135270c4a121
payz404/EZDownloaders
/Module/banner.py
UTF-8
1,146
2.890625
3
[]
no_license
################################### #### #### #### Author : Im.Payz #### #### Name : EZDownloader #### #### Version: 2.0 #### #### #### ################################### class Banners: def EzWelcome(self): banner = """ ...
true
21449d79dcfab2820beccfa5b647f71fcc7be4ea
mjDelta/Predictive_Analysis
/01_analysis.py
UTF-8
980
3.28125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jun 07 22:16:28 2017 @author: ZMJ """ import pylab import scipy.stats as stats import urllib2 #使用urllib获得网上数据 target_url=("https://archive.ics.uci.edu/ml/machine-learning-"\ "databases/undocumented/connectionist-bench/sonar/sonar.all-data") data=urllib2.urlopen(target_url)...
true
4af4f781eab8996ac6016ff2a4870cfd70cc7623
vicmak/Sequence-classification
/vocab_extract.py
UTF-8
1,862
3.140625
3
[]
no_license
from nltk.probability import FreqDist import nltk def get_tokenized_padded_line(string_line): line = string_line.lower() line = ExtractAlphanumeric(line) tokens = get_padded_sentences_tokens_list(line) line = ["<start>"] + tokens + ["<stop>"] return " ".join(line) def ExtractAlphanumeric(ins): ...
true
430ed4363860a206e817d437be99b8fe6596e106
jeffshurtliff/khoros
/khoros/auth.py
UTF-8
11,879
2.625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ :Module: khoros.auth :Synopsis: This module handles authentication-related tasks and operations for the Khoros Community APIs :Usage: ``import khoros.auth`` :Example: ``session_key = khoros.auth(KhorosObject)`` :Created By: Jeff Shurtliff :Las...
true
ac2976080bff16a35012a220188f0fa5fa4967f4
room77/py77
/pylib/mps/packager/shared/copy_shared.py
UTF-8
647
2.859375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
""" Copies the shared utilities to the appropriate package destination. @WARNING keep this list small, because nearly every package will include these files """ import os.path import shutil class CopyShared(object): # the set of utility files are copied SHARED_FILES = ['control_base.py'] @classmethod def cop...
true
61b404a271ce7d21a1e97be31a2664bf4917cb54
fazlikeles/RACLAB
/Yapay Zeka/machine learning examples/sayi_tahmini.py
UTF-8
1,184
2.546875
3
[ "MIT" ]
permissive
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("data/MNIST_data/", one_hot=True) import cv2 import numpy as np x=tf.placeholder(tf.float32,[None, 784]) W=tf.Variable(tf.zeros([784,10])) b=tf.Variable(tf.zeros([10])) y=tf.nn.softmax(tf.matmul(x,W)+...
true
a8f82d6ee7de9b8ef2aceff2ab6492e2db658d80
TheProjecter/python-stdnet
/stdnet/contrib/timeserie/utils.py
UTF-8
512
2.828125
3
[ "BSD-3-Clause" ]
permissive
from datetime import date, timedelta def dategenerator(start, end, step = 1, desc = False): delta = timedelta(abs(step)) end = max(start,end) if desc: dt = end while dt>=start: yield dt dt -= delta else: dt = start while dt<=end: ...
true
52c2390bb7c51593feb7d7a643db716c8c39ed50
CafeYuzuHuang/coding
/LongestCommonPrefix.py
UTF-8
2,791
3.6875
4
[]
no_license
class Solution(object): """ def recurStrComp(self, s1, s2): # Used in 5th approach try: assert s1 == s2 return min(len(s1), len(s2)) except: x = min(len(s1), len(s2)) - 1 if x > 0: return self.recurStrComp(s1[0:x], s2[0:x]) ...
true
8a0cc8139677532e04be56a773dfac99c33e92e5
openequella/openEQUELLA-ebi
/package-win-linux/package.py
UTF-8
234
2.75
3
[]
no_license
import zipfile, os print "Zipping files..." archive = zipfile.ZipFile("ebi.zip", 'w') for root, dirs, files in os.walk('ebi'): for fileName in files: archive.write(os.path.join(root,fileName)) archive.close()
true
1090f5dd73af30ff6f93a6e5a34ebfe26a96dfc8
pct960/anonymiser
/misc/pandas_process.py
UTF-8
2,315
2.78125
3
[]
no_license
#!/usr/bin/env python3 import pandas as pd chat_data = pd.read_csv("../data/output.csv") grids100m = {} grids1km = {} grids10km = {} grids100km = {} for index, row in chat_data.iterrows(): if index == 0: continue if (not row["lat"]) or (not row["lon"]): continue l...
true
b44957ef6bb9f04b56b049e5e046656a8f75dc62
MilanaGaiduk/rvs
/client.py
UTF-8
375
3.046875
3
[]
no_license
import socket client_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client_sock.connect(('192.168.249.130', 53210)) sum = 0 for i in range(5): client_sock.sendall(b'give me a number') data = client_sock.recv(1024) term = data.decode() sum += int(term) print('Received',term) client_sock.c...
true
7737456d3218485f4912a23260e80ccbbd36c00b
slavaider/python
/src/17_homework_5.py
UTF-8
348
4.125
4
[]
no_license
import math class Circle: def __init__(self, r): self.r = r def get_area(self): return math.pi * self.r ** 2 def get_perimeter(self): return 2 * math.pi * self.r if __name__ == '__main__': circle = Circle(10) area = circle.get_area() per = circle.get_perimeter() ...
true
53ac70a6d0e0a00521c9792be47f30402a9772fc
nfredrik/kistapython
/ping_test/test_ping.py
UTF-8
1,003
2.703125
3
[]
no_license
from ping import create_parser, ping #from unittest import TestCase import unittest class CommandLineTestCase(unittest.TestCase): """ Base TestCase class, sets up a CLI parser """ @classmethod def setUpClass(cls): parser = create_parser() cls.parser = parser class PingTestCase(Comma...
true
b7f87d2af150ac06e4841cd2978f339356dfbc4b
UlfHed/Thesis_IDS_CAN_Bus
/AlarmScenarios_SCH.py
UTF-8
2,904
3.421875
3
[]
no_license
# Illustration of the three alarm scenarios for the SCH case; early detection, perfect detection, and late detection. import numpy as np import matplotlib.pyplot as plt def main(): # Create data. CP = 101 alarmEarly = 50 alarmLate = 150 maxObservations = 200 nrSections = 2 sectionSize = ...
true
645422ffdad9afaf82663d6345e257b22e051731
Fatake/Tecnicas-ia
/RegresionLinealSimple/reg_lineal.py
UTF-8
1,516
3.59375
4
[]
no_license
import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression FILE_PATH = 'Salario_Experiencia.csv' def main(): print("\t<-- Ejemplo de Regresion lineal -->\n") dataset = pd.read_csv(FILE_PATH) print("Leeyen...
true
4f13105ff86e5b19b96b140192e79c0d304b8a72
Dutkowska/Python
/spoj/pol-polowa.py
UTF-8
81
3.390625
3
[]
no_license
t=int(input()) for i in range(t): text=input() print(text[:len(text)//2])
true
4e7af639627bf73a095b4a6bc36ce0060b8af253
Jokekiller/Iteration
/Asking for the amount of numbers to be averaged and then the numbers to be averaged.py
UTF-8
517
4.25
4
[]
no_license
#Harry Robinson #15-10-2014 #Program asking the amount of numbers to be averaged and then the numbers to be averaged total = 0 counter = 0 amountOfNumbers = int(input("Give the amount of numbers you wish to be averaged: ")) while counter < amountOfNumbers: number = float(input("Please enter number {0} in the seri...
true
f036828be50b2e5c92b609c26563fb6af46c74d1
hydroxymoron/challenges
/social_suggestions.py
UTF-8
2,463
3.5625
4
[]
no_license
import argparse from collections import Counter def rec_new_services(userid, text): ''' INPUT: User ID (as a string) of the user we would like to recommend new services to, and list of strings containing users, the users they follow on Twitter, and the services the user uses OUTPUT: A list of the services used ...
true
6d7f3ce69867abb27bf077d88e3a74a8cb695184
zunzuncito/zunzuncito
/test.py
UTF-8
1,138
2.5625
3
[ "BSD-3-Clause" ]
permissive
import unittest import zunzuncito class ZunZunTest(unittest.TestCase): versions = [' ', '', 1, 'v0', 'my version', (1,), 'api/v1'] routes = [ ('/.*', 'default'), ('/teste', 'test_put', 'PUT'), ('^/teste', 'test_put', 'PUT'), ('[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9...
true
f5512723f5b28347e4dee7b1eb2d0e71cf072123
thuurzz/Python
/faculd_impacta/tec_prg_2sem/execises/Ex01_URI/ex_1041.py
UTF-8
450
3.78125
4
[]
no_license
# lê valores, separa, coloca cada um em uma var valores = input() v = valores.split() x,y = float(v[0]),float(v[1]) print(f'x={x}, y={y}') # define localização dos quadrantes if x > 0 and y > 0: print('Q1') elif x < 0 and y > 0: print('Q2') elif x < 0 and y < 0: print('Q3') elif x > 0 and y < 0: print('Q4') el...
true
431b7c001916fe70fb8bd1e37dd094743d3fc924
mutiangua/EIS2020
/students/Jiani Huang/mycontrol/camerahsv.py
UTF-8
1,732
2.796875
3
[]
no_license
import cv2 import numpy as np from pykeyboard import PyKeyboard cap = cv2.VideoCapture(0) k = PyKeyboard() lower_blue = np.array([100,43,46]) upper_blue = np.array([124,255,255]) def move(x,y,xmax,ymax,k): # 控制移动 if x < int(xmax/3) : k.press_key("a") else : k.release_key("a") if x > i...
true
2900acbdf6c30904dacd818dc4e1b3a90dba5f0d
Shivanshu17/DS-Algo
/SALARY.py
UTF-8
394
2.828125
3
[]
no_license
t = int(input("Enter the number of test cases ")) n = [] e = [] for i in range(t): n = n+[(input())] for j in range(len(n)): n[j] = int(n[j]) k = list(input().split(" ")) for j in range(len(k)): k[j] = int(k[j]) e = e+[k] for i in range(t): w = e[i] w.sort() s = 0 ...
true
2912b5ec032382967e5ee563559383daefa9c0b8
emontecinos/simulacion_capstone
/conec.py
UTF-8
242
3.40625
3
[]
no_license
for x in range(9,12): for y in range(7,14): print(f"{x};{y}") # if y == 1 or y == 7 or y == 13: # print(f"{x};{y-1}-{x};{y+1}-{x-1};{y}-{x+1};{y}") # else: # print(f"{x};{y-1}-{x};{y+1}")
true
01df17c438e14524b51f4bb566a7aa5dd828e3a7
abugler/NylonRNN
/src/train_rnn.py
UTF-8
4,919
2.546875
3
[]
no_license
import numpy as np import torch.nn as nn import torch from encoding import encoding_to_LSTM, find_beat_matrix import matplotlib.pyplot as plt from nylon_rnn import NylonRNN import os import time absolute_path = "C:\\Users\\Andreas Bugler\\Documents\\NylonRNN_BCE\\" model_path = "models\\" npdata_filepath = ...
true
d80015efa3802d319990d99c64e4f955f7544f2a
forager-research/foragerpy
/foragerpy/utils.py
UTF-8
625
2.734375
3
[]
no_license
import os.path from PIL import Image RESIZE_MAX_HEIGHT = 200 def parse_gcs_path(path): assert path.startswith("gs://") path = path[len("gs://") :] bucket_end = path.find("/") bucket = path[:bucket_end] relative_path = path[bucket_end:].strip("/") return bucket, relative_path def make_ident...
true
02d9455c5c86995e2be574e8d7372e42660f33cc
Dimdriller/Python
/HW_3.py
UTF-8
8,015
4.15625
4
[]
no_license
# Python HW 3 if else elif # # 1. Создать переменную int_item со значением 10 int_item = 10 # 2. Создать переменную comp_item со значением 18 comp_item = 18 # 3. Создать переменную mult_int в которй умножите int_item на 2 mult_int = int_item * 2 # 4. Создать переменную item_2 со значением True item_2 = True # 5. Со...
true
42b5cc6d8600f0cad226f11ab063f7098771218e
brianoflondon/hivetools
/hivetools/africanized_bee.py
UTF-8
1,862
2.71875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import getpass from datetime import datetime, timedelta from pprint import pprint from beem import Steem from beem.account import Account from beem.wallet import Wallet def kill_the_power(): # Get all availble VESTS to powerdown right now and make it into a string that the withdraw can han...
true
5e367fa7b4d697f947bfe61f2bb57e394fce12e0
alu0100814231/prct13
/docs/prct13.py~
UTF-8
2,326
3.484375
3
[]
no_license
#!/usr/bin/python #!ecoding: UTF-8 import matplotlib.pyplot as plt import math import time import moduloP8 import moduloerror #Declaramos las variables Y=[] x= [10,50,100,150,500,550,1000] aprox = 100 for i in range (7): start=time.time() moduloerror.error(x[i], aprox, 1e-6) finish=time.time() - start ...
true
77e5fb13144a73f43b00b5cc9f420aa676312484
CremaLuca/Longest-Common-Subsequence
/tester.py
UTF-8
1,834
3.453125
3
[]
no_license
import random import subprocess import string intro = "The following script will test the LCS programs using:\n" \ "* {} tests\n" \ "* {} as the range of the size for all strings compared\n"\ "* {} letters from the latin alphabet\n"\ "* {} processors for the parallel algorithm\n" strings = [] ran = (5...
true
5547806f8ac9b141e51a6556ea6c229b4d122d5a
dengyings/biji
/AID/hier_agglo.py
UTF-8
1,893
2.8125
3
[]
no_license
import os import sys import platform import numpy as np import sklearn.cluster as sc import matplotlib.pyplot as mp def read_data(filename): x = [] with open(filename, 'r') as f: for line in f.readlines(): data = [float(substr) for substr in line.split(',')] x.appe...
true
5c610d82ffae1c5a53f03b08090d4ea4ac0984a1
durva04/durvatest
/hello.py
UTF-8
105
2.78125
3
[]
no_license
from tkinter import* top =Tk() top.geometry("200x100") b=Button(top,text="hello") b.pack() top.mainloop()
true
4276ba75b43a1f32011c2e2ea287af08667b3c94
SridharGithub17/PythonCodes
/OutputFormating.py
UTF-8
608
3.703125
4
[]
no_license
#!/usr/bin/evn python ## Output formating examples import math print(f'Area of a squre is : {math.pi: .3f}') table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 7678} for name,id in table.items(): print (f'{name:10} ==> {id:10d}') print('We are the {0} and {1} of this ear'.format('man', 'woman')) print('We are th...
true
212e57c80749c746c621cc24b904e2eeb0889701
sevenhe716/LeetCode
/String/q604_design_compressed_string_iterator.py
UTF-8
4,071
3.71875
4
[]
no_license
# Time: O(n) # Space: O(1) # 解题思路: # 如何高效的切分字符串,如果用yield构造generator不能同时支持next hasNext两个api # 切分方法可以用正则表达式,或者两次split,或者自己遍历完成 # 优化:可以不进行预处理和额外的空间存储,直接在原字符串上迭代,省去了预处理时间以及额外的空间开销 Demand-Computation vs. Pre-Computation import re class StringIterator: def __init__(self, compressedString: str): self.cs, char,...
true
5d2c77b45ed5975fcf39fd83d56f23b68cf74c99
JIC-CSB/dtoolai
/dtoolai/data.py
UTF-8
6,548
2.828125
3
[ "MIT" ]
permissive
import logging import torch.utils.data import dtoolcore import numpy as np from PIL import Image class WrappedDataSet(torch.utils.data.Dataset): """Subclass of pytorch Dataset that provides dtool DataSet methods. This class mostly provides methods that consumers of DataSets require, and passes those m...
true
1fb56acad2040a717adc3e959e75de4beb919698
bpjsincl/marchmadness
/Report/ann.py
UTF-8
1,396
2.75
3
[]
no_license
ef build_nn(NN_input, numNeurons): DS= SupervisedDataSet(len(NN_input[1][:len(NN_input[1])-1]), 2) for i,matchup in enumerate(NN_input): DS.addSample(matchup[:len(matchup)-1], [matchup[len(matchup)-1], 1-abs(matchup[len(matchup)-1])]) tstdata, trndata = DS.splitWithProportion(0.3) print "Number of training patt...
true
425cb365e5bc64d383b4361f9fde9835f2bc90b7
pierreoberholzer/anomaly_detection
/user_template/amld_functions.py
UTF-8
1,401
2.671875
3
[]
no_license
import pandas as pd from io import StringIO from azure.storage.blob import BlockBlobService import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt import seaborn as sns from sklearn.metrics import (confusion_matrix, precision_score, recall_score) def plot_confmat(y_true, y_pred, save=True): label...
true
dc694acab622bf0d49f7dfb7408dc56b30687bcb
kellyli02111/Leetcode-1
/lc002.py
UTF-8
877
3.375
3
[]
no_license
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ carry...
true
27634a9744a17ab70220d01a328ffe6cef92d695
solomc1/python
/ics 33/workspace/program5/blackhole.py
UTF-8
991
3.296875
3
[]
no_license
# Solomon Chan, Lab 6) # I certify that I written all the code in this programming assignment # by myself. # A Black_Hole is a Simulton; it updates by removing # any Prey whose center is contained within its radius # (returning a set of all eaten simultons), and # displays as a black circle with a radius ...
true
75f9a1d02a87795fe8a017d7f5cd8a3ba9ca83ef
danish45007/Code-Algo-DS
/Dynamic Prog/coin_change_problem.py
UTF-8
489
3
3
[]
no_license
def coin(arr,n,sum): k = [[0 for x in range(sum+1)] for x in range(n+1)] # Init matrix for i in range(n+1): k[i][0] = 1 for i in range(1,n+1): for j in range(1,sum+1): if arr[i-1] <= j: k[i][j] = ((k[i-1][j]) + k[i][j-arr[i-1]]) else: ...
true
47bea48fd08ba775d6fc7fbb91b2204ea86f7b4d
Jap-Leen/Exun-19-WWCD-Day-1
/Palindrome.py
UTF-8
262
4.0625
4
[]
no_license
# Given a number n, check whether it is a palindrome or not. n=input("enter a number: ") l1=list(n) l2=[] for i in range(len(l1)-1,-1,-1): l2.append(l1[i]) if(l2==l1): print("the number is a palindrome") else: print("the number is not a palindrome")
true
3e5ca1bf108d51afc406d49b8dea97d9a6a1928b
LivMadrid/Rock-Paper-Scissors-Shoot
/RockPaperScissors.py
UTF-8
3,056
4.15625
4
[]
no_license
import random from enum import IntEnum class Choice(IntEnum): rock = 0 paper = 1 scissors = 2 def get_player_choice(): #possible_choices = ['rock'[0], 'paper'[1], 'scissors'[2]] # computer_choice = random.choice(possible_choices) # print(f'You chose {player_choice}. The computer chose...
true
093a9cd8bf83ffeeb47260d88a98b40cdd7de7ee
alpharol/algorithm_python3
/leetcode/0501-0600/0581.最短连续子数组.py
UTF-8
1,139
4.1875
4
[]
no_license
#https://leetcode-cn.com/problems/shortest-unsorted-continuous-subarray/ """ 给定一个整数数组,你需要寻找一个连续的子数组,如果对这个子数组进行升序排序,那么整个数组都会变为升序排序。 你找到的子数组应是最短的,请输出它的长度。 示例 1:输入: [2, 6, 4, 8, 10, 9, 15];输出: 5 解释: 你只需要对 [6, 4, 8, 10, 9] 进行升序排序,那么整个表都会变为升序排序。 """ class Solution: def findUnsortedSubarray(self, nums: list...
true
33ef28e06917e341e765bd3b3cb6b3a612503f62
aroller/steady-health-code-challenge
/pages.py
UTF-8
1,371
3.71875
4
[ "MIT" ]
permissive
import os from typing import List class Pages: """Knows about all of the pages participating in the wiki. """ def __init__(self, path_to_pages: str): self._path_to_pages = path_to_pages """The path to the folder containing the pages.""" def word_matches_a_page(self, word: str) -> boo...
true
875d5df26731723742ee25fa0c007e6bd3f59498
alexmateescu/nagios-api
/nagios/core.py
UTF-8
10,326
3.109375
3
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
#!/usr/bin/python # # core Nagios classes. # class Nagios: '''This class represents the current state of a Nagios installation, as read from the status file that Nagios maintains. ''' def __init__(self, statusfile=None): '''Create a new Nagios state store. One argument, statusfile, is used to...
true
59b71c732c2e05c4727241abab41b3b363b43a4e
poduszeczka3/JSP2019
/lista3/zad7l3.py
UTF-8
263
4.03125
4
[]
no_license
print("Wpisz liczbę wyrazów ciągu Fibonacciego, które chcesz zobaczyć") n = int(input()) print() def Fibonacci(n): if n==1: return 1 elif n==2: return 1 else: return Fibonacci(n-1)+Fibonacci(n-2) for i in range(1,n+1): print(Fibonacci(i))
true
722a8a304e759769185741d94beadbf1b5dbc5fb
THREDgroup/HeuristicBursts
/tests/truss_tests/Main Truss Tests/quality_over_iterations_analysis.py
UTF-8
8,334
2.828125
3
[ "MIT" ]
permissive
import csv import numpy import matplotlib import matplotlib.pyplot as plt from scipy import stats num_iter = 500 num_reps = 100 max_fos = 50.0 file_a = 'lower_tier_only_500_iterations.csv' file_b = 'higher_tier_only_500_iterations.csv' file_c = 'both_tiers_500_iterations.csv' file_d = 'probabilistic_selection_test_5...
true
1fac172eeedff71e7da4d5415cef7a54ee5b0b77
rogier-stegeman/benign-filter
/send_curl.py
UTF-8
780
2.53125
3
[]
no_license
import requests import sys def main(): """Send a cURL request to the API""" url = "http://localhost:8080" payload = f"{{\n\t\"filename\": \"{sys.argv[1]}\",\n\t\"chr\": \"{sys.argv[2]}\"\n}}" headers = { 'Content-Type': "application/json", 'User-Agent': "PostmanRuntime/7.13.0", ...
true
d2782516719ed80e544f5c0f250f04a77ab45284
isrt09/Data-Analysis-with-Pandas-and-NumPy
/numPy.py
UTF-8
1,468
3.1875
3
[]
no_license
import numpy as np # Array Create list = [2,5,7,8] np.array(list) np.array([list,list]) np.array([[1,2,3],[5,6,7]]) np.array([[3,4,5],[1,2,4],[5,4,3]]) np.eye(4) np.zeros(4) np.ones(4) np.identity(4) np.zeros(shape=(3,4)) np.ones(shape=(3,4)) np.arange(10) np.arange(2,40,2) np.arange(100,0,-2) np.linspace(0,20,2) np.r...
true
3e4dd2403d55808201f9ca32be52455e694641e8
nbajason/ds
/db/datastore.py
UTF-8
2,203
3.03125
3
[]
no_license
#!/usr/bin/env python from db.commit import Commit class DataStore: def __init__(self): self.commits = [] self.data = {} self.value_counts = {} def get(self, key): return self.data[key] def set(self, key, value, logging=True): has_key = self.has_key(key) ...
true
c151c83a46a5fda0f67f346a405589a78bdf08e4
bansal1232/COOK86
/LIKECS03/Solutions/sol.py
UTF-8
242
2.765625
3
[]
no_license
# O(n logn) t = int(input()) for _ in range(t): [n, k] = list(map(int, input().split())) arr = list(map(int, input().split())) mark = dict() for x in arr: if (x > 0 and (x & (x-1)) == 0): mark[x] = 1 ans = k - len(mark) print(ans)
true
c6365688154d15f0dbc73717c0dd4e32c11bc08c
andrewreisner/pyclid
/pyclid/types.py
UTF-8
418
2.578125
3
[]
no_license
import numpy as np class LinearOperator: def __init__(self, shape, matvec, rmatvec=None, dtype=np.float64): self.shape = tuple(shape) self.matvec = matvec if rmatvec is not None: self.rmatvec = rmatvec else: def rmatvec(v): raise NotImplemen...
true
a8aa192924da2d2739cefd1eedb5a64dfa70752d
fagan2888/network_programming_python_examples
/tcp_client.py
UTF-8
282
2.578125
3
[]
no_license
import socket import sys target_host = sys.argv[1] target_port = int(sys.argv[2]) client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) client.connect((target_host, target_port)) message = raw_input("MSG:") client.send(message) response = client.recv(4096) print response
true
45eed7a8760ca0c0726d6c826a3fad81cf41a516
David-Bauman/congressional-twitter-covid-19-relief
/analysis/dwnominate_quantity.py
UTF-8
905
2.703125
3
[]
no_license
import datetime import matplotlib.pyplot as plt import numpy as numpy from secret import cur, conn from sklearn.linear_model import LinearRegression cur.execute("SELECT user_id FROM tweets;") user_id_to_num_tweets = {} for (uid,) in cur: if uid not in user_id_to_num_tweets: user_id_to_num_tweets[uid] = 0 ...
true
387dd3eae403adc59964a5947323339843faa332
jfleong/aoc2020
/aoc/05/main.py
UTF-8
3,097
3.09375
3
[]
no_license
import math import sys import logging from lib.helpers import read_file logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) log = logging.getLogger(__name__) class BoardingPass(object): def __init__(self, boarding_pass_string): # 128 rows self.row_string = boarding_pass_string[:7] ...
true
6c188721213f91ceee9ea31469a39b14bff111c3
AkshayRaul/Rise2Code_PackHackers
/test.py
UTF-8
3,088
3.09375
3
[ "MIT" ]
permissive
# coding: utf-8 # In[1]: from google_search import getDocuments import numpy as np # Loading the data set - training data. train_data, train_target = getDocuments(0,10) # In[4]: # You can check the target names (categories) and some data files by following commands. # train_target=np.array([1,0,0,1,1,1,1,1,1,1]) ...
true
969f551027911c6e00fcfe3eab9c107583197fb0
jrobinson-vs/fiftyone
/fiftyone/migrations/revisions/v0_11_2.py
UTF-8
1,429
2.53125
3
[ "Apache-2.0" ]
permissive
""" FiftyOne v0.11.2 revision. | Copyright 2017-2021, Voxel51, Inc. | `voxel51.com <https://voxel51.com/>`_ | """ import logging logger = logging.getLogger(__name__) def up(db, dataset_name): pass def down(db, dataset_name): match_d = {"name": dataset_name} dataset_dict = db.datasets.find_one(match_d...
true
9105a6e91dfb171940366dc4398dfc95eb113b9c
NandaGopal56/Programming
/PROGRAMMING/python practice/character position alteration check.py
UTF-8
240
3.453125
3
[]
no_license
#checking how many chacters of a string doesnot change position when string is altered str="alphxxdida" rev=str[::-1] print(rev) counter=0 for i in range(len(str)): if str[i] == rev[i]: counter+=1 print(counter)
true
58b28075e4ca243fd58fd4b2fbdb38d2d40af367
Salamander1710/breakout_game
/main.py
UTF-8
2,515
3.09375
3
[]
no_license
from turtle import Turtle, mainloop, listen, onkeypress, tracer, Vec2D, bgcolor from random import choice, randint from player import Player from ball import Ball from scoreboard import ScoreBoard class Target(Turtle): colors = ['green', 'orange', 'yellow', 'pink', 'purple', 'gold', 'gray', 'brown', 'whit...
true
429e32e150d523e99b5f9b8eed30f48c1a074ff5
DUanalytics/pyAnalytics
/10-daily/modeling_mtcars.py
UTF-8
4,138
3.015625
3
[]
no_license
#Topic:Py All Models : last exercise for Workshop #----------------------------- #libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt pip install pydataset #installing a library from pydataset import data #Data mtcars = data('mtcars') mtcars.head() df = mtcars df.head() #%%% #Linear Regres...
true
e7d9794463ac0d7e43129cfe50d7bc6b4c9b39cb
lwang114/speech2image
/sp2im_meaning/models/TextEncoders.py
UTF-8
1,694
2.515625
3
[]
no_license
# Adapted from https://github.com/dharwath/DAVEnet-pytorch import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import torchvision.models as imagemodels import torchvision.transforms as transforms import librosa import numpy as np DEBUG = False # TODO: allow context in...
true
02cc0f0feef9e120da97fae502a60d1e3aadedd2
VolodkoUra/Lesson.10
/Ls_10_1.py
UTF-8
1,099
2.84375
3
[]
no_license
import json import requests class MyFirsrPost: import requests id: 0 petId: 0 quantity: 0 shipDate: str status: str complete: bool def __init__(self, **kwargs): for k, v in kwargs.items(): self.__setattr__(k,v) def post_to_url(self, url): #self.__getatt...
true
e31b66bb00c456db22618b380c717531ec57aaf2
PanggNOTlovebean/1119showmaker
/三维时空 直接.py
UTF-8
3,319
3.53125
4
[]
no_license
""" ============ 3D animation ============ A simple example of an animated plot... In 3D! """ import numpy as np import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as p3 import matplotlib.animation as animation import pandas as pd def Gen_RandLine(length, dims=2): """ Create a line using a ran...
true
1814fe903d9ccc636e2e140adbe965bc5943eeb2
skorohodovn/sda
/venv/python fundamentals/05-string-formatting-and-printing/f formatting.py
UTF-8
77
3.53125
4
[]
no_license
a = 14 b = 3 print(f'{a} times {b} raised to power of 2 is {(a * b) =* 2}.')
true
4cdf0d564a544ec75adb80bad03136a5a93b716f
sophialjm/jsoncontrast
/jsoncontrast/Contrast_Json.py
UTF-8
3,012
2.890625
3
[ "MIT" ]
permissive
#!/usr/bin/env python #-*- coding:utf-8 -*- import sys,re def meta_string_compare(src_data, dst_data,model): if model=='strict'and dst_data == src_data: return True elif model=='contains'and dst_data in src_data: return True elif model=='start'and src_data.startswith(dst_data): retur...
true
23573e7b31b927814cdce539af7356eb400e5658
GuiFSs/handwritten_digits_site
/app.py
UTF-8
1,476
2.53125
3
[]
no_license
from flask import Flask, render_template, jsonify, request app = Flask(__name__) from PIL import Image import os import base64 import cv2 import numpy as np import os import tensorflow as tf import keras from keras.models import load_model global graph, model graph = tf.get_default_graph() model = load_model('te...
true
be59d9d555bbeff0f823b219f66646139ef15daf
kumbharswativ/Core2Web
/Python/DailyFlash/17jan2020/MySolutions/program5.py
UTF-8
182
3.984375
4
[]
no_license
''' Q. write a program to ASCII values of input character. input : A output: ASCII value of A is 65 ''' ch=str(input("Enter a character :")) print("ASCII value of",ch,"is",ord(ch))
true
1997453592f503949f515bb17bd034d24ce13626
xiaozhi5448/python-linux
/web/flask_learn/project2/run.py
UTF-8
401
2.703125
3
[]
no_license
from flask import Flask app = Flask(__name__) app.debug=True @app.route('/') @app.route('/index/') def index(): return 'Index Page' @app.route('/hello/') def hello(): return 'hello world' @app.route('/user/<username>/') def echo_user(username): return 'User is {}'.format(username) @app.route('/score/...
true
474656da650a0a764007abfedf89004ac8d9fea6
ZakHu7/LeetCode
/1-99/Q29.py
UTF-8
1,022
3.140625
3
[]
no_license
class Solution: def divide(self, dividend: int, divisor: int) -> int: if dividend == 0: return 0 neg = 1 if dividend < 0: dividend *= -1 neg *= -1 if divisor < 0: divisor *= -1 neg *= -1 res, _ = self.divideH(dividend, divisor, 1, neg) return res * neg ...
true
c58a75979ecbe90167ec4999a45a66304f234708
X-dark/plugin.makemkvbluray
/resources/lib/mkvparser.py
UTF-8
1,824
2.765625
3
[]
no_license
import urllib, re, elementtree.ElementTree as ET class BrowseHandler: def __init__(self) : self.catchCharData = False self.keyColumn = False self.map = {} self.lastKey = '' self.lastVal = '' self.titleMap = {} def start(self, url, title = 'none'): # Init...
true
1afb81ec1f3bb36f82be5db7896c29c540729b77
hopper-project/hopper-tools
/eXtract.py
UTF-8
8,036
2.546875
3
[]
no_license
# decompose LaTeX file into equations and text # (assumes file has been demacro'd) import re, argparse import ntpath, os.path import glob import multiprocessing from itertools import repeat def match_start(start): if re.search(r'begin', start): return re.sub(r'begin', 'end', start) elif start == r'\\[...
true
1e539f186d129f4b05211e5652363da3d461ef11
JesseBuesking/dht22_controller
/run_tests.py
UTF-8
2,341
2.65625
3
[]
no_license
import sys import unittest from tests import basic from tests import temperature from tests import humidity from tests.custom_text_test_runner import CustomTextTestRunner def load(testcase): return unittest.TestLoader().loadTestsFromTestCase(testcase) def filter_tests(test_or_suite, test_cases_or_names, include...
true
ab0f3e06adb5a9e3c098babff8d2a5856a2ac01d
quantum-soul/RivaGAN
/rivagan/attention.py
UTF-8
2,900
2.71875
3
[ "MIT" ]
permissive
import torch from torch import nn from torch.nn import functional def multiplicative(x, data): """ This function takes a 5d tensor (with the same shape and dimension order as the input to Conv3d) and a 2d data tensor. For each element in the batch, the data vector is combined with the first D dimensio...
true
fc91657715e766aec6adce0a0f29e94beaceb7b2
k-cheon/Exercise
/list_study.py
UTF-8
1,108
3.21875
3
[]
no_license
bicycles = ['trek', 'cannondale', 'redline', 'specialized'] print(bicycles) print(bicycles[0]) print(bicycles[0].title()) print(bicycles[1]) print(bicycles[2]) print(bicycles[-1]) message = "My first bicycle was a " + bicycles[1].title() + "." print(message) names = ['Korea', 'America', 'Japan', 'England'] print(name...
true
baff9a1a61985943b98ac3b20bbc433584990e13
lwinfree/automate_the_boring_stuff
/bulletPointAdder.py
UTF-8
568
3.34375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jun 11 14:11:39 2016 @author: lillywinfree """ #! usr/bin/env python3 # bulletPointAdder.py #add * at beginning of each line of a list, then paste to clipboard import pyperclip text=pyperclip.paste() #separate lines and add stars lines=text.split('\n') for i in range(len(l...
true
3ff69d5ff1a92a1fcedff120d464384e92a164e6
ToshikiShimizu/AtCoder
/JOI/2008yo/d.py
UTF-8
575
2.96875
3
[]
no_license
SM = [] SN = [] M = int(input()) # 探したい星座 for m in range(M): x, y = map(int,input().split()) SM.append((x,y)) N = int(input()) # 星空の写真 for n in range(N): x, y = map(int,input().split()) SN.append((x,y)) st = set(SN) # inが高速 base = SM[0] # 探したい星座のうち基準となる星を設定 for sn in SN: dx, dy = sn[0]-base[0], sn[...
true
ab4ae7396b3f86bed13dbf2772c68a38195b143e
kotwica407/firstNeuralNetwork
/plotting/OTWpolarcoordinates.py
UTF-8
1,566
2.84375
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter fig = plt.figure() ax = fig.gca(projection='3d') theta = np.zeros(shape=16000, dtype='float') r = np.zeros(shape=16000, dtype='float') dt...
true
07763931a2a8ba5959371f530e3883a0cc5f3a52
chahinMalek/cg-framework
/triangulations/tree.py
UTF-8
3,604
4.1875
4
[]
no_license
""" Contains node and tree classes, created as a data structure for functions of triangulate.py. Can be used as a standalone. """ from typing import List, Deque from collections import deque class Node: def __init__(self, data) -> None: """ Creates node object. Initializes its children to empty ...
true