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
8b933a860e000fe6316b721affe8e12297cee885
jingxinmingzhi/jingxinmingzhi
/python/pycharm/learn/线程和进程/class/mypy16.py
UTF-8
136
2.765625
3
[]
no_license
#析构方法 class person: def __del__(self): print('清除{0}'.format(self)) p1=person() p2=person() print('程序结束')
true
b33427f43c546852ee487d3bf36a48e95ae7b46e
jonathancox1/Python106
/oop_basics.py
UTF-8
1,963
3.96875
4
[]
no_license
# # # # #Basic Object Oriented Programing #Notes #how to create a class class Hotel(): pass #create instances of the class bates_motel = Hotel() grand_budapest = Hotel() #create unique instance of the class class Hotel(): #Constructor #can contain default properties, must come after required properties ...
true
f5d55667519c108bfc9951bb9103c5a619210540
itinawi/6.853-Final-Project
/testing.py
UTF-8
455
3.375
3
[]
no_license
# playing with the data to see how many users are there. f = open("user_ids.txt", "r") text = f.read() ids = text.split("\n") user_dict = {} for user_id in ids: if user_id in user_dict: user_dict[user_id] += 1 else: user_dict[user_id] = 1 print len(user_dict) import operator sorted_dict = sorted(user_dict....
true
0a7a76b3572ef223f8353b815054f846225d96b8
matplotlib/matplotlib.github.com
/3.5.0/_downloads/f3eab81c1f29bec924d1fb4a0f5519d5/font_file.py
UTF-8
1,213
2.90625
3
[]
no_license
r""" =================================== Using a ttf font file in Matplotlib =================================== Although it is usually not a good idea to explicitly point to a single ttf file for a font instance, you can do so by passing a `pathlib.Path` instance as the *font* parameter. Note that passing paths as `...
true
d6dd9036b87fa430c4381e3ff972b10edf919e8d
ellablac/HackerRank
/ConsSubSeq/ConsSubseq.py
UTF-8
2,109
3.203125
3
[]
no_license
def solve (count, seq): n = count[0] k = count[1] #print ("solve: ", (seq), "\n") #for i in range(n): #seq[i] = seq[i]%k #print (seq) # Store the end index of a base subsequence that starts with i. # BaseArray = [0] * n for i in range(n): cnt = 0 for...
true
38e70fbf83a845c3d6841dc09c2efeba00e0fdc9
prateeknepaliya09/Intro_to_udacity_machine_learning
/naive_bayes/nb_author_id.py
UTF-8
1,414
3.40625
3
[]
no_license
#!/usr/bin/python """ This is the code to accompany the Lesson 1 (Naive Bayes) mini-project. Use a Naive Bayes Classifier to identify emails by their authors authors and labels: Sara has label 0 Chris has label 1 """ import sys from time import time sys.path.append("../tools/") from em...
true
4cf225c5680071ff6d67946d41069f5bd33711ad
conor1993/pythonDocs
/practicas/metodos listas/main.py
UTF-8
507
2.734375
3
[]
no_license
import listas #agrega un elemnto al final de la list #listas.agrear_elemnto() #agrega un elemnto en la posicion k le indiquemos #listas.agregar_pos() #agregar una lista ale final de la primera lista #listas.agregarLista() #extrae un elemnto y lo mete a una variable #listas.extraer() #remuebe el valor #listas.remob...
true
5ea763dec45dec946ad8263334cad55180a72296
bumsol2/python
/Chapter6/도전0819.py
UTF-8
681
4.125
4
[]
no_license
#로또번호 6개 생성 # 로또 번호 1~45까지 랜덤번호 # 6개 숫자 다 달라야된다. #1. 반복문, 조건문 # 2. 리스트 # 3.함수 import random def getRandomNumber(): number = random.randint(1,45) return number lotto_num = [] # 로또 번호 저장할 리스트 count = 0 #현재 뽑은 숫자의 갯수 while True: # 숫자 6개 if count > 5: break random_number = getRandomNumber() #r...
true
93487f0fdb596c1e9f96c44472ce70a25730d949
Jebaseelanravi/Webiste_category_classifier
/Testing/Testing for accuracy/Test_for_classifer.py
UTF-8
6,199
2.59375
3
[]
no_license
import nltk from nltk.stem.lancaster import LancasterStemmer import numpy as np import tflearn, re import tensorflow as tf import random import json import string import unicodedata import sys import requests from bs4 import BeautifulSoup # predicted_domain={} def classifier(url): global words ...
true
42d7599f121fb793b71eea59278172f95d7aaf89
valerpenko/jakob
/School/sort/imergen.py
UTF-8
207
3.015625
3
[]
no_license
l1=[1,3,5,8,10] l2=[2,6,9,11,15] l=[] while len(l1)>0 and len(l2)>0: if l1[0]<l2[0]: l.append(l1.pop(0)) else: l.append(l2.pop(0)) if len(l1)==0: l=l+l2 else: l=l+l1 print(l)
true
8ba916e3c25c7605ff592477fe5912d5e1f05b52
GoodStuff11/Cura-Tools
/CuraProfileModification.py
UTF-8
11,646
2.640625
3
[]
no_license
import tkinter as tk from tkinter import ttk import os import pathlib class Window(tk.Frame): i = 0 VARIABLES = [] def __init__(self, master): # making use of the tk.Frame object tk.Frame.__init__(self, master) master.title("Cura Profile Modifier") # get ad...
true
3e0c99dd721976cc9325ca5d4432596b0589919a
HBlack09/ICTPRG-Python
/Examples/student.py
UTF-8
116
2.828125
3
[]
no_license
f = open("students.txt", "a") f.write('Phillip Locke\nDavid Beckett\nEdmund Burke\n') f.close() print(open("students.txt", "r").read())
true
a26b6ddad7e4ddf89c6582c73e94a606c780b3a7
rogersjeffreyl/SET_Project
/classification/main.py
UTF-8
12,956
2.8125
3
[]
no_license
import xml.etree.ElementTree as ET import os import nltk import cPickle as pickle ''' enumerate penntreebank tags ''' PennTreebankTags = ('CC', 'CD', 'DT', 'EX', 'FW', 'IN', 'JJ', 'JJR', 'JJS', 'LS', 'MD', 'NN', 'NNS', 'NNP', 'NNPS',\ 'PDT', 'POS', 'PRP', 'PRP$', 'RB', 'RBR', 'RBS', 'RP', 'SYM', 'TO', 'UH', 'VB', 'V...
true
5871ae29534fefc004b11940a6f1c843140f4ebf
systems-cs-pub-ro/uso-lab
/lectures/auto/demo/grades/stats.py
UTF-8
2,658
3.4375
3
[]
no_license
#!/usr/bin/env python import sys import os import csv import unicodedata class Group: def __init__(self, name): self.name = name self.final = 0 self.quiz = 0 self.practical = 0 self.midterm = 0 self.asgn = 0 self.num = 0 def add(self, final_grade, quiz...
true
92f069c81e103117e41fe1dab63c035961b768d8
stronger-jian/test_mysql_mongo_redis
/redis/test_redis_set.py
UTF-8
681
2.765625
3
[]
no_license
import redis class TestSet(object): def __init__(self): self.r=redis.StrictRedis(host='localhost', port=6379, db=0) def t_sadd(self): l=['cat','tiger'] rest=self.r.sadd('zoo10',*l) print(rest) rest=self.r.smembers(rest) print(rest) def t_sre...
true
58852be99ea8f8c4afeb70aa267ba1e58e1f3751
renjieliu/leetcode
/0001_0599/5.py
UTF-8
3,912
3.640625
4
[]
no_license
class Solution: def longestPalindrome(self, s: str) -> str: # O( N**2 | 1 ). 2 pointers, expanding from central character start = 0 maxLength = 1 for i in range(len(s)): # take "bbaaaabb" for example r = i+1 while r < len(s) and s[r] == s[i]: # for the first a in t...
true
7637f69d998031866b208465e75e9786525c7494
Jashwanth-k/Data-Structures-and-Algorithms
/9. Generic Trees/main.py
UTF-8
1,666
3.59375
4
[]
no_license
import queue q = queue.Queue() class TreeNode: def __init__(self,data): self.data = data self.children = list() def printTreeLevelWise(root): if root is None: return q.put(root) q.put(None) while not q.empty(): currNode = q.get() if q.em...
true
6076b10e6f6aea23eb47cc5a43ef99215e439e7f
dotKrad/blueprint
/custom_components/integration_blueprint/api.py
UTF-8
2,815
2.53125
3
[ "MIT" ]
permissive
"""Sample API Client.""" from __future__ import annotations import asyncio import socket import aiohttp import async_timeout class IntegrationBlueprintApiClientError(Exception): """Exception to indicate a general API error.""" class IntegrationBlueprintApiClientCommunicationError( IntegrationBlueprintApiC...
true
5579dfc25a06a8473fdb241bd9b8939319c13176
ZeallsFix/MandelbrotServer
/main.py
UTF-8
1,164
2.625
3
[]
no_license
from flask import Flask, render_template from flask import request import json from Calculation import Mandelbrot from flask_socketio import SocketIO, emit app = Flask(__name__) app.config['SECRET_KEY'] = 'passwort123' socket_io = SocketIO(app) @app.route('/') def response(): data = request.get_json(force=True) ...
true
6d8e6cbfea0bcfb10f57c9b5a1d05e59f030615d
KHilse/Flask-Practice
/app.py
UTF-8
511
2.859375
3
[]
no_license
from flask import Flask, render_template, request, jsonify import random # Declare app variable app = Flask(__name__) # Declare routes @app.route("/") def home_route(): return "Hello world" @app.route('/greeting') def greeting(user = 'Kirk'): return render_template('/index.html', user = user) @app.route('/p...
true
d329dda6e1ef2ceb90f86f39b5f14ffc02f3efc0
CristianVerdes/AI-Homework2
/source.py
UTF-8
5,113
3.65625
4
[]
no_license
import random class Node: def __init__(self): self.node = -1 self.neighbours = [] self.color = "" self.possibleColors = ["red" , "green", "blue"] def updateState(self, node, neighbours): self.node = node self.neighbours = neighbours #Setters def addRestr...
true
ede1a12dc80da398643b1950e51097b5d700fd8f
rtorresve/minesweeper
/api/snippets.py
UTF-8
2,038
3.109375
3
[]
no_license
import random import api.constants as c def count_hidden_cells(board): count = 0 for row in board: for cell in row: if cell == c.HIDDEN_CELL: count += 1 return count def init_array(cols, rows, value): return [[value] * cols for i in range(rows)] # noqa def i...
true
aacd7ea5547151f602d6d20a54b9a8b58e015da4
metno/met_moai
/met_moai/mmd/util.py
UTF-8
290
2.78125
3
[]
no_license
from datetime import datetime def parse_time(timestring): alternatives = ['%Y-%m-%dT%H:%M:%S.%fZ', '%Y-%m-%dT%H:%M:%SZ', '%Y-%m-%d'] for a in alternatives: try: return datetime.strptime(timestring, a) except: pass return datetime.now()
true
be5016941f2cade984692f5489f9432645c418ac
atshaman/SF_FPW
/C1/T1101/figures_wc.py
UTF-8
2,296
4.28125
4
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- """Описание классов геометрических фигур с возможностью задания координат в рамках учебного задания 1.10.1""" import math class Rectangle: def __init__(self, width, height, x=1, y=1): self.width, self.height = width, height self.x, self.y = x, y @prop...
true
c6babca150f9673418b60790a808eac1e7c0a214
connor9/advent-of-code
/2019/day6-v2.py
UTF-8
5,672
3.859375
4
[]
no_license
# --- Day 6: Universal Orbit Map --- # # You've landed at the Universal Orbit Map facility on Mercury. Because navigation in space often involves # transferring between orbits, the orbit maps here are useful for finding efficient routes between, for example, # you and Santa. You download a map of the local orbits (your...
true
98e6597412f21b9ad122c1a8349e647f7a1ffc3a
J-TKim/Effective_Python_2nd
/Ch7/Better_way53.py
UTF-8
2,129
3.71875
4
[]
no_license
# 계산양이 많은 작업의 예로 사용할 인수찾기 알고리즘이다. def factorize(number): for i in range(1, number + 1): if number % i == 0: yield i # 여러 수로 이뤄진 집합 내 모든 원소의 인수를 찾으려면 상당히 오래 걸린다. import time numbers = [2139079, 1214759, 1516637, 1852285] start = time.time() for number in numbers: list(factorize(number)) e...
true
c380ece17258fa22d9047b03fcbbd7e1830ef666
pwangsom/python_utilities
/analyze_specifiedinput/convert_extract_a5_to_csv.py
UTF-8
6,010
2.625
3
[]
no_license
import glob import csv import shutil import os ####################################################### def getWindowDirectory(): # pwangsom, Peerasak window_user = ['pwangsom', 'Peerasak'] window_dir = 'D:/Users/' + window_user[0] + '/Google Drive KMUTT/PhD Works' if(os.path.exists(window_dir) == Fa...
true
77be8cedf9866cc0f5dec195efb894bc4ee2dd1c
monnn/Programming101
/week0/palindrome.py
UTF-8
306
3.609375
4
[]
no_license
def is_int_palindrome(n): number = n reversed_number = 0 while n > 0: last_digit = n % 10 reversed_number = reversed_number * 10 + last_digit n = n // 10 if number == reversed_number: return True else: return False print(is_int_palindrome(2442))
true
00277dc943e0a9c4ee5d9a7415030625060a2a26
KariOrduz/Clase-Desarrollo-Software
/Ejercicios python/Figuras Geometricas/HerenciaPersonaUsuario.py
UTF-8
778
3.75
4
[]
no_license
class Persona: def __init__(self, nombre = "", edad = 0 ): self.nombre = nombre self.edad = edad def descripcion(self): return self.nombre + ", " + str(self.edad) class Usuario(Persona): def __init__(self,nombre, edad ,usuario = "", contraseña = ""): super().__init__(nombre...
true
ee1314a45922759c3e9c7374d9896cc3e2b51f91
leoandeol/pyrisk
/player.py
UTF-8
1,587
2.84375
3
[]
no_license
from copy import deepcopy class Player(object): def __init__(self, name, game, ai_class, ai_kwargs): self.name = name self.color = 0 self.ord = 32 self.ai = ai_class(self, game, game.world, **ai_kwargs) self.world = game.world @property def territories(self): ...
true
d308982e123363e313692e9fc3ba77b428f97cbd
immortal3/ML-Face-Assignment-Report
/Pre-Process.py
UTF-8
1,602
2.625
3
[]
no_license
#Importing necessary libraries import os from keras.preprocessing.image import load_img import numpy as np from keras.preprocessing import image import numpy as np import cv2 #Fetching the data files = os.listdir(os.getcwd() + '/data/') face_cascade = cv2.CascadeClassifier( os.getcwd() + '/haarcascade_...
true
23522ba08e05bb1ad420a39d82a9cc34afb156d9
cesarschool/cesar-school-fp-lista-de-exercicios-02-otaciliosiqueira
/questoes/questao_2.py
UTF-8
1,071
3.59375
4
[]
no_license
## QUESTÃO 2 ## # Uma forma de avaliar se uma pessoa está acima do peso é através do calculo do índice IMC. # Se o valor do IMC estiver acima de 25, significa que a pessoa está acima do peso. # A fórmula é: IMC = Peso(Kg) / (Altura(m)*Altura(m)). Com base na altura e peso fornecido no # console exiba uma mens...
true
57ca9f930a8dd9a0fb7b577f299d5f77c94ae7e0
jontwo/backpy
/backpy_tests/helpers_test.py
UTF-8
9,270
2.625
3
[]
no_license
# -*- coding: utf-8 -*- # StdLib Imports import os import unittest # Project Imports import backpy from . import common class HelpersTest(common.BackpyTest): @classmethod def setUpClass(cls): super(HelpersTest, cls).setUpClass() cls.test_config_dict = { 'default': [], ...
true
35f07711bb75415481f7f03ddfd59ea64d3de45f
ymm1030/RobAnWC
/CVHandler.py
UTF-8
3,412
2.65625
3
[]
no_license
import cv2 import subprocess import sys, os class CVHandler(object): def __init__(self): self.TOP = 100 self.BOTTOM = 130 self.BANNER = 135 self.CHECK_COLUMN = 1005 self.CONTACT_COLOR = [255, 255, 255] self.CONTACT_HEIGHT = 155 self.IGNORED_CONTACT = [] ...
true
0f06cf9b6ca1e1dd5a750b3b8e9cebbd28f35589
lukas-linhart/ssc-homework
/e2e-tests/test_placing_order.py
UTF-8
1,924
2.734375
3
[]
no_license
from selenium.webdriver import Chrome from pageobjects import App, Pages from helpers import poll_server # test data maybe_wanted_product = 'Tesla Model X' really_wanted_product = 'Tesla Model S' eventually_wanted_product = 'Tesla Roadster' initial_products = [maybe_wanted_product, really_wanted_product] final_product...
true
d425b889f65d4981619cead4c078cd7d2a707fd5
AkimF/avitoparser
/ui/lineeditbutton.pyw
UTF-8
1,163
2.53125
3
[]
no_license
#!/usr/bin/env python #-*- coding: UTF-8 -*- __author__ = 'helljump' import logging from PyQt4.QtGui import * from PyQt4.QtCore import * log = logging.getLogger(__name__) class LineEditButton(QWidget): clicked = pyqtSignal() def __init__(self, parent=None): QWidget.__init__(self, parent) ...
true
9804e74d13125fd93d98a13d5dffe40d766ba178
nivetha-ashokkumar/python-basics
/class camelcase.py
UTF-8
197
3.453125
3
[]
no_license
class CamelCase: def __init__(self, name): self.name = name self.some() def some(self): self.name = "ashokkumar" some = CamelCase("vijiyakumari") print(some.name)
true
e8fb73af083dcf01b781e541f43097eacab066db
feiyuerenhai/python-basics
/07-类.py
UTF-8
985
4.03125
4
[]
no_license
#!/usr/bin/python #coding=utf-8 #基本用法 class Person: #自身属性 species = 'human' #方法的第一个入参总是对象本身 def getSpecies(self): return self.species def setName(selfObj, name): selfObj.name = name def getName(selfObj): return selfObj.name #还可以使用lambda表达式 getName2=lambda self:self.name jack = Person() print jack.getS...
true
af3a68073305f5097d478b1cdaa2a61f615cfb49
great-expectations/great_expectations
/great_expectations/expectations/core/expect_column_pair_values_to_be_in_set.py
UTF-8
5,861
2.65625
3
[ "Apache-2.0" ]
permissive
from typing import Optional from great_expectations.core._docs_decorators import public_api from great_expectations.core.expectation_configuration import ( ExpectationConfiguration, ) from great_expectations.expectations.expectation import ( ColumnPairMapExpectation, InvalidExpectationConfigurationError, )...
true
f58305f8cc7a49c149d073c2cd7fd636b773b472
Shahid-s-Atrium/patella
/patella/htmlparser.py
UTF-8
13,807
2.875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- #!/usr/bin/env python """ This module has two important functions: htmlparser.find_download_links(): this function is used to scrape webpages for download links and html tables, allowing users to find and download items from a page. htmlparser.compare(): this...
true
4fd9a34dfdafdaaed12eb6079ce01765539f00df
mateusmarinho/afrodev2-python
/aula090421/Exercicio02.py
UTF-8
1,020
4.3125
4
[ "MIT" ]
permissive
'''Fazer um algoritmo de uma lâmpada de emergência. A partir de um sinal, indique se a luz está acesa ou apagada''' def is_int(valor): try: int(valor) except: return False return True if __name__ == '__main__': print('A lâmpada de emergência está apagada') sinal = 1 saida =...
true
bdc0192afbbfd8c4275ae8d4b2a9309b853cb1b5
SuryodayBasak/indictools-prep
/src/wordseg_inv1.py
UTF-8
1,540
2.6875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jul 10 15:22:33 2015 @author: suryo """ import cv2 import prep2 import numpy as np kernel1 = np.ones((2,2),np.uint8) kernel2 = np.ones((1,1),np.uint8) all_heights = [] img = cv2.imread('/home/suryo/Image_Processing_Exercises/indictools-prep/resources/book2/o8.jpg',0) cv2.i...
true
d87e0407bcd9770ff1a021b07ccb0ff8432fe8bf
iorodeo/mct
/mct_camera_tools/src/mct_camera_tools/camera1394_inspector.py
UTF-8
4,163
3.0625
3
[ "Apache-2.0" ]
permissive
import sys import pydc1394 class Camera1394Inspector(object): """ A tool for finding all 1394 cameras connected to the computer and getting information regarding the camera capabilities e.g., video modes, framerates, features, etc. """ def __init__(self): self.dc1394 = pydc1394.DC139...
true
2180735263fc81746aa535853c6e7b1e4133478a
gunjanmimo/NPTEL-The-Joy-of-Computing-using-Python
/week6_Assignment-1: Computing Paradox.py
UTF-8
166
3.28125
3
[ "MIT" ]
permissive
x=int(input()) list=[int(i) for i in input().split(" ")] sort=sorted(list) k = int(input()) pos=list[k-1] if pos in sort: ind=sort.index(pos)+1 print(ind,end='')
true
7fba0ceb31e7092b284545bda4c6a2585002a679
pedrotari7/advent_of_code
/js/2020/20.py
UTF-8
3,645
2.96875
3
[ "MIT" ]
permissive
import sys def rotate(tile): return list(''.join(x[::-1]) for x in zip(*tile)) def flip(tile): return list(reversed(tile.copy())) def build_tile_transformations(tile): tile90 = rotate(tile) tile180 = rotate(tile90) tile270 = rotate(tile180) return [tile, tile90, tile180, tile270, flip(tile...
true
e3c80f54458d9a5a4d3834d20ac75ce87f5e049c
MaZdan6/workspacePython-InzynieriaOprogramowania
/Python_lab/lab_09/zad1_T1.py
UTF-8
1,052
3.5
4
[]
no_license
from Python_lab.lab_09.zad1 import Bibltioteka '''' #input numberOfBooks=5; listOfBooks=[]; tuple0=("Chatka Puchatka" , "Alan A . Milne" , 2014 , (2014 , 4, 10)); tuple1=("Quo Vadis" , "Henryk Sienkiewicz" , 2010 , (2014 , 1 , 15)); tuple2=("Chatka Puchatka" , "Alan A . Milne" , 1998 , (2013 , 12 , 31)); tuple3=("Pan...
true
642ee2d300a3acc6a99bbeac271f5e38fc823ce3
mbshah/python_miniprojects
/motepad/motepad.py
UTF-8
2,532
2.90625
3
[ "MIT" ]
permissive
from tkinter.messagebox import * from tkinter.filedialog import * import os class Motepad: window = Tk() menu_bar = Menu(window) textarea = Text(window) height=800 width=400 my_txt_file="" def __init__(self, **kwargs): self.height=kwargs['ht'] self.width=kwargs['wd'] ...
true
5351c98465c589d32893e7a9c9821c7cb2ce0969
elenagarciamorato/TFMMovies
/functions.py
UTF-8
6,365
2.84375
3
[]
no_license
# TRABAJO DE FIN DE MÁSTER - TFMMovies # Elena Garcia-Morato Piñan # MASTER EN INGENIERÍA EN SISTEMAS DE DECISIÓN # UNIVERSIDAD REY JUAN CARLOS # CURSO 2020/2021 import os import dask.dataframe as dd import dask.array as da import numpy as np import seaborn from dask.diagnostics import ProgressBar from dask.array imp...
true
db72351c79a1071bc98a76dd970525d02f2385c5
cupid-bot/server
/cupid/discord.py
UTF-8
3,248
2.734375
3
[]
no_license
"""Tool for interacting with the Discord API for user authentication.""" import dataclasses from typing import Any import aiohttp from .config import CONFIG from .testing import TESTING AVATAR_URL = '{cdn}/avatars/{id}/{hash}.png' NO_AVATAR_URL = '{cdn}/avatars/embed/avatars/{discrim}.png' session: aiohttp.ClientS...
true
f72bee32b838e78a5d68c5ac25c403f7f459d6e1
insigh/Leetcode
/Array/Array Partition I.py
UTF-8
1,202
3.671875
4
[]
no_license
"""Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possible. Example 1: Input: [1,4,3,2] Output: 4 Explanation: n is 2, and the maximum sum of pairs is 4 = min(1, 2...
true
978c9e3e0da39eca71284730d9bf71c8415eb8ca
luizdefranca/Curso-Python-IgnoranciaZero
/Aulas Python/Exercícios Extras/Python Brasil/3 - Estrutura de Repetição/Ex 12.py
UTF-8
421
4.125
4
[]
no_license
""" Desenvolva um gerador de tabuada, capaz de gerar a tabuada de qualquer número inteiro entre 1 a 10. O usuário deve informar de qual numero ele deseja ver a tabuada. A saída deve ser conforme o exemplo abaixo: o Tabuada de 5: o 5 X 1 = 5 o 5 X 2 = 10 o ... o 5 X 10 = 50 """ num = int(input("Digite o numero a ser vis...
true
ab8c3afa4fcefc4efcebacdff2b3184e445c0e25
Aasthaengg/IBMdataset
/Python_codes/p02936/s367326160.py
UTF-8
780
2.71875
3
[]
no_license
def main(): import sys def input(): return sys.stdin.readline().rstrip() n, q = map(int, input().split()) adj = [[] for _ in range(n)] for _ in range(n-1): a, b = map(lambda x: int(x)-1, input().split()) adj[a].append(b) adj[b].append(a) ans = [0]*n for _ in range(q...
true
cee7a55454eeb80741331bbaa38af2ac8a7bb006
ackl/draftboard
/testsuite/test_models.py
UTF-8
3,818
2.765625
3
[]
no_license
from unittest import TestCase from application import client, db from application.models.Player import Player from application.models.Match import Match from application.models.MongoModel import MongoModel from application.models.Tournament import Tournament class ModelTestCase(TestCase): #def setUp(self): ...
true
d10004e3bf7e7d829e5f5fb2c0549fd77c715202
himsangseung/Python-Algorithm-Projects
/Graphs/Graph.py
UTF-8
11,049
3.796875
4
[]
no_license
''' PROJECT 8 - Graphs Name: Sang-Seung (Jay) Lee ''' import random import queue def Generate_edges(size, connectedness): """ DO NOT EDIT THIS FUNCTION Generates directed edges between vertices to form a DAG :return: A generator object that returns a tuple of the form (source ID, destinati...
true
15f62b8e8570fb4975b7e5f96486f3e7e00f8e0a
francisnguyen12/hocgitcoban
/Testing_Conflict.py
UTF-8
580
2.625
3
[]
no_license
from datetime import datetime import xlsxwriter # Create a workbook and add a worksheet. workbook = xlsxwriter.Workbook('Expenses03.xlsx') worksheet = workbook.add_worksheet() # Add a bold format to use to highlight cells. bold = workbook.add_format({'bold': 1}) 222222222222 # Add a number format for cells wi...
true
95a176b2153016e952f69fb67ff1f1ed547cf235
maitdaoud/DMWMAnalytics
/Popularity/DCAFPilot/src/python/VW/vw_grid.py
UTF-8
5,838
2.609375
3
[]
no_license
#!/usr/bin/env python #-*- coding: utf-8 -*- #pylint: disable= """ File : vw_grid.py Author : Valentin Kuznetsov <vkuznet AT gmail dot com> Description: This script will perform grid search over listed parameter space. """ from __future__ import print_function # PARAMETER SPACE PARAMS = {'--passes':8, ...
true
c0a0ecb70737d2a78ba03d2e664ff6fb26f213b1
KierenJackson/cp1404practicals
/prac_01/testing2.py
UTF-8
252
3.765625
4
[]
no_license
import string def main(): string1 = "AbcD3h@1gd" print(count_letter(string1)) def count_letter(a_str): count = 0 for char in a_str: if char.lower() in string.ascii_lowercase: count += 1 return count main()
true
bd501bd48f8826902c772561dc6b8477d9d6094e
carterjc/RBRCS2
/Unit5-Files/file2/file2.py
UTF-8
5,631
3.96875
4
[]
no_license
# Carter # file2.py import random import time def clean(word): print(f"\n\n----{word}----\n\n") # Part 1 # Create an object ‘story’ for the data inside story.txt with open("story.txt", "r") as story: s_lines = story.readlines() # Write code to only display the first line of story clean("first_li...
true
3a82a575673f189b485ff0df6a2cad36fe6730f7
sgtrouge/data-structure-Python
/BITree.py
UTF-8
3,798
3.484375
3
[]
no_license
class BITree: def __init__(self, max_bound = 1000000, init_list = []): self._count = {} self._max_bound = max_bound self._counter = {} self._sum = {} for element in init_list: self.add(element) def clear(self): self._count.clear() self._sum.cl...
true
86113d26b199713a9fa3bd30eafe4c2d0d280fb6
GG-Orginal/CovidSimulationProject
/src/Person.py
UTF-8
2,083
3.03125
3
[]
no_license
class Person: # This is the count of infected infected_counter = 0 # This is the count of deceased deceased_counter = 0 # New infections counter new_infections = 0 # This is the count of non_compliance with social distancing non_compliance_counter = 0 # This is the time period an...
true
178625af3e91cf86fc6f17034c9b75e560256e68
faz00li/css577_encryption
/keycreationlib.py
UTF-8
5,862
2.90625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Apr 05, 2021 @author: boscolau This is the module defining the APIs to derive cryptographically secure keys given a secret. These APIs are wrappers over Key Derivative Functions. This modules contains two categories of APIs: 1. Application APIs. Availab...
true
ae1ec20e88788594e0de6e480b42f40bdd617028
JRMeyer/Autotrace
/under-development/SelectROI_Qt.py
UTF-8
3,802
2.65625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from PyQt4 import QtGui import pyqtgraph as pg import numpy as np import cv2 import os, PIL from PIL import Image import sys def sum_images(imgDir): allFiles = os.listdir(imgDir) imgPaths = [fileName for fileName in allFiles if fileName[-4:] i...
true
3b6f297e3a5f687b3c83227827ac1163a5fe6626
Awonkhrais/data-structures-and-algorithms
/python/code_challenges/left_join/tests/test_left_join.py
UTF-8
648
2.71875
3
[ "MIT" ]
permissive
from left_join import __version__ from left_join.leftjoin import * from left_join.hashtabel import * def test_version(): assert __version__ == '0.1.0' def test_one(): data1=HashTable() data1.add('fond','enamored') data2=HashTable() data2.add('fond','averse') assert left_join(data1,data2)==[['fond', 'e...
true
08a03371ed54e9dd4bbb8dce107c5d5db1c0d0e5
PeterTFS/geowatch-util
/geowatchutil/buffer/base.py
UTF-8
1,791
2.96875
3
[]
no_license
class GeoWatchBuffer(object): # Public limit = None check_limit = False # Private _messages = [] def add_message(self, message): if self.check_limit: if not self.full(): self._messages.append(message) else: raise GeoWatchBufferEr...
true
624e9bdda7cd80f198f4f1383f511183ca97eafe
xu-chris/ccv-uhh-2018
/exercises/02/ex02_linreg.py
UTF-8
2,497
3.421875
3
[]
no_license
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt ### Setting up the data a = 1.1 b = 0.2 n = 128 # number of points in dataset # Values at linearly spaced x for plotting xg = np.linspace(-1.0, 1.0, num=20) yg = a*xg + b # Dataset: added normally distributed noise to make it interesting x = n...
true
c2b386870c84df0fde10e146a0e424b8c26e1ff9
coolsync/todo
/other-space/py/py-start/06-list/01-index.py
UTF-8
73
3
3
[]
no_license
name_list = ['bob', 'mark', 'paul'] print(name_list) print(name_list[1])
true
28b2fc6215dc7ed8ef9cfe2d8150b856d64ee2d5
jinrongc1986/script
/work/cloudtf.py
UTF-8
3,265
2.53125
3
[]
no_license
#-*- coding:utf-8 -*- from mysql import connector import os import time import datetime import mysql class MySQL(object): """ 使用方法: >>> with MySQL('xvirt') as db: >>> sql = 'select * from instances;' >>> db.execute(sql) >>> for a in db: >>> print a """ def __i...
true
4b808603f39d863eca88ed290388d017068839ad
aktsan/Atcoder_100knocks
/Binary-search/knock21.py
UTF-8
390
2.875
3
[]
no_license
N = int(input()) li = [list(map(int,input().split())) for _ in range(N)] print(li) ans = [] for i in range(N): li_sum = [] for j in range(len(li)): li_sum.append(li[j][0]+ (li[j][1]*i)) print(li_sum) else: ans.append(min(li_sum)) ind = li_sum.index(min(li_sum)) del li...
true
88f2056e7c27fa95b74efc3ab7240a845180335c
punitkoura/graveyard
/assets/python/Hangman/hangman.py
UTF-8
3,900
4.25
4
[]
no_license
# Name: # Section: # 6.189 Project 1: Hangman template # hangman_template.py # Import statements: DO NOT delete these! DO NOT write code above this! from random import randrange from string import * # ----------------------------------- # Helper code # (you don't need to understand this helper code) # Import hangman...
true
9717ca079413d51afdfb25e0ec452e74d7305b15
kadertarlan/python_py
/liste.py
UTF-8
367
3.265625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- print type(" ") liste=["hale","jale",1,2] print liste print type(liste) print len(liste) liste.append("kader") print liste print liste[0] a="kader" print a[0] liste.insert(2,"tarlan") print liste liste.extend(a) print liste liste.remove("hale") print liste liste.po...
true
7a2877b2f30760c69aed7513311f0ef81d24f5ef
mklump/codeguild_pythoncamp
/python_console_shortapps/practice_automatic_teller_machine.py
UTF-8
12,315
3.734375
4
[]
no_license
# -*- coding: utf-8 -*- """ Python Coding Bootcamp (pdxcodeguild) Program exercise file input/output in Python by Matthew James K LAB/STEP requirements: Practice: ATM Write a program that functions as a simple ATM for a single account. An account will be a class: it will have a field for the balance. Write function...
true
3619cc853507a8b13ac99182426403a77be186ef
ay2306/Competitive-Programming
/codeChef/COINCHNG.py
UTF-8
967
2.515625
3
[]
no_license
from sys import stdin,stdout def solve(): g = stdin.readline() c,s,k = map(int,g.split()) dp = [[0 for i in range(600)] for j in range(65)] if s == 0: print(0) return if c == 1: print(1) return n = 0 for i in range(s+1): dp[0][i] = 0 if i == 0:...
true
41b23fadce32ddc0dbb397af788031694e83116b
tbaniya/IR_Project_TBaniya
/IR_Project_TBaniya/pdfreaderwriter.py
UTF-8
1,733
2.546875
3
[]
no_license
import os import re from PyPDF2 import PdfFileWriter, PdfFileReader from urllib.request import urlopen from logger import writelog def readsavedpdf(path,link): file = None tfile = None try: file = open(path, "rb") path = path.replace('.pdf','') tfile = open(path +".txt",'w') ...
true
d01842fa1bd6b574a526e3c4630bc1f4db10bd0c
chasing-entropy/algos
/tests/probability2/inference/multinomial_test.py
UTF-8
2,244
2.984375
3
[ "MIT" ]
permissive
import pytest from probability2.inference import Multinomial from probability2.inference import MultinomialMLEInferrer as MLE def test_exceptions_multinomial_mle_inferrer(): with pytest.raises(ValueError): MLE(empirical_distribution=None) with pytest.raises(ValueError): MLE(empirical_distrib...
true
fa2c0b84d74f8c055670a5575b49b4ef12a158e8
alexanderSvito/effective-broccoli
/counter.py
UTF-8
345
3.328125
3
[]
no_license
def luhn(num): numbers = [int(el) for el in str(num)] result_sum = 0 for index, el in enumerate(numbers): if index % 2 == 0: result_sum += el else: if 2 * el > 9: result_sum += el * 2 - 9 else: result_sum += el * 2 ret...
true
e83f665a8d562c9a11bd71ef4cfc0289a795a8ef
ElizavetaChe/Lesson1
/price.py
UTF-8
158
3.765625
4
[]
no_license
def format_price(price): price_int=int(price) return 'Цена:' + str(price_int) + 'руб.' display_price = format_price(56.24) print(display_price)
true
f4c141b83fac5c599742aec3bf640f83f0f8fc64
kewang1825/oauth2
/mywebapp/token_cache.py
UTF-8
1,048
2.953125
3
[]
no_license
import json class TokenCache: def __init__(self): self.data = [] def contains(self, user_id): cached_token = [cached_token for cached_token in self.data if cached_token['user_id'] == user_id] return len(cached_token) > 0 def get(self, user_id): cached_token = [cached_tok...
true
6e6e168901840cbe30a262c19c3fa6d03e8912b8
PAI-BSPP-SI/soft_information
/raspberry_capteurs.py
UTF-8
911
2.671875
3
[ "MIT" ]
permissive
import serial import time import datetime DWM=serial.Serial(port="/dev/tty.usbmodem0007601032201", baudrate=115200) print("Connected to " +DWM.name) DWM.write("\r\r".encode()) time.sleep(1) DWM.write("lec\r\n".encode()) time.sleep(1) while True: try: line=DWM.readline() print(line.decode()) ...
true
93fd515b2e1c37ce9e9c03f9f99173ea0002d191
sumaiyadabeer/Scrapping
/mongo_try.py
UTF-8
472
2.5625
3
[]
no_license
from pymongo import MongoClient #from pymongo import Connection if __name__ == "__main__": #conn= Connection() client = MongoClient() db = client.test_database people = db.people people.insert({'name': 'summ', 'food':'food1'}) people.insert({'name': 'summ2', 'food':'food2', 'location': 'india'}) people.in...
true
108b54e7001cf09c40d555e9a7a6921ae7febe5c
yunhui21/CB_AI_3_NLP
/Day_34_02_exam_1.py
UTF-8
507
3.015625
3
[]
no_license
# Day_34_02_exam_1.py import tensorflow as tf import numpy as np # 자격증 1번 문제 # x, y 데이터에 대해 모델을 구축하세요. x = [0, 1, 2 ,3, 4, 5, 6] y = [-3, -2, -1, 0, 1, 2, 3] model = tf.keras.Sequential() model.add(tf.keras.layers.Dense(1, activation=None)) model.compile(optimizer=tf.keras.optimizers.Adam(lr=0.1), los...
true
8aeea63ff764e0dbd0a5729705518a89da1c8ed6
botmayank/cosmic_transistor
/adc_spi_test.py
UTF-8
584
3.140625
3
[ "MIT" ]
permissive
#!/usr/bin/python import spidev import time #Define Variables delay = 0.5 channel_0 = 0 channel_1 = 1 #Create SPI spi = spidev.SpiDev() spi.open(0, 0) def readadc(adcnum): # read SPI data from the MCP3008, 8 channels in total if adcnum > 7 or adcnum < 0: return -1 r = spi.xfer2([1, 8 + adcnum <...
true
d0779cd2224e0de2222aa0ffe6afd886bd658b65
bhanugudheniya/Python-Program-Directory
/PythonHome/Basic/Escape Sequence.py
UTF-8
521
4.375
4
[]
no_license
txt1 = 'It\'s alright.' print(txt1) txt2 = "This will insert one \\ (backslash)." print(txt2) txt3 = "\nHello\nWorld!\n" print(txt3) txt4 = "Hello\rWorld!" print(txt4) txt5 = "Hello\tWorld!" print(txt5) #This example erases one character (backspace): txt6 = "Hello \bWorld!" print(txt6) #A backslash followed by th...
true
ae3c29a7ba0cfc2b13b21d46faad9f90ae617df5
dangmc/TestingTest
/test_factorial.py
UTF-8
112
3.078125
3
[]
no_license
from factorial import factorial def test_factorial(): assert factorial(0) == 1 assert factorial(4) == 24
true
29f097e64bda772c89652083e213438549bd843d
elenapvv/FastAPI
/main.py
UTF-8
1,251
2.53125
3
[]
no_license
from fastapi import FastAPI from models import InputData from models import Data from models import GeneralData from database import Database from starlette.responses import Response app = FastAPI(title="REST service") db = Database() @app.post( "/add", response_description="Add new data in database", ) a...
true
1beddb9c396dd75a08c3a108fe5121eabc06141b
BingoZ/python_scripts
/word_similarity/longest_substring.py
UTF-8
690
3.515625
4
[]
no_license
#!/usr/bin/env python2.4 def longest_substring(one,two): lone = len(one) ltwo = len(two) max_len = min(lone,ltwo) longest = '' for i in reversed(xrange(max_len)): for j in reversed(xrange(i,lone+1-i)): chunk = one[i:i+j] if len(chunk) < len(longest): continue print `chunk`,i,i+...
true
32cd1adc2fd919ee05332cfd265770a8f7f8bd89
vavpavlov/GB_HW
/Parsing/Lesson_4/lesson_4.py
UTF-8
3,864
2.828125
3
[]
no_license
#1)Написать приложение, которое собирает основные новости с сайтов news.mail.ru, lenta.ru, yandex.news #Для парсинга использовать xpath. Структура данных должна содержать: #название источника, #наименование новости, #ссылку на новость, #дата публикации #2)Сложить все новости в БД from lxml import html import requests...
true
58a3b8d188934d2966151bad1156bb77e1691b35
tmarice/cp
/hackerrank/contests/101_hack_45/permutation-equation.py
UTF-8
370
3.140625
3
[]
no_license
def find_x(n, p): ret = [] for x in range(n): for y in range(n): if p[p[y]-1] == x+1: ret.append(y+1) break return ret def main(): n = int(raw_input()) p = [int(x) for x in raw_input().split()] ret = find_x(n, p) for r in ret: ...
true
9e6dc21df53114764a33240980dbb3a749f835a3
trynusnick13/ITEA_AC
/Yurii_Khomych/l_3_oop/functors.py
UTF-8
554
3.953125
4
[]
no_license
class Strip: def __init__(self, characters): self.characters = characters def __call__(self, string): return string.strip(self.characters) strip_punctuation = Strip(characters=",;:.!?") strip_punctuation("Land ahoy!") # returns: 'Land ahoy' # alternative for functors is closure def make_s...
true
485f3bcc73826bb9846e61424963afbe458ec318
HuHengKai/mysite2
/day01/meizitu2.py
UTF-8
2,395
2.59375
3
[]
no_license
import requests from lxml import etree import os headers = { 'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36"} # url="https://www.mzitu.com/" # response=requests.get(url=url,headers=headers) # print(response.status_code) # html=et...
true
bbde60076929f07c612434af2889aa1e37634d32
frasere/empirical-reliability-predict
/classes_funcs.py
UTF-8
9,514
2.90625
3
[ "MIT" ]
permissive
##### Class and Function store for Empirical Reliability Predict #################### # main libraries import scipy.stats as ss ################################################################################################################ class bearing: # bearing class def __init__(self, design_params, in...
true
14f320986b1ec0f2febcc39e625aeb8a0644452e
ctralie/GeometricBeatTracking
/MetricalHierarchies.py
UTF-8
7,120
2.703125
3
[ "Apache-2.0" ]
permissive
import numpy as np import matplotlib.pyplot as plt import librosa import sys import scipy.interpolate as interp ## TODO: Pre-multiply by Hamming window ## TODO: Get the hop size as small as possible with madmom to maximize frequency resolution def get_dftacf_hadamard_blocks(X, win, hop, do_plot = False): """ ...
true
ccf75abe3572ceeace9a403c0f80d1904cff8184
hanameee/Algorithm
/Codility/Lesson/4.CountingElements/PermCheck.py
UTF-8
158
2.53125
3
[]
no_license
def solution(A): N = len(A) A.sort() A = list(set(A)) if A[0] == 1 and A[-1] == N and len(A) == N: return 1 else: return 0
true
8fa447f02d1269dda2ad5621946d081e7e1e9509
mferri17/ros-thymio-simulation
/scripts/assignment2_task5.py
UTF-8
1,306
2.78125
3
[]
no_license
#!/usr/bin/env python import rospy import math import numpy as np from utils import ThymioController class ThymioController_Task5(ThymioController): def run(self): """Controls the Thymio.""" ### TASK 4 and 5 are handled the same while not rospy.is_shutdown(): rospy.loginfo...
true
c7bc025ef54a29fa614ed5879337b563577181e7
ephraimc/C395-ID3ImageClassifier
/classify.py
UTF-8
766
3.0625
3
[]
no_license
#THIS FILE CONTAINS FUNCTIONS USED TO CLASSIFY A GIVEN EXAMPLE import scipy.io as sio import functions as f import numpy as np #finds the index of a given attribute in an array, for example AU1 has index 0 def findIndex(attributes, target): for i in range(len(attributes)): if attributes[i] == target: ...
true
083f6190af059428c299b7968f1d427c4393c1bd
blackwhitehere/webEcon
/partA/Auction.py
UTF-8
2,894
3.359375
3
[]
no_license
#!/usr/bin/python import Bid, Slot class Auction: 'This class represents an auction of multiple ad slots to multiple advertisers' def __init__(self, term, bids1=[]): self.query = term self.query = "" self.bids = [] for b in bids1: j = 0 while j < len(s...
true
7c9a1ea7e274104f438e77a0244d7142732c5f12
h4hany/yeet-the-leet
/algorithms/Medium/784.letter-case-permutation.py
UTF-8
984
3.421875
3
[]
no_license
# # @lc app=leetcode id=784 lang=python3 # # [784] Letter Case Permutation # # https://leetcode.com/problems/letter-case-permutation/description/ # # algorithms # Medium (64.85%) # Total Accepted: 96.3K # Total Submissions: 148.5K # Testcase Example: '"a1b2"' # # Given a string S, we can transform every letter indi...
true
08447b6b1030dfc2dfcfc51c23dce16260a7c1d2
dickensn/irlome-dev
/python/draw_map.py
UTF-8
499
2.59375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 ''' IRLOME maps ''' __author__ = "Nick Dickens" __copyright__ = "Copyright 2018, Nicholas J. Dickens" __email__ = "dickensn@fau.edu" __license__ = "MIT" import matplotlib.pyplot as plt import mplleaflet points = [] with open("../web/data/user_data.csv") as in_fh: for line in in_fh: line ...
true
5438362866bd58b6f1fd0c3f324199cb2e69cec1
KpLBaTMaN/WebScrappingPractice
/main.py
UTF-8
4,564
2.921875
3
[]
no_license
# Prasing Information from bs4 import BeautifulSoup import requests # Read and store information import csv # Eamil System - Notifcations # import os # import smtplib # Chrome from selenium import webdriver from selenium.webdriver.support.select import Select from datetime import datetime import time Directory_C...
true
703431f5bc5f08e1c93cbcb3df513a196cc8d13f
insomnia33/USP_Coursera
/fizzbuzz.py
UTF-8
98
3.96875
4
[]
no_license
x = int(input("Digite um número: ")) if x%3 == 0 and x%5 == 0: print("FizzBuzz") else: print(x)
true
e78b2ce0eb620475431a909cc2e14a425e43e70e
haiconmeo/test_paracel-_bai2
/Maximum Average Subarray I.py
UTF-8
387
2.78125
3
[]
no_license
class Solution(object): def findMaxAverage(self, nums, k): """ :type nums: List[int] :type k: int :rtype: float """ S = 0 for i in range(k): S+=nums[i] kq =S for i in range(k,len(nums)): S+=nums[i]-nums[i-k] ...
true