blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
13d5f11e75a3e34207c639fd8cde09e0852a6dcd | Python | Alpha-1729/screenshare | /check/Server_Connection.py | UTF-8 | 399 | 2.640625 | 3 | [] | no_license | import pymysql
import warnings
#database connection
connection = pymysql.connect(host="localhost",user="root",passwd="",database="Lab")
cursor = connection.cursor()
Attendance = """CREATE TABLE IF NOT EXISTS Attendance(ID INT(20) PRIMARY KEY AUTO_INCREMENT, NAME CHAR(20) NOT NULL, ROLL CHAR(15))"""
warnin... | true |
76880890063b6b994116f2ca43c2aefe88e172a2 | Python | shteeven/fullstack | /vagrant/tournament/test.py | UTF-8 | 15,411 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
#
# Test cases for tournament.py
from tournament import *
import sys
import math
def testRegisterMember():
member_count = countMembers()
new_id = registerMember('steven')
if member_count == countMembers():
raise ValueError("Member count should be plus one of previous count")... | true |
8bd74f72f7af2e9aa747b8f80bcfefde71ff9f12 | Python | cccccccccccccc/Myleetcode | /767/reorganizestring.py | UTF-8 | 416 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | from typing import List
class Solution:
def reorganizeString(self, S: str) -> str:
N = len(S)
A = []
for c, x in sorted((S.count(x),x) for x in set(S)):
if c> (N+1)/2:
return""
A.extend(c*x)
ans=[None]*N
ans[::2],ans[1::2]=A[int(N/2):],... | true |
c585449f96a744dc9dc3feb81a62e255338fa9e1 | Python | evanlh/euler | /euler6.py | UTF-8 | 430 | 3.96875 | 4 | [] | no_license | """ Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum."""
def sum_of_squares (nums):
return sum(x**2 for x in nums)
def square_of_sums (nums):
return sum(nums) ** 2
if __name__ == __main__:
a, b = square_of_sums (range(11)), sum_of_squares(rang... | true |
d517bfce98e1a53066ed6d1507fa25c8c74c38db | Python | SOURADEEP-DONNY/WORKING-WITH-PYTHON | /sss.py | UTF-8 | 435 | 3.1875 | 3 | [] | no_license | a=[]
def push_queue(e):
a.append(e)
def pop_queue():
if len(a)<=0:
print("List is empty")
else:
return a.pop(0)
def display_queue():
for i in range(len(a)-1,-1,-1):
print(a[i])
push_queue(24)
push_queue(2)
display_queue()
pop_queue()
display_queue()
... | true |
ffb5a0a71b123102af0429da732341d7c45c2168 | Python | sharky564/Codeforces | /CodeForces Problems 0501-0600/CodeForces Problem 0519B.py | UTF-8 | 342 | 2.953125 | 3 | [] | no_license | a=int(input())
init=input().split()
fix1=input().split()
fix2=input().split()
init.sort(key=float)
fix1.sort(key=float)
fix2.sort(key=float)
i=0
while i<a-1:
if init[i]!=fix1[i]:
print(init[i])
break
else:
i+=1
else:
print(init[i])
j=0
while j<a-2:
if fix1[j]!=fix2[j]:
print(fix1[j])
break
else:
j+=1
... | true |
6a7feb0371a84853436d6cb19436132763e8d88b | Python | kishorewolfe/qrcode-imagesave | /QR code Creater.py | UTF-8 | 212 | 2.578125 | 3 | [] | no_license | import qrcode
qr = qrcode.QRCode(version=1,box_size=15,border=5)
data="https://www.youtube.com"
qr.add_data(data)
qr.make(fit=True)
img=qr.make_image(fill='black',back_color='white')
img.save('qr1.png')
| true |
51ac123b92147b35dca26dde86bba41ad1bc843f | Python | mpses/AtCoder | /Contest/ARC108/a/main.py | UTF-8 | 195 | 2.8125 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/env python3
s, p = map(int, input().split())
for n in range(1, int(p ** .5) + 1):
if p % n:
continue
if n + p // n == s:
print("Yes")
exit()
print("No") | true |
17db024281fd108faf486dbb502d55b8c4cd2a73 | Python | hhassanalikhan/TLB-Test | /WO-Multithreading/readTLBResults.py | UTF-8 | 1,291 | 2.71875 | 3 | [] | no_license | import statistics
fx = open('tlbTest.txt','r')
content = fx.read()
fx.close()
content = content.split('\n')
arraySizes = {}
i = 0
possiblePageSize = []
while i < len(content):
line = content[i]
if line != '':
#get array size
arraySize = line.split(' ')[1]
try:
val = arrayS... | true |
188d1e0ba0dc8e67bde7c09a5fe71ea1c9176c7a | Python | LeloCorrea/Python | /.vscode/python_+100exercicios.py/desafio_03.py | UTF-8 | 810 | 4.1875 | 4 | [] | no_license | '''3:
Crie um script python que leia dois números e tente mostrar a soma entre eles.
Script:
Desafio 3:
Crie um script python que leia dois números e tente mostrar a soma entre eles.
num1=input('Primeiro número: ')
num2=input('Segundo número: ')
print('A soma é ', num1 + num2)
Retorno: #Deu erro, a resposta estará n... | true |
30d8106d0ab81268211018470877d3d8244ae01d | Python | lllliuyajie/tf-daybyday | /seven.py | UTF-8 | 3,709 | 2.90625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# 卷积核的数字如何定义? 一般初始为很小的随机值,无需提前设计 所以均是从经验出发,没有很明确的理论依据,因为使用的是BP 算法 所以在训练中会更新W,B
# tensorflow中的save 只能保存变量 现在用处不大
# RNN 循环神经网络
mnist_data = input_data.read_data_sets('MNIST_data', one_hot=True)
# compute_accuarcy
def compute_accuracy(... | true |
852def1072ae52eea7553c9f5c7042668e7092c2 | Python | m-sathya-reddy/DataStructuresAlgorithmsPython | /lastmile/leetcode/300/ReachingPoints.py | UTF-8 | 1,877 | 3.515625 | 4 | [] | no_license | class ReachingPoints:
# def reachingPoints(self, sx: int, sy: int, tx: int, ty: int) -> bool:
# if sx == tx and sy == ty:
# return True
# if sx > tx or sy > ty:
# return False
# else:
# return self.reachingPoints(sx, sx + sy, tx, ty) or self.reachingPoints... | true |
ef053e45f06a8329bdb0e0d1705fe36882027b58 | Python | Tianw22/Crawlers | /HostadviceCrawler.py | UTF-8 | 2,727 | 3.0625 | 3 | [] | no_license | #BeautifulSoup and selenium work wonderful together.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
import re
... | true |
e7ca7713df9130c1bda9d0fedbe811b64c09acba | Python | nralex/PPZ | /ListaDeExercíciosIII/ex05.py | UTF-8 | 516 | 3.640625 | 4 | [] | no_license | #########################################################################################################
# Dados dois números inteiros positivos, determinar o máximo divisor comum entre eles usando o #
# algoritmo de Euclides. #
##... | true |
b2241fb7740ccc3842cbc517cc0128003170dda0 | Python | dszalucki/bootcamp | /zad 2.6.py | UTF-8 | 287 | 3.203125 | 3 | [] | no_license | lista = [31,135,45,-31,-13213,512,43,24231]
maximum = 0
minimum = 0
for i in range(1, len(lista)):
if lista[i] < lista[minimum]:
minimum = i
if lista[i] > lista[maximum]:
maximum = i
lista[minimum], lista[maximum] = lista[maximum], lista[minimum]
print(lista)
| true |
90fa10241c83a282da74271d9736b7d5ad1f6131 | Python | PuchkovNik/OS | /белый список.py | UTF-8 | 222 | 3.390625 | 3 | [] | no_license | print('Белый список')
white = []
for i in range(int(input())):
white.append(input())
search = []
for j in range(int(input())):
search.append(input())
for n in search:
if n in white:
print(n)
| true |
405cfb5856c71c624028a69e28f311d0db1d64b3 | Python | bunshue/vcs | /_4.python/__code/Python自學聖經(第一版)/ch12/xlsx_read.py | UTF-8 | 487 | 3.734375 | 4 | [] | no_license | import openpyxl
# 讀取檔案
workbook = openpyxl.load_workbook('test.xlsx')
# 取得第 1 個工作表
sheet = workbook.worksheets[0]
# 取得指定儲存格
print(sheet['A1'], sheet['A1'].value)
# 取得總行、列數
print(sheet.max_row, sheet.max_column)
# 顯示 cell資料
for i in range(1, sheet.max_row+1):
for j in range(1, sheet.max_column+1):
print(she... | true |
1f860e67a3c7f33876e62d01e0ae95100d960911 | Python | dwayne561/Computer-Science-Portfolio | /Python_Programs/HW1/p2_Fraser_Dwayne.py | UTF-8 | 611 | 4.125 | 4 | [] | no_license | # DWAYNE FRASER
############## Problem 2. Pythagorean Numbers ####################################
# Function to find all possible pythagorean triples of given value n
def find_Pythagorean(n):
n = int(n)
# For a in range n
for a in range(n):
# For b in range n
for b in range(n):
... | true |
9bea1bdfe3d1d9572876fc1c708cab9e1442edb2 | Python | 1904114835/txcl | /实验二/mysift/try.py | UTF-8 | 1,932 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 26 15:50:37 2020
@author: 19041
"""
import cv2
import pyr
import conv
import kp
import numpy as np
def describe_M_Theta(I,sigma) :
I = np.pad(I,1, 'constant')
#print(I)
A=I[1:I.shape[0]-1, :I.shape[1]-2]
#print(A)
B=I[1:I.shape[0]-1,2:I... | true |
3dbca8546a4068aee3f086974e2b87bf99795e70 | Python | meighanv/05-Python-Programming | /LABS/DICTIONARIES-SETS/dict-set-classSched.py | UTF-8 | 1,154 | 3.703125 | 4 | [] | no_license | classRooms = { 'CS101':'3004',
'CS102':'4501',
'CS103':'6755',
'NT110':'1244',
'CM241':'1411' }
classInst = { 'CS101':'Haynes',
'CS102':'Alvarado',
'CS103':'Rich',
'NT110':'Burke',
'CM241':... | true |
da96b4b7cc2cba2dcc6d832c8a93cffbee5b29f1 | Python | Ryandalion/Python | /Input, Output, and Processing/Land Calculation/Land Calculation/Land_Calculation.py | UTF-8 | 282 | 4 | 4 | [] | no_license | #Function converts square footage (user input) to acerage
conversion = 43560;
squareFeet = int(input('Please enter the square feet for the tract of land: '));
acreage = (squareFeet / conversion );
print(squareFeet, 'sqft converted to acres is', format(acreage, '.4f' ), 'acres');
| true |
54eeb147e3325df7748e8bddcd3c2b4e7afb0746 | Python | dmendez1/Python-Projects | /chat.py | UTF-8 | 8,308 | 3.109375 | 3 | [] | no_license | import sys
import aioconsole
import asyncio
import click
import requests
import requests_oauthlib
from server.chat_server import ChatServer
from client.chat_client import (
ChatClient,
NotConnectedError,
LoginConflictError,
LoginError,
CreationError,
CreateConflictError
)
async ... | true |
d2426ffaeae413d25f84028a6c4db290a8549a83 | Python | AlexMarquez-coder/Beroepsopdracht-week-1-10 | /Hello_You 10 vocoder.py | UTF-8 | 974 | 3.6875 | 4 | [] | no_license | # Add your Python code here. E.g.
from microbit import *
import speech
import random
lengtewoordArray = 3
onderwerp = ["Alex", "Daniel", "ouders"]
werkwoord = ["walks", "learns", "drinks"]
rest = ["hard", "at school", "coffee"]
def sayTheWords1(word):
print(word)
speech.say(word, speed=120, pitch=... | true |
091ea25c3bed1fc46d94797cba36d744fcadc827 | Python | maniCitizen/-100DaysofCode | /Concepts/Modules.py | UTF-8 | 104 | 2.96875 | 3 | [] | no_license | from Calc import *
a = 9
b = 10
print(add(a,b))
print(sub(a,b))
print(multiply(a,b))
print(div(a,b))
| true |
8fc1b2cf87a67248c53873a200ee307dbebfdb74 | Python | bbutton/payroll_challenge_python | /tests/developer_tests.py | UTF-8 | 297 | 2.5625 | 3 | [] | no_license | from nose.tools import *
import unittest
from payroll_challenge.developer import Developer
class DeveloperFixture(unittest.TestCase):
def test_pays_developer_1000(self):
developer = Developer()
amount_paid = developer.pay()
self.assertEqual(1000, amount_paid)
| true |
2c16fe576ccef07721a6ecd093071c8d41900b82 | Python | mina0805/Programming-with-Python | /Programming_Basics_with_Python/04.ПО-СЛОЖНИ ЛОГИЧЕСКИ ПРОВЕРКИ/17.Football_tickets.py | UTF-8 | 1,407 | 3.953125 | 4 | [] | no_license | # • VIP – 499.99 лева.
# • Normal – 249.99 лева.
#1 до 4 – 75% от бюджета.
# • От 5 до 9 – 60% от бюджета.
# • От 10 до 24 – 50% от бюджета.
# • От 25 до 49 – 40% от бюджета.
#• 50 или повече – 25% от бюджета.
# “Yes! You have {N} leva left.
# Not enough money! You need {М} lev
budget = float(input()... | true |
e53a3c096921f7d284bb04fde12f3fcdeff66105 | Python | Aasthaengg/IBMdataset | /Python_codes/p03242/s500856918.py | UTF-8 | 153 | 3.25 | 3 | [] | no_license | S = input()
N = len(S)
ans = ''
for n in range(N):
if S[n] == '1':
ans += '9'
elif S[n] == '9':
ans += '1'
else:
ans += S[n]
print(ans) | true |
4c13a1d9af8e3c1acd566fdc43d70f9d66146186 | Python | tianyin/cox | /dataset/mysql/mysql_parser.py | UTF-8 | 3,953 | 2.578125 | 3 | [
"MIT"
] | permissive | from lxml import etree
from lxml.html import fromstring
from StringIO import StringIO
import csv
import os
OUTPUT_DIR = './parameters/'
if not os.path.exists(OUTPUT_DIR):
os.mkdir(OUTPUT_DIR)
def get_all_parameter_desc(page_dir):
option_list = []
option_desc = {}
"""
Step 1. Collect all the p... | true |
1df1620d8e0f2e726c5c4cb40d0f41960c343be5 | Python | airjason13/jtube-dl | /venv/lib/python3.6/site-packages/pyffmpeg/misc.py | UTF-8 | 2,202 | 2.71875 | 3 | [] | no_license | """
To Provide miscellaneous function
"""
import os
from platform import system
from lzma import decompress
from base64 import b64decode, b64encode
class Paths():
def __init__(self):
self.os_name = system().lower()
if self.os_name == 'windows':
env_name = 'USERPROFILE'
se... | true |
20ea6b1b295e3f61af6374ad96f70d25c64360bd | Python | finesoft2009/messages | /messages/whatsapp.py | UTF-8 | 2,771 | 3 | 3 | [
"MIT"
] | permissive | """
Module designed to make creating and sending WhatsApp messages easy.
1. WhatsApp
- Uses the Twilio API to send WhatsApp messages, thus inherits from the
Twilio class.
- Must have an account_sid, auth_token, and a twilio phone number
in order to use.
- Go to https://www.twilio.com/whatsapp ... | true |
b04606e408d3c8baac5a36c5e3740bb40f99efe7 | Python | aaronwang062441/temp | /main.py | UTF-8 | 2,437 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
# author: wangminghui
import os
import csv
import sys
from datetime import datetime
sys.path.append(os.path.dirname(__file__))
from database import DB_IMPALA, MysqlDB
from config import IMPALA_CONFIG
impala_database = DB_IMPALA(IMPALA_CONFIG, 'impala_zilong')
fmt_sql = "SELECT... | true |
a374313a4f4dc7111d19a37031a9395d96be28e9 | Python | KirillAkishin/da1.sphere | /Homeworks/hw3/b.py | UTF-8 | 1,576 | 3.015625 | 3 | [] | no_license | import re
from itertools import starmap
import operator
from functools import reduce
from operator import itemgetter
def solution1(args):
return list(map(lambda s: int(''.join(re.findall(r'\d+', s))[::-1]), args))
def solution2(args):
return list(starmap(operator.mul, args))
def solution3(args):
return... | true |
42cd3e58c6f417ff73066ef45bc4df1795abb078 | Python | XingxinHE/PythonCrashCourse_PracticeFile | /Chapter 10 File and Exception/10-9.py | UTF-8 | 350 | 3.09375 | 3 | [] | no_license | file_name = ['cats.txt','dogs.txt']
for f_name in file_name:
try:
with open(f_name, 'r') as file:
content = file.readlines()
except FileNotFoundError:
pass
else:
print(content)
#with open(file_name2, 'r') as file:
# content = file.re... | true |
adc7131e83b23f5aee87d54253ba0eaa6f12f6ca | Python | jsheedy/neopixel-framebuffer | /fx/midi_event.py | UTF-8 | 259 | 2.984375 | 3 | [
"MIT"
] | permissive | class MidiEvent():
def __init__(self, note, velocity, channel):
self.note = note
self.velocity = velocity
self.channel = channel
def __repr__(self):
return f'Midi Event {self.note} - {self.velocity} - {self.channel}'
| true |
bff98773e2b0923ee536e82b25fbdabeaac38ad7 | Python | liushaoxiong10/Object-oriented-Python | /容器和集合/1.集合的抽象基类.py | UTF-8 | 1,350 | 3.9375 | 4 | [] | no_license | '''
Container 基类要求子类实现__contains__()方法,这个方法实现了in运算符
Iterable 基类要求子类实现__iter__()方法,for语句、生成器表达式和iter()函数都需要
Sized 基类要求子类实现__len__() 方法,len()函数使用这个方法
Hashable 基类要求子类实现__hash__() 方法,hash()函数需要使用,如果这个方法被实现了那就意味着当前对象是不可变的
复合基类
Sequence 和 MutableSequence 类,基于 index()、count()、reverse()、extend()和remove()
Mapping 和 MutableMapp... | true |
20eba71934880b137b086ebdae326c429931a165 | Python | gautamdayal/cryptography | /bitwise.py | UTF-8 | 990 | 3.625 | 4 | [] | no_license | # W O R K I N P R O G R E S S
# Converts binary to decimal (without using python builtin)
def binDec(b):
x = 0
n = 0
b = str(b)
values = [i for i in range(len(b))]
for c in b[::-1]:
if c == '1':
x += 2 ** values[n]
n += 1
return x
# Operates XOR on each bit... | true |
672f915e561f00da7bf320604f2400490862674d | Python | partsalliance/brixtonbrewing | /TemperatureProbe.py | UTF-8 | 2,213 | 2.921875 | 3 | [] | no_license | import os
import glob
import time
import datetime
import threading
import csv
class TemperatureProbe:
'Class for each possible temperature probe in this project'
def __init__(self):
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
self.activeLogging = False
de... | true |
6032fd0983403b0a2c1097d103503dc0eb5ea9d3 | Python | Larry09/Data-Analytics-Project | /TestRunFile.py | UTF-8 | 6,089 | 2.796875 | 3 | [] | no_license | import warnings
import graphviz
import matplotlib.pyplot as plt
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
from sklearn.linear_model import LogisticRegression
from sklearn import tree
from sklearn.tree import export_graphviz, DecisionTreeClassifier
import... | true |
84d67d3a4e759b111cba986788789b99a75527e4 | Python | catter-unprg28/t7_Catter.Llamo | /Catter/iteracion2.py | UTF-8 | 355 | 3.109375 | 3 | [] | no_license | #PROGRAMA PARA MOSTRAR EN PATALLA LOS DECODIFICADORES "MI NUMERO DE CELULAR ES 987654321"
msg=""
import os
msg=str(os.sys.argv[1])
for letra in msg:
if (letra=="T"):
print("MI NUMERO")
if(letra=="S"):
print("DE CELULAR")
if(letra=="R"):
print("ES")
if(letra=="M"):
print... | true |
882fe754e1686d1b0a60074f3476e13324dea844 | Python | fsahin/algorithms-qa | /Math/primesSieve.py | UTF-8 | 360 | 3.671875 | 4 | [] | no_license | """
Find the prime numbers up to N
"""
def primes_sieve(limit):
limitn = limit + 1
not_prime = [False] * limitn
primes = []
for i in range(2, limitn):
if not_prime[i]:
continue
for f in xrange(i * 2, limitn, i):
not_prime[f] = True
primes.append(i)
... | true |
b3528a7dfa40f8c57bb3fddba87e3660805519ea | Python | skipter/Programming-Basics-Python | /Python Basics April 2018/Simple Calculations/17.DailyEarnings.py | UTF-8 | 330 | 3.21875 | 3 | [] | no_license | workingDays = int(input())
moneyPerDay = float(input())
USDtoLev = float(input())
monthFee = workingDays * moneyPerDay
yearFee = monthFee * 12 + monthFee * 2.5
clearMoneyUSD = yearFee - yearFee * 25 /100
totalClearMoney = clearMoneyUSD * USDtoLev
moneyWinPerDay = totalClearMoney / 365
print("{0:.02f}".format(moneyW... | true |
ca6cd152de8b0125cbed4f345539d563e8674915 | Python | Qww57/winosolver | /winosolver/cknowledge/WikipediaDatabase.py | UTF-8 | 6,011 | 3.25 | 3 | [] | no_license | from nltk.corpus import words
from wikipedia.wikipedia import WikipediaPage
from winosolver.nlptools import Tokenizer
import os
import sqlite3
import wikipedia
class Article:
"""
Representation of a wikipedia article object
"""
def __init__(self, title, url, content, summary):
self.title = ti... | true |
04e6e3d1991f6bb137cbf2bf63f78566e412cce3 | Python | basti-schr/django-happenings | /tests/integration_tests/test_multi.py | UTF-8 | 1,795 | 2.5625 | 3 | [
"BSD-2-Clause"
] | permissive | from __future__ import unicode_literals
from django.urls import reverse
from .event_factory import create_event, SetMeUp
class MultipleEventsListViewTest(SetMeUp):
"""
There's already a test called test_list_view_with_multiple_events
in test_month_view, but this takes it a step further.
Created in r... | true |
235b517cbe734911658aaeca2520f88fa8350550 | Python | wangjianweiwei/design_pattern | /代理模式/__init__.py | UTF-8 | 5,079 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@Author : Wong Jan Wei
@Time : 2019-08-25 17:31
@File : __init__.py.py
@Describe:
"""
"""
代理通常就是一个介于寻求方和提供方之间的中介系统, 寻求方是发出请求的一方, 而提供方则是根据请求提供资源的一方.
在web世界中, 它相当于代理服务器, 客户端在向网站发出请求时, 首先链接都代理服务器, 然后向他请求诸如网页之类的资源.
代理服务器在内部评估此请求, 将其发送到适当的服务器, 当他收到响应后就会将响应传递给客户端,因此, 代理服务器可以封装请求, 保护隐私,并且... | true |
8c0fc437b79e656533d322b02d1b611823f16b32 | Python | serverdensity/performance-dashboard | /available.py | UTF-8 | 528 | 2.515625 | 3 | [
"MIT"
] | permissive | # Read the conf.yaml and ask what metrics you want to output in common.
import codecs
import os
import yaml
from datawrapper import DataWrapper
with codecs.open('conf.yml', 'r') as f:
conf = yaml.load(f.read())
if __name__ == '__main__':
try:
token = os.environ['SD_TOKEN']
except KeyError:
... | true |
7d87deee0c143051a1b94606e3b42755aed337e5 | Python | JustDoPython/python-examples | /xuanyuanyulong/2020-08-24-python-dis-bytecode/test_dis.py | UTF-8 | 124 | 2.5625 | 3 | [] | no_license | import dis
s = """
def add(add_1, add_2):
sum_value = add_1 + add_2
print("Hello World!")
import sys
"""
dis.dis(s) | true |
4e145258c636b2d9df9834f8aa15c9ec060d1569 | Python | akosturos/fullstacknanodegree_logs-analysis | /news-report.py | UTF-8 | 2,377 | 2.96875 | 3 | [] | no_license | import psycopg2
import sys
import datetime
#DBNAME = "news"
#Goals and queries
##Goal #1
goalOneTitle = "Return top three most popular posts, by views:"
goalOneQuery = ("select articles.title, count(*) as views from articles"
" join log on log.path"
" like '%' || articles.slug || '%'"
... | true |
f3b302ff27e2682c380f7ebe541910cddfeca184 | Python | splhack/mantle | /mantle/coreir/type_helpers.py | UTF-8 | 564 | 2.546875 | 3 | [
"MIT"
] | permissive | from magma.backend.coreir_ import CoreIRBackend
from magma.frontend.coreir_ import CircuitInstanceFromGeneratorWrapper
def Term(cirb: CoreIRBackend, width: int):
"""
Take in an array of wires and connect it to nothing so that you don't get an unconnected
:param cirb: The CoreIR backend currently be used
... | true |
0b4e89f56e0987b056b0b6f336e92921648d6191 | Python | daniel-reich/turbo-robot | /45mCi72kbwTyvx3jk_12.py | UTF-8 | 1,243 | 3.984375 | 4 | [] | no_license | """
Welcome to the series of SQL challenges, Juan has just entered the climate
research center and he needs to find the cities that start with a capital
letter B and end with the letter s, and most sort them in alphabetical order.
His friend tells him that he can use the LIKE method to find the matches in
the datab... | true |
b3905c6e642baa58d0bd039e933aeb3ff6239bbd | Python | cnovacyu/python_practice | /tictactoe_whowins.py | UTF-8 | 999 | 4.03125 | 4 | [] | no_license | game = [[2, 2, 0],
[2, 1, 0],
[1, 1, 1]]
player1 = 1
player2 = 2
def who_wins(game):
for row in game:
if row.count(player1) == 3:
print("Player1 wins!")
elif row.count(player2) == 3:
print("Player2 wins!")
def arrange_columns(game):
game_c = []
list1 = []
list2 = []
list3 = []
fo... | true |
e04c26406c9171bf23c05ace7e3e32d8c9f3adfa | Python | t-g-williams/seattle_hackathon | /code/add_demographics.py | UTF-8 | 4,738 | 2.890625 | 3 | [
"MIT"
] | permissive | import pandas as pd
import sqlite3
import numpy as np
import code
import logging
import generalDBFunctions as db_fns
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# specify the file names
dem_fn = '../data/demographic/nhgis0002_ds172_2010_block.csv'
db_fn = '../query_results/sea_5km.db'... | true |
0c3135a1f74e0631756a318bd946632af70fabfb | Python | wudangqibujie/GET_youxin_car_data | /speed_test.py | UTF-8 | 612 | 3.375 | 3 | [] | no_license | import time
from functools import wraps
from timeit import timeit
#时间测试
def timethis(func):
@wraps(func)
def wrapper(*args, **kwargs):
start = time.perf_counter()
r = func(*args, **kwargs)
end = time.perf_counter()
print('{}.{} : {}'.format(func.__module__, func.__name__, end - s... | true |
7304c9abece75d1ad25a2055f5339d66d0fdf94a | Python | kislyuk/gs | /gs/util/__init__.py | UTF-8 | 2,645 | 2.75 | 3 | [
"MIT"
] | permissive | import os, struct, functools
from datetime import datetime
from dateutil.parser import parse as dateutil_parse
from dateutil.relativedelta import relativedelta
import requests.exceptions
class Timestamp(datetime):
"""
Integer inputs are interpreted as milliseconds since the epoch. Sub-second precision is disc... | true |
24e6950446cac3604169e1ebfb4c4c5236c0c84e | Python | shenganzhang/cloudnetpy | /cloudnetpy/categorize/containers.py | UTF-8 | 4,502 | 2.75 | 3 | [
"MIT"
] | permissive | from collections import namedtuple
from typing import Optional
import numpy as np
import numpy.ma as ma
from cloudnetpy import utils
class ClassificationResult(namedtuple('ClassificationResult',
['category_bits',
'is_rain',
... | true |
d20c6f6d883450e6c86a5be4af3272d117cb415f | Python | YamiDark20/Brigd-it | /Agente.py | UTF-8 | 30,836 | 2.921875 | 3 | [] | no_license | #import Tablero as mundo
#import time
import copy
class Agente():
def __init__(self, color):
super(Agente, self).__init__()
self.color = color
self.valor = 0
self.profundidad = 0
self.siguienteEstado = None
self.mejorEstado = None
self.alpha = -9999
... | true |
adf6efb0f74a5e64cd49c563a1aa2ceb1c8ba823 | Python | doughnutnz/at_airflow | /dags/at/at_api.py | UTF-8 | 2,519 | 2.640625 | 3 | [] | no_license | """
Implement AT API functionality.
Author: Doug
Created: 23/09/2018
"""
import os
# import sys
# from pathlib import path
# import os.path
import requests
import json
import gzip
import time
F_CREDENTIALS = '.api-key'
AT_BASE_URL = 'https://api.at.govt.nz/v2/'
AT_VEHICLE_LOCATIONS = AT_BASE_URL + 'public/realtim... | true |
7469f92046775f15774a91e8b18b428ba26cf6f3 | Python | Mohammed2/ROOTtutorial | /make_data.py | UTF-8 | 581 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
from sys import argv
from ROOT import gRandom
npt = 15
yerr = 1.25
slope = 1.2
intc = -0.5
if len(argv) > 1:
filename = argv[1]
if len(argv) > 2:
npt = int(argv[2])
else:
filename = 'mydata.dat'
npt = 15
f = open(filename,'w')
f.write('# Data for line fit test\n')
f.w... | true |
db1aeeca1d8fae24a0774b3dd5399f5baef5348a | Python | webclinic017/stock-forecast | /fetcher.py | UTF-8 | 8,645 | 2.71875 | 3 | [] | no_license | from patternScanner import get_candle_funcs
import yfinance as yf
import numpy as np
import utils
import statics
import sys
import talib
def fetchData(tickerList, fetchOptions):
try:
data = yf.download( # or pdr.get_data_yahoo(...
# tickers list or string as well
tickers = str(' '... | true |
fb2857f242adec8e286cf6a13e364d8c4d1d44f1 | Python | skipperkongen/xkcd-click-and-drag | /xkcd.py | UTF-8 | 543 | 2.546875 | 3 | [] | no_license | import urllib
import sys
# Warning: This code is slow to complete, due to all the 404's. It also sucks in many other ways.
# Please look at xkcd2.py instead :-)
for v in ['n','s']:
for h in ['e','w']:
for i in range(1,100):
for j in range(1,100): ... | true |
57c0039e120a79ea23407500a2a829cd31ec4aa5 | Python | jzyboy/procedure | /moguding/test_five(教师月报填写,半成品).py | UTF-8 | 7,134 | 2.6875 | 3 | [] | no_license | # !/usr/bin/env python
# coding:utf-8
# 教师月报的编写(半成品)
# 作者:江致远
# 作者邮箱:1914813051@qq.com
# 语雀链接:https://www.yuque.com/ol1q37/gi94xp/kcrzm7
# 修改日期:2020年7月29日
from selenium import webdriver
import time
import random
import csv
import os
import re
import schedule
from PIL import Image
import datetime
import codecs
import... | true |
433ddae8af066915716ee39f45548b43951cc05f | Python | tathagata/pc | /interviews/embedly/1.py | UTF-8 | 352 | 3.171875 | 3 | [] | no_license | import math
def sum_digits(value):
sum =0
while value !=0:
sum +=value%10
value /=10
return sum
def fact(value):
mul =1
for i in range(value,0,-1):
mul *=i
return mul
if __name__ == "__main__":
num = 0
i = 786 #0
while num!=8001:
num = list(map(sum_digits, list (map(fact, range(0,i+1)))))[-1]
pri... | true |
0e54c5a3d0a8fe3ff43cea1ed7170c7472dfcdab | Python | tpqls0327/Algorithm | /Baekjoon/BackTracking/1941_소문난칠공주_S.py | UTF-8 | 1,135 | 3.125 | 3 | [] | no_license | # 1941 소문난 칠공주
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
def check_range(y, x):
return (0 <= y < 5) and (0 <= x < 5)
def dfs(data, S, Y):
global answer, visited
if Y > 3:
return
if len(data) == 7 and S >= 4:
data = tuple(sorted(data))
if data n... | true |
60e14dd25365b1a42c5a5b9f5608bca34263849d | Python | viper0302/flask-postgresql-template | /forms.py | UTF-8 | 1,575 | 2.625 | 3 | [] | no_license | from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, Length, Email, EqualTo
from models import User
class LoginForm(Form):
email = StringField('Email',
validators=[DataRequired(), Email()])
password = PasswordField('Pass... | true |
ad5a910f1481a31c0ab36033d5a989198828ddd7 | Python | vvang8177/RapperSliderMatcher | /game.py | UTF-8 | 7,263 | 2.515625 | 3 | [] | no_license | import pygame
from pygame import mixer
import time
import os
import random
from pygame.constants import KEYDOWN, K_SPACE
FPS = 60
WIDTH=1600
HEIGHT=800
WIN = pygame.display.set_mode((WIDTH,HEIGHT))
Turqyoise = (48,213,200)
BLACK = (0,0,0)
GREEN = (0,128,0)
LGREEN = (124,252,0)
pygame.mixer.init()
music_69 = mixer.S... | true |
692ee27de86f19b319f4795c1449cadd4b545c31 | Python | nickyfoto/lcpy | /src/lcpy/ln.py | UTF-8 | 1,607 | 3.421875 | 3 | [] | no_license | def build_head(l):
head = l.pop(0)
head = ListNode(head)
n = head
while l:
n.next = ListNode(l.pop(0))
n = n.next
return head
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def __str__(self):
if self.detect_loop():
... | true |
edc3de21573e569775075576aaf942e6e296a8b9 | Python | jpellois/nail_agent | /run_nail_agent.py | UTF-8 | 1,687 | 2.96875 | 3 | [
"LicenseRef-scancode-generic-cla"
] | no_license | #!/usr/bin/env python3
import argparse
import os, sys
from jericho import FrotzEnv
from agent.nail import NailAgent
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
parser = argparse.ArgumentParser(description='Run the NAIL agent on a game.')
parser.add_argument("game", type=str,
... | true |
a1a8f47dc61253d94ebfbe9fbac803eade9eab3c | Python | eweisger/HTTP-Request-and-Response-Servers | /requestAndResponseServers/task_two.py | UTF-8 | 2,781 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
import socket
import sys
import os
import datetime
PORT = 8080
HOST = '127.0.0.1'
def main():
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
my_port = PORT
while True:
try:
s.bind((HOST, my_port))
break
e... | true |
e801d29be041049c765f32876e5830baab7c46fb | Python | mpeamma/advent-of-code-2015 | /day7/main1.py | UTF-8 | 2,032 | 3.171875 | 3 | [] | no_license | import re
f = open("input", "r")
contents = f.readlines()
class Node:
def __init__(self, inputs, output, operation = "PASS"):
self.inputs = inputs
self.output = output
self.operation = operation
nodes = []
cache = {"b": 16076}
def find_node(node):
return next(x for x in nodes ... | true |
8e0b711aaf95b1d48d85594153ddc18ce053ac32 | Python | KIMJJUN/Scrapping-by-Python | /indeed.py | UTF-8 | 1,886 | 2.921875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
#데이터 추출 beautifulsoup
LIMIT = 50
URL = f"https://jp.indeed.com/%E6%B1%82%E4%BA%BA?q=python&limit={LIMIT}"
#페이지의 마지막 번호를 가져옴.
def get_last_pages():
result = requests.get(URL)
soup = BeautifulSoup(result.text, "html.parser")
pagination = soup.find("div", {"class"... | true |
2906a297a4f9cc0b240994ac4effa70f7e2b6d9f | Python | nithinksath96/Computer_Vision_Assignments | /NeuralNetworks/nsathish/run_q4.py | UTF-8 | 4,693 | 2.609375 | 3 | [] | no_license |
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches
import skimage
import skimage.measure
import skimage.color
import skimage.restoration
import skimage.io
import skimage.filters
import skimage.morphology
import skimage.segmentation
from nn import *
from q4 import *
# do not includ... | true |
69ef0dad8d964ebc989c091653f368922ede3e99 | Python | junaid238/class_files | /python files/loopingparttwo.py | UTF-8 | 3,291 | 3.8125 | 4 | [] | no_license | # for loops for strings
# tech = "Python"
# for i in tech:
# print(i)
# for i in range(0,len(tech)):
# print(tech[i])
# multiplication table for 5
# for i in range(1,11):
# print("5 X %d = %d" %(i , 5*i))
# print("5 X " + str(i) + " = " + str(5*i))
# patterns
# 1 star pattern
# for i in range(1,6):
# print... | true |
1779fed77b6516e1f1521304669bcee41a452032 | Python | jerry1ye10/Dry-Popcorn | /util/getMusic.py | UTF-8 | 4,368 | 3.0625 | 3 | [
"MIT"
] | permissive | #Dry Popcorn -- Jason Lin, Jiajie Mai, Raymond Wu, Jerry Ye
#SoftDev1 pd07
#P01 -- ArRESTed Development
#2018-11-26
from urllib import request #stdlib
import json #stdlib
from random import choice #stdlib
# util file for sending last.fm API requests, returning relevant information
#get API key from MUSIC_API_KEY.txt... | true |
0d51f09cafe9c4c24aa58b8d85f67e4d3a426ca7 | Python | rmathure/HumbleBumble | /chess/knight.py | UTF-8 | 2,931 | 3.421875 | 3 | [] | no_license | from piece import Piece
from board import Board
class Knight(Piece):
def __init__(self, board, posx, posy, color):
self.__color__ = None
self.__posx__ = None
self.__posy__ = None
self.__board__ = board
self.set_color(color)
self.set_position(posx, posy)
self.... | true |
5b67443e867f344e211dd0e8f05b0b9e9b7b64b2 | Python | FlawlessFalcon/Pythonista | /LearningPy/DataStructures/strings/StringAssignment1.py | UTF-8 | 461 | 3.703125 | 4 | [] | no_license | '''
Created on Jan 11, 2016
@author: gaiyamperumal
Write a program that prompts for a file name, then opens that file and reads through the file, and print the contents of the file in upper
case. Use the file words.txt to produce the output below. You can download the sample data at http://www.pythonlearn.com/code/w... | true |
545556e3b9e1b1fda88878ad3ab2639ffffe9f1a | Python | ryankuo0509/python_example | /ex_method.py | UTF-8 | 422 | 3.875 | 4 | [] | no_license | #
# Define
#
def calc_method(a, b = 1):
print (a * b)
# Tuple
def args_method(*args):
print (args)
# Dictionary
def kwargs_method(**kwargs):
print (kwargs)
#
# Call
#
calc_method(4)
calc_method(4, 10)
# input arg can NOT follow define order
calc_method(b = 10, a = 2)
# Call by args, Tuple
args_met... | true |
40f0cdd79192ad5986f7161b56aefaa9d150706f | Python | kshitijvr93/Django-Work-Library | /projects/archives/data_management/accessions_spreadsheet_to_table.py | UTF-8 | 18,546 | 2.5625 | 3 | [] | no_license | '''
(1) For a given excel spreadsheet print the header column names.
'''
import sys, os, os.path, platform
import datetime
from collections import OrderedDict
def register_modules():
platform_name = platform.system().lower()
if platform_name == 'linux':
modules_root = '/home/robert/'
#raise Va... | true |
9b0f66129d2c76fae1ea9ce05c7b600de4137e3e | Python | eduard-C0/ImobiliareTracker | /database.py | UTF-8 | 1,319 | 2.703125 | 3 | [] | no_license | import mysql.connector
import json
mydb = mysql.connector.connect(
host="localhost",
user="Eduard",
password="2comTbaci",
database="ImobiliareDatabase"
)
mycursor = mydb.cursor()
#mycursor.execute("CREATE TABLE Apartment (ApartmentId INT PRIMARY KEY, Url VARCHAR(255), City VARCHAR(255),Neighbourhood VARCHAR(... | true |
a10ce70b9453f691a26de354b0b8b94e2b1016e0 | Python | dhana2k14/copper_demo | /code/v2.0__copper__price__model__month__011218.py | UTF-8 | 3,237 | 2.953125 | 3 | [] | no_license | # copper price forecast using LSTM
# setting up necessary libraries
# * this source code tested on tfp3.6 env with anaconda
import pandas as pd
import os
import numpy as np
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import LSTM, Dense
from sklearn.preprocessing import MinM... | true |
48c0fc562142c03689344e22d6bc6d57d4e2d1bc | Python | florinalbisoru/Unsorted | /Scraps of Code - Test.py | UTF-8 | 832 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 23 19:31:25 2019
@author: Florin Albisoru
This file is used to check certain lines of code that do not act right.
"""
# Note: Interchange of rows is functioning properly
import numpy as np;
"""
E = np.array([[1,1,0,3],[2,1,-1,1],[3,-1,-1,2],[0,0,0,0]]);
... | true |
1e72c9bdd8b9278e964611762f8eefa3850d224f | Python | pythonwithalex/exercises | /merge_two_sorted_lists.py | UTF-8 | 1,568 | 4.15625 | 4 | [] | no_license | # write a function that takes two sorted lists and merges them into a single sorted list
def merge(list_a,list_b):
merged_list = []
# reversed the lists so i can use the pop value
a_index, b_index = len(list_a)-1,len(list_b)-1
while True:
if not list_a:
# remembering... | true |
fe3874872c2cf3c93d1132f5a1a695c2a01a4a6b | Python | Sens3ii/PP2-2020 | /!Less/!LES5.0/5les13.py | UTF-8 | 124 | 3.1875 | 3 | [] | no_license | import re
text = '12 asdf23 asdf34asdf'
result = re.finditer('d+', text)
for r in result:
print(r.start(),r.end())
| true |
9a4a3ac8bbb38a84b84ebd91f88e4bb28fce738e | Python | LipeiranNJU/ML2020-PS1 | /Problem2.py | UTF-8 | 2,172 | 2.984375 | 3 | [] | no_license | from matplotlib import pyplot as plt
import pandas as pd
dataset = pd.read_csv("./data.csv")
Pre = list()
Rec = list()
TPR = list()
FPR = list()
for i in range(len(dataset)):
bar = dataset.loc[i, 'output']
dataset['Prediction'] = dataset.apply(lambda x: 1 if x['output'] >= bar else 0, axis=1)
dataset['Type... | true |
6326d22ea2a31e52ecc5da54e4bcbe5ac25c5f02 | Python | youthliuxi/old_code_learn_mnist | /mnist_web/mnist/regression.py | UTF-8 | 1,156 | 2.640625 | 3 | [] | no_license | # regression 回归
import os
import input_data
import tensorflow as tf
import model
data = input_data.read_data_sets('MNIST_data', one_hot = True)
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
# create model
with tf.variable_scope("regression"):
x = tf.placeholder(tf.float32, [None, 784])
y, variables = model.r... | true |
7d29e28e0c32aa1a0bc9e627ead0933d480d14c3 | Python | dalerxli/montecarloneuralnetwork | /Pytorch Model/util/loss.py | UTF-8 | 858 | 2.578125 | 3 | [
"MIT"
] | permissive | import torch
#
# def l2normPointsLoss(outputs=torch.tensor([]), points=torch.tensor([]), valid=torch.tensor([])):
# distance = torch.sub(outputs, points)
# distance = distance.pow(2)
# number_valid_joints = torch.sum(valid,dim = 1) / 2
# temp = torch.sum(distance * valid, dim=1)
# distance = torch.... | true |
86c1fbe4e0516651b42aff3ef0de64491dc16a46 | Python | nekapoor7/Python-and-Django | /IMP_CONCEPTS/Regex/find_alldigits.py | UTF-8 | 213 | 3.984375 | 4 | [] | no_license | """Find all the numbers in a string using regular expression in Python"""
import re
def solution(A):
number = re.findall(r'[0-9]+',A)
res = " ".join(number)
return res
A = input()
print(solution(A)) | true |
7304d2e471d2f2dee98d36981dbbf29a92094e38 | Python | DebRC/My-Competitve-Programming-Solutions | /Codechef/CHEFSTR1.py | UTF-8 | 216 | 2.859375 | 3 | [] | no_license | # cook your dish here
for _ in range(int(input())):
n=int(input())
s=list(map(int, input().split()))
total=0
for i in range(1,n):
diff=s[i]-s[i-1]
total+=(abs(diff)-1)
print(total) | true |
2bb9860d50a5c3b17a803965f7fc0bc5c3811aa8 | Python | hang0522/AlgorithmQIUZHAO | /Week_06/homework/1122_relativeSortArray.py | UTF-8 | 875 | 3.515625 | 4 | [] | no_license | class Solution(object):
def relativeSortArray(self, arr1, arr2):
"""
:type arr1: List[int]
:type arr2: List[int]
:rtype: List[int]
"""
#solution1
#return sorted(arr1, key=lambda x: (0, arr2.index(x)) if x in arr2 else (1, x))
#第一个排序准则是x是否在arr2中,如果在则ke... | true |
8db84549907246120926bc70f9f9d62c5b5bce5b | Python | xhalo32/advpy | /rsc/games/game01/main.py | UTF-8 | 6,769 | 2.890625 | 3 | [] | no_license | import pygame as p
from random import *
from items import Items
from math import *
from balltypes import BallTypes
p.init( )
p.font.init( )
def msg( window, text, pos, color=( 255,255,255 ), size=25, bold=0, italic=0, centered=False ):
font = p.font.SysFont( 'Ubuntu Mono', size, bold, italic )
label = font.rende... | true |
d12f242d4733943aa88ccd3d859a6b9904653a4e | Python | iras/JADE | /src/tests/testSockets.py | UTF-8 | 7,701 | 2.578125 | 3 | [
"MIT"
] | permissive | '''
Copyright (c) 2012 Ivano Ras, ivano.ras@gmail.com
See the file license.txt for copying permission.
JADE mapping tool
'''
import unittest
import JADEmodel.Graph as gf
class TestSocket (unittest.TestCase):
def setUp (self):
self.test_graph = gf.Graph ()
self.test_graph.node_detail... | true |
8f29dc000957b370dc87c50fa20ecc8784fe6c0f | Python | yourouguaduan/raveutils | /src/raveutils/visual.py | UTF-8 | 4,244 | 3.109375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
import numpy as np
import openravepy as orpy
def draw_axes(env, transform, dist=0.03, linewidth=2):
"""
Draw an RGB set of axes into the OpenRAVE environment.
Parameters
----------
env: orpy.Environment
The OpenRAVE environment
transform: array_like
The homogeneous transform... | true |
71d99c19f7b8cf085429cce3004dcf9326b6c313 | Python | tientheshy/leetcode-solutions | /src/1306.jump-game-iii.py | UTF-8 | 572 | 2.84375 | 3 | [] | no_license | #
# @lc app=leetcode id=1306 lang=python3
#
# [1306] Jump Game III
#
# @lc code=start
# TAGS: BFS, DFS, Recursion
class Solution:
# 208 ms, 91.23%. Time and Space: O(N)
def canReach(self, arr: List[int], start: int) -> bool:
stack = [start]
visited = set()
while stack:
i = s... | true |
e359f6fda102ea1555520b773bad4d9dccf59004 | Python | Danyshman/Leetcode | /DailyTemperatues.py | UTF-8 | 263 | 3.3125 | 3 | [] | no_license | def dailyTemperatures(T):
st = []
ans = [0] * len(T)
for i in range(len(T)):
while st and T[st[-1]] < T[i]:
ans[st.pop()] = i - st[-1]
st.append(i)
return ans
print(dailyTemperatures([73, 74, 75, 71, 69, 72, 76, 73])) | true |
d70a67dd08b41e59713c9fa240f2d270f20caa96 | Python | m2march/ib_practica_6 | /ib.py | UTF-8 | 12,093 | 3.546875 | 4 | [] | no_license | #-*- coding: utf-8 -*-
"""
Modelo de inferencia exacta para redes bayesiana con eventos binarios.
Este módulo contiene clases para calcular probabilidades exactas en una red
bayesiana con eventos binarios. El módulo posee una clase principal que
representa cada nodo en la red y contiene la lógica para calcular
probabi... | true |
0cafb7d63e381a81acd6f73bc8754631d9f94064 | Python | gilbrookie/cmdr | /cmdr/application.py | UTF-8 | 11,648 | 3.234375 | 3 | [
"ISC"
] | permissive | # -*- coding: utf-8 -*-
"""
cmdr.application
~~~~~~~~~~~~~~~~~~
This module implements the main Cmdr class and supported functions.
"""
import readline
import logging
import sys
from cmdr import Command
logging.basicConfig(filename='/tmp/cmdr.log', level=logging.DEBUG,
format='%(asctime)s [%(le... | true |
e714f853a3d077385d09f622f40048938eb3b388 | Python | MichaelRol/EulerProject | /Problems 31-40/31-CoinSums.py | UTF-8 | 235 | 3.265625 | 3 | [] | no_license | coins = [1, 2, 5, 10, 20, 50, 100, 200]
numOfWays = 0
waysToMake = [0] * 201
waysToMake[0] = 1
for i in range(0, len(coins)):
for j in range(coins[i], 201):
waysToMake[j] += waysToMake[j - coins[i]]
print(waysToMake[200]) | true |
b80ad6e9760dde404af8036dfb8fec258b8b0cf1 | Python | kiwttir-irakihda/PanoJoiners | /src/PanoJoin.py | UTF-8 | 1,742 | 2.578125 | 3 | [] | no_license | import argparse
import cv2
from points_of_intersection import common_points, _debug_poi
from stitch_image import stitch_images
import numpy as np
_SIZE = (1000, 1000)
_aspect_ratio = 0.125
def _resize_im(img, shape):
identity_mat = np.float32([[1, 0, _SIZE[0]/4],[0, 1, _SIZE[1]/4]])
return cv2.warpAffine(img, iden... | true |
ed9c11ba85a9f7974014773de72e84e2b7a9b8f7 | Python | Arunhari333/XMeme | /backend/memes/views.py | UTF-8 | 2,452 | 2.53125 | 3 | [] | no_license | from django.shortcuts import render
from django.http import JsonResponse
from rest_framework.decorators import api_view
from rest_framework.response import Response
from .models import Meme
from .serializers import MemeSerializer, PartialMemeSerializer
from rest_framework.views import APIView
# The API base point lis... | true |
75a54dbd793c86390beecb3f1b5ad9d8870c2e50 | Python | krohak/Project_Euler | /LeetCode/Hard/Spiral Matrix/save2/sol.py | UTF-8 | 1,670 | 3.71875 | 4 | [] | no_license | class Solution:
def __init__(self):
self.count = 0
def spiralOrder(self, matrix):
self.m = len(matrix)
if not self.m:
return []
self.n = len(matrix[0])
if not self.n:
return []
answer = []
r... | true |
1a1298d75b8089f8158c18044a50f9b37f38a43d | Python | IUAD13YT/ip-russol-maksim-1 | /PyCharm/Home/h7/hw07_hard.py | UTF-8 | 2,907 | 3.671875 | 4 | [] | no_license | # Задание-1: Решите задачу (дублированную ниже):
# Дана ведомость расчета заработной платы (файл "data/workers").
# Рассчитайте зарплату всех работников, зная что они получат полный оклад,
# если отработают норму часов. Если же они отработали меньше нормы,
# то их ЗП уменьшается пропорционально, а за заждый час перера... | true |
d89bcc3e9e5fe6db4a876c3f20c0a287179e7cfc | Python | seekho123/gitbasics | /disease.py | UTF-8 | 847 | 3.546875 | 4 | [] | no_license | def positive_test(TP, FP, perc_population):
'''
Parameters
----------
TP: {float} true positive
percentage of tests that were positive
for the sample of subjects that had the disease
FP: {float} false positive
percentage of tests that were positive
for the control pop... | true |