blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a5538a51d2b55f585e3acdf24a637d8264c469e1 | Python | dosatos/LeetCode | /Easy/twoSum.py | UTF-8 | 550 | 3.59375 | 4 | [] | no_license | class Solution:
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
storage = {} # where I will save difference and position; space complexity O(N)
for idx, num in enumerate(nums): # time complexity O(N)
... | true |
8f4feafddb3110d4e3934b48a0b4fbabd95f1e46 | Python | countrymarmot/deca_tech | /onyx/pyrite/test/ui/test_DesignView.py | UTF-8 | 2,240 | 2.8125 | 3 | [] | no_license | # test_DesignView.py
# Created by Craig Bishop on 18 July 2012
#
# pyrite
# Copyright 2012 All Rights Reserved
#
import unittest
from pyrite.malachite.Design import DesignObject, Design, Package, Die
from pyrite.DesignView import DesignView, DesignObjectGraphicsItem,\
PackageGraphicsItem, DieGraphicsItem
from pyrite... | true |
7f4174b7db497517339708e98a46f6fa71cc2a34 | Python | mhorban/smart_house | /smart_house/tests/test_rule_parser.py | UTF-8 | 2,130 | 3.3125 | 3 | [] | no_license | import unittest
from smart_house import parser
class TestRuleParser(unittest.TestCase):
def test_calculations(self):
def test(s, expVal, get_sensor_value_func=lambda x: 1000):
rule_parser = parser.RuleParser(get_sensor_value_func)
val = rule_parser.compute(s)
if val =... | true |
6eda69eb8503d285350ae3c1ceb85b7ff9364b5b | Python | himanshu0137/codechef | /FLOW017.py | UTF-8 | 285 | 3.046875 | 3 | [] | no_license | from sys import stdin,stdout
t = int(stdin.readline())
for _ in xrange(t):
a,b,c = map(int,stdin.readline().split())
if a < b < c or c < b < a:
stdout.write(str(b)+"\n")
if c < a < b or b < a < c:
stdout.write(str(a)+"\n")
if a < c < b or b < c < a:
stdout.write(str(c)+"\n") | true |
470af244cfd93198020f1b51a0449f1af1a58779 | Python | kangsm0903/Algorithm | /CodeUp/C_6089.py | UTF-8 | 111 | 2.625 | 3 | [] | no_license | from re import A
a,b,c=input().split(" ")
a=int(a)
b=int(b)
c=int(c)
for i in range(1,c):
a=a*b
print(a) | true |
3d96079b26923ca85f829a65c6015de362efd589 | Python | rjuchnicki/adventofcode2015 | /day02/day02-2.py | UTF-8 | 256 | 2.953125 | 3 | [] | no_license | f = open('day02.txt', 'r')
dim_strings = [x.strip('\n') for x in f.readlines()]
f.close()
total = 0
for d in dim_strings:
dims = [int(i) for i in d.split('x')]
dims.sort()
total += 2*dims[0] + 2*dims[1] + dims[0]*dims[1]*dims[2]
print(total)
| true |
5370db4fa09250f6b8af14afd8dccb5ebed11f50 | Python | precariouspanther/neuroevolution-snake | /save.py | UTF-8 | 423 | 2.875 | 3 | [] | no_license | import os
import pickle
class SaveState(object):
def __init__(self, path):
self.path = path
def save(self, data):
with open(self.path, 'wb') as handle:
pickle.dump(data, handle, protocol=pickle.HIGHEST_PROTOCOL)
def open(self):
with open(self.path, 'rb') as handle:
... | true |
f114901345491cda5b82c506840857b17268076a | Python | marcio-pg/Code-Abbey | /Problem 26 - Greatest Common Divisor.py | UTF-8 | 1,245 | 4.1875 | 4 | [] | no_license | # Problem #26 - Greatest Common Divisor http://www.codeabbey.com/index/task_view/greatest-common-divisor
# Submission by MPadilla - 20/Jul/2015
def GCD(x,y):
global gdiv
while x and y: #Mientras que x y y sean diferentes de cero, el numero mayor se le sacaro el modulo respecto al menor y el resultado se a... | true |
f9bc9d59fe135281f953d9f85884507f4c82d74b | Python | ryanfrigo/Pascal-s-Triangle | /pascal.py | UTF-8 | 1,777 | 4.4375 | 4 | [] | no_license | # Pascal's Triangle
# In mathematics, Pascal's triangle is a triangular array of the binomial coefficients.
# In much of the Western world, it is named after the French mathematician Blaise Pascal,
# although other mathematicians studied it centuries before him in India,[1] Persia (Iran)[2],
# China, Germany, and It... | true |
0f83bf364c8abd3a23a43b6bee67b733f53d68a7 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_1/399.py | UTF-8 | 907 | 2.84375 | 3 | [] | no_license | import math
def getcost2 (es,qs):
oks=[]
for e in es:
i=0
for q in qs:
if q == e:
break
i=i+1
oks.append(i)
return oks
def getcost (es,qs):
c=0
i=0
while len(qs) >... | true |
8bdeb24534451ac2ae7c9cd33599e6adefaa2d61 | Python | cdknox/glmpy | /glmpy/families.py | UTF-8 | 1,553 | 2.65625 | 3 | [] | no_license | import numpy as np
from scipy import stats
import glmpy.links
class Poisson:
allowed_links = [
glmpy.links.LogLink,
glmpy.links.IdentityLink,
glmpy.links.SqrtLink,
]
def variance(self, mu):
return mu
def valid_mu(self, mu):
return np.isfinite(mu) & (mu > 0)
... | true |
81e07bb792e0374f02a4a01289ce595af8b1bf31 | Python | savchukndr/temp-C | /zapis.py | UTF-8 | 291 | 2.90625 | 3 | [] | no_license | L = [['olya','deva','sava'], [4,5,6], [7,8,9]]
file = open(r'C:\temp\matrix.txt', 'w')
for i in L:
file.write('| ')
for j in i:
j = str(j)
file.write(j + ' ')
file.write('|')
file.write('\n')
file.close()
file1 = open(r'C:\temp\matrix.txt')
f = file1.read()
print(f)
file1.close() | true |
1f99839617161490865c3368ec5a7dbf781aed9a | Python | megalai1234/py | /a.py | UTF-8 | 175 | 3.28125 | 3 | [] | no_license | def Series(n):
sums = 0.0
for i in range(1, n + 1):
ser = 1 / (i**i)
sums += ser
return sums
n = 3
res = round(Series(n), 5)
print(res)
| true |
a240ced47bedd188b472618a120bff57c1900b7e | Python | CodingDojoOnline-Nov2016/TJGullo- | /Python/oddeven.py | UTF-8 | 165 | 4.09375 | 4 | [] | no_license | #Odd even
for i in range(1,2001):
if(i % 2 == 0):
print "The number", i, "is an even number"
else:
print "The number", i, "is an odd number"
| true |
e56813366ab676a189bd7f3e228a8cf3ac1b03b4 | Python | kapkaevandrey/Course-of-Corusera | /Web/week2/soup/wikistats.py | UTF-8 | 2,693 | 3.28125 | 3 | [] | no_license | from bs4 import BeautifulSoup
import unittest
def count_image(body: object, width: int = 200):
images = body.find_all('img')
counter = 0
for image in images:
if image.has_attr("width") and int(image["width"]) >= width:
counter += 1
return counter
def count_tag(body: ... | true |
2a88ad6ea410c0a9a52f17e660f3be04f6a7eaae | Python | yvan674/CurbNet | /src/utils/copier.py | UTF-8 | 3,297 | 3.578125 | 4 | [
"MIT"
] | permissive | """Copier.
Copies n files from one mapillary subdirectory to another directory.
Authors:
Yvan Satyawan <y_satyawan@hotmail.com>
"""
import shutil
import os
import argparse
import random
import warnings
def parse_args():
description = "copies n files from one directory to another directory"
parser = argp... | true |
a0de57775585f05f61f352ddd32768d2880ee918 | Python | richo/groundstation | /test/test_ue_encoder.py | UTF-8 | 1,923 | 2.890625 | 3 | [
"MIT"
] | permissive | import unittest
import random
from groundstation.ue_encoder import UnambiguousEncoder
class TestUnambiguousEncapsulation(unittest.TestCase):
test_bytes = [0b01010101, 0b11110000]
test_message = [31, 54, 31, 54, 31, 54, 31, 54, 54, 54, 54, 54, 31, 31, 31, 31]
test_header = [41, 0, 41, 0, 41, 0, 41, 0, 0, 0... | true |
905c13855c6c3217fec26ca9e73f2d1eba587ffb | Python | wani-hackase/wanictf2021-writeup | /cry/fox/solver/solve.py | UTF-8 | 192 | 3.296875 | 3 | [
"MIT"
] | permissive | with open("output.txt") as f:
X = int(f.read())
def int_to_bytes(X):
B = []
while X > 0:
B = [X & 0xFF] + B
X >>= 8
return bytes(B)
print(int_to_bytes(X))
| true |
404fbb6e720f8abcd620d41418d8480ff917978b | Python | shaokangtan/python_sandbox | /peak_valley.py | UTF-8 | 1,284 | 3.78125 | 4 | [] | no_license | #sort the random number into valley and peak pattern
def peak_valley(arr):
flag = 0 # 0 valley else peak
for i in range(len(arr)-1) :
if flag == 0:
if arr[i]>arr[i+1]:
arr[i], arr[i+1] = arr[i+1],arr[i]
else:
if arr[i]<arr[i+1]:
... | true |
78bfa8613fd6572c2d2c2028d20de837540e98e2 | Python | zachwooddoughty/summarize | /tf_idf.py | UTF-8 | 4,236 | 3.046875 | 3 | [] | no_license | from tokenization import tokenize
from nltk.stem import LancasterStemmer
from nltk.corpus import stopwords
import operator, math
import sys, os
import string
import pickle
class TFIDF:
def __init__(self):
self.pickle_docs = "tfidf_pickle_docs"
self.pickle_corpus = "tfidf_pickle_corpus"
sel... | true |
a0115efc2eaaa4ffa904c79b51493f13933d487a | Python | Adasumizox/ProgrammingChallenges | /codewars/Python/5 kyu/WeightForWeight/order_weight.py | UTF-8 | 114 | 2.59375 | 3 | [] | no_license | def order_weight(_str):
return ' '.join(sorted(sorted(_str.split(' ')), key=lambda x: sum(int(c) for c in x))) | true |
3c5875aaa8fe0c94642faf2dcf25ff310032d60f | Python | OldSecureIQLab/htmlmth | /htmlmth/mods/http/chunked.py | UTF-8 | 1,133 | 2.8125 | 3 | [
"MIT"
] | permissive | import random
def _chunk_data(data, min_chunk_size=None, max_chunk_size=None, leadingzeros=0):
dl = len(data)
if max_chunk_size is None:
max_chunk_size = dl
chunk_sizes = []
while dl > 0:
max_chunk_size = min(dl, max_chunk_size)
if dl <= min_chunk_size:
min_chunk_siz... | true |
816a73f46453d6c1176c26a364e2987fe9a916c6 | Python | cs16s027/PR | /assignment-4/handwriting/scripts/string_hmms.py | UTF-8 | 1,576 | 2.765625 | 3 | [] | no_license | import itertools
labels = ['bA', 'dA', 'lA']
for length in [2, 3, 4, 5]:
hmm_strings = [p for p in itertools.product(labels, repeat = length)]
for string in hmm_strings:
hmms = []
states = 0
symbols = 0
for index, char in enumerate(string):
hmm = [line.strip() ... | true |
0b3e7ba9a06816c26d00eb73882c419a0a65c9be | Python | tomchiu19/tourPlanner | /code/04-find-lodging.py | UTF-8 | 4,448 | 3.34375 | 3 | [] | no_license | import sys
import pandas as pd
import numpy as np
import math
import random
#adapted from: https://stackoverflow.com/questions/25767596/vectorised-haversine-formula-with-a-pandas-dataframe
def haversine(point1, point2):
lat1 = point1[0]
lon1 = point1[1]
lat2 = point2[0]
lon2 = point2[1]
lon1, lat1... | true |
74255f65efbf33dbe52e34fabb4e9543c2d33cc1 | Python | thanachote12367/TCP | /client_image.py | UTF-8 | 578 | 2.765625 | 3 | [] | no_license | import socket
name = "1"
address = ("127.0.0.1", 4000)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(address)
# name = (raw_input("enter your filename"))
path = "02.jpg"
while True:
# data, addr = s.accept()
# print addr
if name == "1":
print name
f = open(path... | true |
067981fb9ec1cd49a24fd33bb73a53761e8edbcd | Python | SeattleTestbed/attic | /branches/repy_v2/shims/asciishiftingshim.repy | UTF-8 | 1,077 | 2.875 | 3 | [
"MIT"
] | permissive | #!python
"""
<Program Name>
asciishiftingshim.repy
<Author>
Danny Y. Huang, yh1@cs.williams.edu
<Date Started>
April 16, 2011
<Purpose>
A shim that shifts the ascii values of TCP streams by one. Used for testing
or encrypting simple data.
"""
class AsciiShiftingShim(BaseShim):
def _shift_ascii(self,... | true |
fdd19a3168e6f4fae2cc1863939cdcc9d4bc7896 | Python | regnart-tech-club/programming-concepts | /course-1:basic-building-blocks/subject-3:integers/lesson-3.2:Fibonacci Closed.py | UTF-8 | 1,112 | 4.53125 | 5 | [
"Apache-2.0"
] | permissive | # The Fibonacci Sequence is a series of integers
# that start with 0, 1
# then the next integer is the sum of the previous two.
# The first seven integers in the series is 0, 1, 1, 2, 3, 5, 8.
# Write a program using variables and integer operators
# that will print the first 12 integers in the series.
square_root_of_... | true |
73730c97bc1009b29f7b721e019964a738f4a6c8 | Python | danlionis/isc_pricelist | /pricegenerator.py | UTF-8 | 3,569 | 3.046875 | 3 | [] | no_license | import tkinter as tk
from tkinter.filedialog import askopenfilename, askdirectory
from tkinter import messagebox
from pricelist import generate_pricelist
import os
PRICELIST = 0
MARKETSHARE = 1
OUTPUT = 2
class App(tk.Frame):
def __init__(self, parent, *args, **kwargs):
tk.Frame.__init__(self, parent, *ar... | true |
1be16d3dbb3d8f9aa05a24eb6c8f7fe39c8b09e1 | Python | twsswt/theatre_ag | /tests/test_actor.py | UTF-8 | 3,538 | 2.703125 | 3 | [] | no_license | from unittest import TestCase
from theatre_ag import TaskQueueActor, Idling, SynchronizingClock, default_cost
class ExampleWorkflow(object):
is_workflow = True
def __init__(self, idling):
self.idling = idling
@default_cost(1)
def task_a(self):
self.task_b()
@de... | true |
911370e3188b3d6e3924d2c6c9997c764bfbc4c9 | Python | kreciki/proxy | /python代理服务器验证(requests版).py | UTF-8 | 3,522 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | #python3.7.6 Win7
import os
import requests
#import requests.exceptions
# 打开文件,分割、去重
with open("f:\ip_1.txt","r") as f: #用with open,可以不用.close()关闭
ip_list=f.read().split("\n") #效果和f.read().splitlines()一样,生成一个列表
#ip_list=f.read().splitlines() 另外一种写法
print(ip_list)
print("共计",len(ip_list),"个IP") #列... | true |
3bbeade66562fdd1fc472b7bb7dc7161fb4a9da3 | Python | samkit5495/dsmp-pre-work | /Probability-of-the-Loan-Defaulters/code.py | UTF-8 | 1,097 | 3.046875 | 3 | [
"MIT"
] | permissive | # --------------
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# code starts here
df = pd.read_csv(path)
p_a = len(df[df.fico>700])/len(df)
p_b = len(df[df.purpose == 'debt_consolidation'])/len(df)
df1 = df[df.purpose == 'debt_consolidation']
p_a_b = len(df1[df1.fico>700])/len(df)
result = p... | true |
3d5227d5cea9ad3ed53811d981a050e1586ed6a5 | Python | jcmloiacono/Api | /Api12_crear_repositorio.py | UTF-8 | 663 | 2.578125 | 3 | [] | no_license | import requests
# en este momento seguro no funcionara porque Github cambia el access token, hay que obtener el nuevo acess token
if __name__ == '__main__':
client_id = #buscar en archivo
client_secret = #buscar en archivo
code = #buscar en archivo
access_token = #buscar en archivo
url = 'ht... | true |
38ba649426126fbe72d5282b5fcfb7b8b517781b | Python | yongduek/cvip | /python/image-open-load.py | UTF-8 | 678 | 3.09375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import cv2 as cv
filename = 'data/img536.jpg'
# using imageio
import imageio
imio = imageio.imread (filename)
print ('imageio.imread(): ', type(imio), ' a subclass of np.ndarray')
print ('meta: ', imio.meta)
print ('numpy array can be obtained through ')
plt.imshow... | true |
7e852e4b441eae433f5b095710e63533ee27c521 | Python | ClodaghMurphy/dataRepresentation | /Week6/lab06.03.01-githubbymodule.py | UTF-8 | 1,033 | 2.578125 | 3 | [
"MIT"
] | permissive | # to use this install package
#ModuleNotFoundError: No module named 'github'
# pip install PyGithub
from github import Github
import requests
# remove the minus sign from the key
# you can add this to your code just don't commit it
# or use an API key to your own repo
g = Github("7aa146eafee094d3a7b1e81aa1d8fcb0eec8b9... | true |
e9dc65bc3f9ac3da1edfd6e51d59149c65de87b7 | Python | sssssshf/python_developer_tools | /python_developer_tools/python/threadings/threading_utils2.py | UTF-8 | 717 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | # !/usr/bin/env python
# -- coding: utf-8 --
# @Author zengxiaohui
# Datatime:7/30/2021 8:51 AM
# @File:threading_utils
import threading
class ProcessThread1(threading.Thread):
def __init__(self, idx,out_img):
threading.Thread.__init__(self)
self.idx = idx
self.out_img=out_img
def pre... | true |
b00381baf650d3566ca7df56a1cc0ca057deba0e | Python | orwinmc/google_code_jam | /2010/qualification/B-Fair_Warning/google_solution/b.py | UTF-8 | 530 | 3.203125 | 3 | [] | no_license | import functools
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def solve(L):
y = L[0]
L1 = [abs(x - y) for x in L]
g = functools.reduce(gcd, L1)
if y % g == 0:
return 0
else:
return g - (y % g)
if __name__ == '__main__':
with open('B-small-practice.in.txt', 'r') as fin:
... | true |
59165d9fd9e8cfecf1b1555e74315eba1afd62bb | Python | epord/UPC | /CDI/CDI_practicas/practicas/practica1_1.py | UTF-8 | 3,447 | 3.859375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import random
print("== START 1.1 ==")
'''
0. Dada una codificación R, construir un diccionario para codificar m2c y otro para decodificar c2m
'''
R = [('a','0'), ('b','11'), ('c','100'), ('d','1010'), ('e','1011')]
# encoding dictionary
m2c = dict(R)
# decoding dictionary
c2m = dict([(c,m)... | true |
96db6e67fbd331fb5fcabfe0906f2e9cddc2674a | Python | EsKay-tech/pre-bootcamp-coding-challenges | /task10.py | UTF-8 | 180 | 3.40625 | 3 | [] | no_license | def print_vowel(word):
for vowel in word:
if vowel in 'aeiou':
print(vowel)
elif vowel in 'AEIOU':
print(vowel)
print_vowel("Umuzi")
| true |
0049a0c0695ba9d450673e0e64bb005d9a105349 | Python | FrankPeelen/Kaggle_Titanic | /preprocess.py | UTF-8 | 291 | 3.171875 | 3 | [] | no_license | import pandas
import numpy as np
def normalize(column):
return (column - column.mean()) / (column.max() - column.min())
def genderToBinary(column):
column[column == "male"] = 0
column[column == "female"] = 1
return column
def fillAgeGaps(column):
return column.fillna(column.mean())
| true |
619eb7ca97106bb60933e2cbc6e7de099608ff2f | Python | juanDango/Redes_Taller3_1 | /Servidor/ClientHandler.py | UTF-8 | 4,393 | 2.65625 | 3 | [] | no_license | import socket
from threading import Thread
from socketserver import ThreadingMixIn
import struct
import datetime
import os
import hashlib
import sys
BUFFER_SIZE = 1024
BEG_RECV = b'BEG_RECV'
OK = b'OK'
ERR = b'ERR'
END_TRANSMISSION = b'END_TRANSMISSION'
FIN = b'FIN'
class ClientHandler(Thread):
def __init__(self,... | true |
fa3a738d4a47131b0093b9c2094b8071747c7832 | Python | cheol-95/Algorithm | /Python/016. 라면공장/Lamen Factory.py | UTF-8 | 734 | 3.296875 | 3 | [] | no_license | import heapq
def solution(stock, dates, supplies, k):
answer = 0
idx = 0
pq = []
while stock < k:
for i in range(idx, len(dates)):
if stock < dates[i]:
break
heapq.heappush(pq, -supplies[i])
idx = i+1
stock += (heapq.heappop(pq) * -1)
... | true |
e1aa26a61d4e949e8586f41a130fd459679af5cb | Python | gogqou/Rosalind | /Rosalind_solutions/counting_DNA.py | UTF-8 | 643 | 3.40625 | 3 | [] | no_license | '''
Created on May 4, 2015
@author: gogqou
'''
import sys
def count(input):
alphabet_dictionary = {}
for i in range(len(input)):
if input[i] in alphabet_dictionary.keys():
alphabet_dictionary[input[i]]=alphabet_dictionary[input[i]] +1
else:
alphabet_dictionary[input[i]]... | true |
75c1e059dc7a4a9eb6075c65e4f1e89445ce2fd8 | Python | HrvojeVrhovski/Predavanje11 | /brojevi.py | UTF-8 | 1,414 | 3.390625 | 3 | [] | no_license | import random
import datetime
import json
current_time = datetime.datetime.now()
secret = random.randint(1, 30)
attempts = 0
wrong = []
ime=input("Unesi svoje ime: ")
with open("score_list.json", "r") as score_file:
score_list = json.loads(score_file.read())
new_score_list = sorted(score_list, key=lambda k: k['a... | true |
f5e7f7916702e77e109f5f0665ddf160cd04b11a | Python | mayankagg2001/OpencvPrograms | /opencv-basic7.py | UTF-8 | 933 | 2.734375 | 3 | [] | no_license | # Object detection in open cv (Detected soccer ball in the image)
import cv2
import random
import numpy as np
img = cv2.imread("soccer_practice.jpg",0)
img = cv2.resize(img,(0,0),fx=0.8,fy=0.8) #template size must be equal to image size
template = cv2.imread("shoe.png",0)
template = cv2.resize(template,(... | true |
2cdbd5caf67ddca7a12a96a1f155e83ed3a83d7f | Python | XelekGakure/Tennis-Refactoring-Kata | /python/__main__.py | UTF-8 | 345 | 2.828125 | 3 | [
"MIT"
] | permissive | from Entity.Player import Player
from Entity.TennisGame import TennisGame
import sys
from Tests import tennis_unittest
player1 = Player("Jean-Pierre")
player2 = Player("Stephane")
party = TennisGame(player1, player2)
print(party.score())
party.won_point(player1)
print("P1", player1.score)
print("P2", player2.sco... | true |
1cfbca78261c94831b5ad8cf8314c8495f766dd8 | Python | cinatic/jsons | /tests/test_union.py | UTF-8 | 771 | 2.90625 | 3 | [
"MIT"
] | permissive | import datetime
from typing import Optional, Union
from unittest import TestCase
import jsons
from jsons import DeserializationError
class TestUnion(TestCase):
def test_load_union(self):
class A:
def __init__(self, x):
self.x = x
class B:
def __init__(self,... | true |
ecd0dbb3b85154e52f6cfc5932c871c7308cc4a6 | Python | deepaknalore/MachineLearning-CS760 | /Utils/ParseStats.py | UTF-8 | 566 | 2.96875 | 3 | [] | no_license | inputFile = open("stats.log", "r")
lines = inputFile.readlines()
readLatency = 0
count = 0
successfulReads = 0
#updateLatency = 0
for line in lines:
if line.startswith("Read Latency :"):
readLatency += float(line.split(":")[1].strip())
count += 1
elif line.startswith("The number of successful ... | true |
dfcbda8e47f6a979da846827c1cbe6fee6cda4f5 | Python | pik4ez/dgrab | /parsers/discogs/album.py | UTF-8 | 2,890 | 3.046875 | 3 | [] | no_license | import re
from bs4 import BeautifulSoup
from parsers.abstract_parser import AbstractParser
class DiscogsAlbumParser(AbstractParser):
def parse(self, data):
album = {}
soup = BeautifulSoup(data, 'html.parser')
# Extract artist, title and year.
album['artist'] = soup\
.f... | true |
cde67646b3e3f1997b6fd2b7ea5767a7986e0f1f | Python | Adarsh1193/Python-Udemy-Course | /Functions and Modules/Returing vaule from function.py | UTF-8 | 83 | 3.484375 | 3 | [] | no_license | def add(a, b):
c = a + b
return c
result = add (10, 20)
print(result) | true |
76421e43ac53bce0f94783e5a14bb33227460a29 | Python | taitujing123/my_leetcode | /009_isPalindrome.py | UTF-8 | 656 | 4.0625 | 4 | [] | no_license | """
判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。
"""
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
ls = 0
tmp = x
while tmp != 0:
tmp = tmp // 10
ls... | true |
9a4a61846442fa552a429c27c9c434a43c860ca1 | Python | brookisme/sublr | /sublr/utils.py | UTF-8 | 119 | 2.578125 | 3 | [] | no_license | #
# HELPERS
#
def log(msg,noisy,level='INFO'):
if noisy:
print("[{}] SUBLIME-REMOTE: {}".format(level,msg)) | true |
0735d006c300c4c770a43085f93af1a02d621a28 | Python | AaronTengDeChuan/leetcode | /leetcode/126.word_ladder_II_Bfs+Dfs.py | UTF-8 | 1,863 | 3.140625 | 3 | [] | no_license | #usr/bin/env python
import sys
class Solution(object):
def generatePaths(self, dict, beginWord, endWord, results, result):
if beginWord == endWord:
results.append(result)
if beginWord not in dict:
return
for cur in dict[beginWord]:
self.generatePaths(dic... | true |
ba392ddf28a697880ecfee0958bd2ecc5aef7715 | Python | abhaysantra/django-test | /django_project/blog/views.py | UTF-8 | 722 | 2.640625 | 3 | [] | no_license | from django.shortcuts import render
from django.http import HttpResponse
# let pass some dummy data from views to template
posts = [
{
'author': 'Corey',
'title': 'Blog Post1',
'date_posted': 'August 27,2019'
},
{
'author': 'Jone',
'title': 'Blog Post2',
'date_posted': 'August 31,2019'
},
{
'author': '... | true |
49571d8d088c8bbabfc8ded203b4fd2dd4fc3061 | Python | DanielVitas/projektna-naloga-UVP | /main_game/action.py | UTF-8 | 579 | 2.796875 | 3 | [] | no_license | import time
class Action(object):
def __init__(self, fun, args, cooldown, condition):
self.fun = fun
self.args = args
self.cooldown = cooldown
self.last_check = 0
self.condition = condition
def run(self):
if self.condition():
if time... | true |
b7647cddeaa42a1bea0e1d62b66793ed41f5a118 | Python | dtpaltz/Python-Practice | /GUI-Learning/window3.py | UTF-8 | 396 | 2.859375 | 3 | [] | no_license | from tkinter import *
root = Tk()
label_1 = Label(root, text="Name")
entry_1 = Entry(root)
label_2 = Label(root, text="Password")
entry_2 = Entry(root)
label_1.grid(row=0, column=0, sticky=E)
label_2.grid(row=1, column=0, sticky=E)
entry_1.grid(row=0, column=1)
entry_2.grid(row=1, column=1)
cbox = Checkbutton(root... | true |
27ad3850a60e1e669468eb7c10718b87df1cc5f8 | Python | nhichan/hachaubaonhi-fundamental-c4e16 | /session2/bài tập/draw1.py | UTF-8 | 226 | 3.03125 | 3 | [] | no_license | from turtle import*
shape('triangle')
for i in range(3,7):
if i%2==0:
color('red')
else:
color('blue')
for j in range(i):
forward(80)
left(360/(i))
mainloop()
print(range(3,5,1))
| true |
f50d64753a0a6253a4e8a54d8c404ffe11b69b9c | Python | liudefang/14_day_training_camp | /Python全栈开发中级/第四模块/第八章-数据库开发/05 pymysql 模块/获取最后一条数据的id.py | UTF-8 | 500 | 2.515625 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
# @Time : 2018-07-22 11:36
# @Author : mike.liu
# @File : 获取最后一条数据的id.py
import pymysql
# 链接
conn = pymysql.connect(host='192.168.159.128', user='root', password='pertest', database='luffycity', charset='utf8')
# 游标
cursor = conn.cursor()
sql = 'insert into userinfo(name, password) ... | true |
9c6da95d8025f5f1d5c8a55890c9eb914253fa89 | Python | alexandraback/datacollection | /solutions_5708284669460480_0/Python/YOBA/02.py | UTF-8 | 676 | 3.109375 | 3 | [] | no_license | import itertools
import functools
import statistics
def occurrences(sub, string):
count = start = 0
while True:
start = string.find(sub, start) + 1
if start > 0:
count += 1
else:
return count
for case in range(int(input())):
k, l, s = map(int, str.spli... | true |
d1038802e84f9128740bf2866e16a64592ef79a1 | Python | Tanmay53/cohort_3 | /submissions/sm_010_dipanshu/week_16/day_2/session_1/Backend/server.py | UTF-8 | 7,273 | 2.75 | 3 | [] | no_license | from flask import Flask, request, json
import os
import csv
import math
app = Flask(__name__)
def file_exist_check():
if os.path.exists("data/user_data.csv"):
return 1
else:
return 0
def get_all_users():
csvfile = open("data/user_data.csv", "r")
reader = csv.DictReader(csvfile, deli... | true |
d297ff33390ba38a1bfd93997a6dadbc158d3ab8 | Python | blaq-swan/alx-higher_level_programming | /0x0B-python-input_output/11-student.py | UTF-8 | 660 | 3.484375 | 3 | [] | no_license | #!/usr/bin/python3
"""module 9"""
class Student:
"""class Student"""
def __init__(self, first_name, last_name, age):
"""constructor"""
self.first_name = first_name
self.last_name = last_name
self.age = age
def to_json(self, attrs=None):
"""namespace for cls Stude... | true |
170cfe1965f4749d425839d133da68e66a9950df | Python | Beautyi/PythonPractice | /Chapter4-Practice/test_4.5.3.py | UTF-8 | 194 | 3.15625 | 3 | [] | no_license | dimensions = (200, 50)
for dimension in dimensions:
print(dimension)
dimensions = (100, 150)#不可以修改元素,但可以改变赋值
for dimension in dimensions:
print(dimension)
| true |
50d6cb146247ec1ce60074d12c5162d578f35764 | Python | G00398275/pands-project | /heatmap.py | UTF-8 | 1,088 | 3.46875 | 3 | [] | no_license | # Programming and Scripting 2021 Project: Fisher's Iris Data Set; heatmap.py
# Lecturer: Andrew Beatty
# Author: Ross Downey
# Ref https://heartbeat.fritz.ai/seaborn-heatmaps-13-ways-to-customize-correlation-matrix-visualizations-f1c49c816f07
# Ref https://seaborn.pydata.org/generated/seaborn.heatmap.html
# Ref https:... | true |
2c22097c22015cb38e716eb79bd019920d6eadc2 | Python | actively-lazy/infosys-foundation-program-5.0 | /module 1/section 3/triangle.py | UTF-8 | 143 | 3.78125 | 4 | [] | no_license | print("Enter values for triangle")
base = int(input("base: "))
height = int(input("height: "))
area = 0.5 * base * height
print("area = ",area) | true |
545e644d4ad998f0b91c37c00ca9892bc9be6bf4 | Python | danielteferadeti/A2SV | /Lab Practice/Topological Sorting/Course Schedule.py | UTF-8 | 1,134 | 2.984375 | 3 | [] | no_license | class Solution:
def dfs(self,i: int, prerequisites: List[List[int]],adjList: dict(), visited: set()) -> bool:
if i not in visited:
visited.add(i)
else:
return False
if len(adjList[i]) == 0:
visited.remove(i)
return True
... | true |
939b83ba044fb24f6a1e0ac7900abe231e1bba73 | Python | aasparks/cryptopals-py-rkt | /cryptopals-py/set5/c35.py | UTF-8 | 6,115 | 3.203125 | 3 | [] | no_license | """
**Challenge 35**
*Implement DH with Negotiated Groups, and Break with Malicious 'g' Parameters*
::
A->B
Send p,g
B->A
Send ACK
A->B
Send A
B->A
Send B
A->B
Send encrypted-message
B->A
Echo
Do the MITM attack again, but play with 'g'.
What h... | true |
14bd7bcf99a89a8cc30bfd7953c0b6829b418fec | Python | ferdous313/lima | /compiler/contact.py | UTF-8 | 5,929 | 2.625 | 3 | [] | no_license | import design
import debug
from tech import drc
from vector import vector
class contact(design.design):
"""
Object for a contact shape with its conductor enclosures
Creates a contact array minimum active or poly enclosure and metal1 enclosure.
This class has enclosure on multiple sides of the contact w... | true |
9fef956ada846adca145f13eb97769e8a340d2e0 | Python | eroelke/RADIuS | /tools/get_atm_dat.py | UTF-8 | 1,184 | 2.703125 | 3 | [] | no_license | # get_atm_dat.py
# obtain atmospheric data from planet data given altitude
#
# Inputs:
# p: planet input data structure
# h: altitude
#
# Outputs:
# rho: atmospheric density (kg/m3)
# pressure: atmospheric pressure (Pa)
# T: atmospheric temperature (K)
# winds: wind speeds (East, North, Up) (m/s)
#
import numpy as np... | true |
f36726282d872b07bc09b6516e6cc1747bf8c4c8 | Python | manimanis/3T_2021 | /assets/progs/roles_game.py | UTF-8 | 2,736 | 4.375 | 4 | [] | no_license | def choose_option(question, choice1, choice2):
while True:
print(question)
print("0: Return back")
print(f"1: {choice1}")
print(f"2: {choice2}")
choice = input("Your choice ? ")
if choice in ['0', '1', '2']:
return choice
print('Wrong choice!')
... | true |
a7a628709996223f3c3bf0cb22b19fed60a3ff9d | Python | seemeekang/ML_in_Wi-Fi_positioning | /Stage5/Multi_Head.py | UTF-8 | 3,903 | 2.765625 | 3 | [] | no_license | from keras import layers
from keras import Input
from keras.models import Model
import numpy as np
import pandas as pd
def one_hot_conversion(ind, num):
ind = int(float(ind))
m = np.zeros(num)
m[ind] = 1
return m
fpath1 = "trainingData2.csv"
fpath2 = "validationData2.csv"
def read_data(fpath):
... | true |
5054f9c12a936cde95b1fca8faec74bd07d7851a | Python | vishalbelsare/causallib | /causallib/survival/weighted_standardized_survival.py | UTF-8 | 3,123 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | from .survival_utils import canonize_dtypes_and_names
from .standardized_survival import StandardizedSurvival
from causallib.estimation.base_weight import WeightEstimator
import pandas as pd
from typing import Any, Optional
class WeightedStandardizedSurvival(StandardizedSurvival):
"""
Combines WeightedSurviva... | true |
f14611acf771feee88c428fc4515a8f888388398 | Python | kinerycl/datastructures-algorithms | /leetcode/findDisappearedNumbers.py | UTF-8 | 445 | 3.03125 | 3 | [] | no_license | class Solution(object):
def findDisappearedNumbers(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
for i in range(0, len(nums)):
index = abs(nums[i]) -1
if nums[index] > 0:
nums[index] *= -1
absent = [... | true |
d72a02e05c6973b7d0021d2879cce90027a71c82 | Python | Adraxem/CryptoAlarm | /CryptoApp.py | UTF-8 | 6,730 | 3.21875 | 3 | [
"MIT"
] | permissive | import tkinter as tk
from bs4 import BeautifulSoup
import requests
import numpy as np
import time
from ClassCoin import *
import os
import tkinter.messagebox
b = ''
cap = 0
valu = 0
chg_r = 0
highh = 0
loww = 0
def input():
'''
Obtains input from the entry at the root window,
and desi... | true |
4e55636e5c994fe89b4fad5888aabcb679f24161 | Python | augustoscher/python-excercises | /pandas/dataframe.py | UTF-8 | 1,107 | 4.03125 | 4 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
print('--- Pandas/Dataframes ---')
np.random.seed(101)
df = pd.DataFrame(np.random.randn(5, 4), index='A B C D E'.split(), columns='W X Y Z'.split())
print(df)
print()
# Consumo/indexação de dados de um Dataframe
# Busca os dados da coluna "W". Irá retornar uma serie
s1 = df['... | true |
3028c5f8659f69b483ef0157dffc26f0206fe189 | Python | SLongofono/448_Project4 | /Recommender.py | UTF-8 | 10,131 | 2.65625 | 3 | [
"MIT"
] | permissive | ## @file Recommender.py
# @brief Script responsible for gathering, vetting, and adding songs to the user playlist
# @details This script is designed to be run periodically to generate new recommendations
# for the user. The script will instantiate a user, determine if the profile needs
# to be updated, gather and filt... | true |
4a22f357adc0bd9db5843c2b3702055669759384 | Python | asontireddy/Eckovation | /Aravind_Sontireddy_grid_1.py | UTF-8 | 770 | 3.78125 | 4 | [] | no_license | def drawGrid(height, width):
for i in range(height + 1):
for j in range(width):
print(' ' +'-'*3, end="")
print()
if i != height:
for j in range(width + 1):
print("|" + " "*3, end= "")
print()
def validateList(mylist):
if len(mylist) != 2... | true |
f9a8f235a6699c65f202ba9296d6ff22260afbd2 | Python | Sandy4321/semantic-distance | /src/analysis/visualization.py | UTF-8 | 646 | 2.828125 | 3 | [
"MIT"
] | permissive | import graphics as artist
import matplotlib.pyplot as plt
from matplotlib import rcParams
rcParams['text.usetex'] = True
format_label = lambda text: r'\Large \textbf{\textsc{%s}}'%text
def heatmap(array):
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.imshow(array,interpolation='nearest',aspect='auto',c... | true |
c6199607eddf7b4e5a31fcc50a0113f81c8226ab | Python | skoval00/investment-tools | /investments_calc.py | UTF-8 | 26,407 | 2.625 | 3 | [] | no_license | # requirements.txt: requests termcolor
"""Investments distribution calculator"""
import argparse
import logging
import math
import operator
from decimal import Decimal
from typing import List
import requests
from termcolor import colored
import pcli.log
log = logging.getLogger()
class Actions:
SHOW = "show... | true |
83e61fcca4e4ce8ca96f824fa7acbd0fb1d6d591 | Python | jxs5476/445proj | /graphPlot.py | UTF-8 | 362 | 2.546875 | 3 | [] | no_license | import keras
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import json
# arr,left point,right point
def plot(arr, lp, rp):
rp += 1
subArr = arr[lp:rp]
plt.plot(subArr)
plt.show()
resultString = json.dumps(subArr)
point1 = 1
point2 = 3
testArr = [9485.342, 9134.619, 8... | true |
ed6904f711ee540be5a59527784549225796d4c3 | Python | babaiwan/YOLOv3-Dishes-identification | /addFont.py | UTF-8 | 553 | 2.71875 | 3 | [
"MIT"
] | permissive | # coding=utf-8
# cv2解决绘制中文乱码
import cv2
import numpy
from PIL import Image, ImageDraw, ImageFont
class Font():
def cv2ImgAddText(img, text, left, top): # 视频帧绘制中文
img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
draw = ImageDraw.Draw(img)
fillColor = (255, 0, 0)
fontSty... | true |
925bc5d47530d699e340af039d83835ee52c742b | Python | jjmalina/newspics | /newsapp/tumblr_request.py | UTF-8 | 467 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
import json
import requests
import settings
import sys
#accept an argument
if(len(sys.argv) > 1):
SearchObj= sys.argv[1]
else:
SearchObj = 'mountains'
obj = requests.get('http://api.tumblr.com/v2/tagged?tag='+ SearchObj + '&api_key=' + settings.TUMBLR_KEY)
#convert obj(JSON) to a pytho... | true |
834d84121d442d70e38c2bbba6b6bd8883b56335 | Python | MaoningGuan/LeetCode | /京东笔试题目/test3.py | UTF-8 | 2,228 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
采购单(京东2017秋招真题)
样例输入
5 3
4 2 1 10 5
apple
orange
mango
6 5
3 5 1 6 8 1
peach
grapefruit
banana
orange
orange
样例输出
7 19
11 30
"""
if __name__ == '__main__':
while True:
n, m = map(int, input().split())
prices = sorted(list(map(int, input().split())))
hashmap = di... | true |
1a30c61e159275efa710a0b82554d1031ed0e232 | Python | ppinko/python_exercises | /functional_programming/hard_needle_in_a_hex_string.py | UTF-8 | 614 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | """
https://edabit.com/challenge/qujNfKFH9JkpwzuLt
"""
def first_index(hex_txt, needle):
word = ''.join((chr(int(i, 16)) for i in hex_txt.split()))
return word.find(needle)
assert first_index("68 65 6c 6c 6f 20 77 6f 72 6c 64", "world") == 6
assert first_index("47 6f 6f 64 62 79 65 20 77 6f 72 6c 64", "worl... | true |
ed465364f8036052670074766a314774dcef80b9 | Python | misiekagh/python-semi-advanced | /oop/scripts/main.py | UTF-8 | 559 | 2.859375 | 3 | [] | no_license | from oop.sports import *
from oop.multihash import MultiHash
from random import randint
from oop.timefunc import timeit
@timeit
def findstr(str):
for _ in range(10000):
if str in mh:
pass
p1=Player('Jan Kowalski', 1000)
p2=Player('Al Bo', 2000)
p3=Player('Joe Smith', 1500)
p4=Player('Jan Kowa... | true |
7be7c1eca74ce56871dcb77b5b43192fc7b9980b | Python | fuurin/CSFundImageProcessing | /lesson2Code/dictBasics.py | UTF-8 | 2,389 | 4.1875 | 4 | [] | no_license | import time
import random
#1) Define our first dictionary
phonebook = {
'bob': 7387,
'alice': 3719,
'jack': 7052,
}
# Print an entry using the key to access it
print("Dictionary example 1, accessing an element "+str(phonebook["bob"]))
#iterate over all elements
for dict_key, dict_value in pho... | true |
9a28c92e327247be4799871291f31ae961a69678 | Python | p-kozak/dingo | /app/control.py | UTF-8 | 5,170 | 3.078125 | 3 | [
"MIT"
] | permissive | #control.py
from PyQt5.QtCore import QObject, qDebug, pyqtSignal, QTimer
from hardwarecontrol import HardwareControl
from dataprocessing import Point, Map, DataProcessing
import time
class Control(QObject):
"""
One-instance class that handles processing of data and hardware interaction.
"""
#Signals ... | true |
be8f461947dead8bb344093665b80dcd842c7efe | Python | UWPCE-PythonCert/Py100-2017q1 | /mbozee/seattle-open-data/seattle-real-time-fire-911-calls/seattle-fire-json.py | UTF-8 | 826 | 3.09375 | 3 | [] | no_license | import json
import pprint
import urllib2
data = json.load(urllib2.urlopen('https://data.seattle.gov/resource/grwu-wqtk.json'))
def print_json(n):
"""Print n number of records."""
count = 1
for record in data[:n]:
try:
# JSON datetime format example : u'2016-04-06T14:55:00.000'
... | true |
2b821da4708c2612fcb72e7d4a5fec2cd2191360 | Python | hedayet13/practiceCoding | /hackerRank55_halloweenSale.py | UTF-8 | 287 | 2.890625 | 3 | [] | no_license | pmds = input().split()
p=int(pmds[0])
m=int(pmds[1])
d=int(pmds[2])
s=int(pmds[3])
# p=20
# d=3
# m=6
# s=80
q=0
count=0
while q<=s:
if p<=d:
q=q+d
if q<=s:
count+=1
else:
q=q+p
p=p-m
if q<=s:
count+=1
print(count) | true |
662555aca7c1d66e74f10738efcc2f5fb35f7b05 | Python | cebarbosa/spanet_gc2018 | /python/schedule_table.py | UTF-8 | 1,126 | 2.65625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on 20/03/18
Author : Carlos Eduardo Barbosa
Produces table with schedule
"""
from __future__ import print_function, division
if __name__ == "__main__":
with open("SPAnet_schedule.tsv", "rb") as f:
text = f.read()
schedule = ["\tschedule: ["]
for line in text... | true |
e0b6cc83749a1e34f5256555dd2806517e9b011d | Python | snail15/AlgorithmPractice | /LeetCode/Python/SecondRound/323_numberOfConnectedComponents.py | UTF-8 | 685 | 3.09375 | 3 | [] | no_license | def countComponents(self, n: int, edges: List[List[int]]) -> int:
adjList = self.getAdjList(edges)
visited = set()
components = 0
for i in range(n):
if i not in visited:
components += 1
self.dfs(i, visited, adjList)
return components
def dfs(self, node, visited, a... | true |
473a786f60778aef43d8d06afb3a986e4066e274 | Python | yuyurun/atcoder | /20200111/b.py | UTF-8 | 446 | 3.140625 | 3 | [] | no_license | import math
n = int(input())
x = list(map(int, input().split()))
ans = 0
for i in range(n-1):
ans += (x[n-1]-x[i])*math.factorial(n-1)
print(ans)
if i >0:
for j in range(n-2):
ans -= (j+1)*(x[n-1]-x[i])
print(ans)
if i > 0 and i < n-2:
for j in range(n-i-2):
... | true |
b4f7260efd904468dc89bc7d3e02d4bf41293073 | Python | Uservasyl/StartDragons_lesson2 | /inversiya.py | UTF-8 | 211 | 3.59375 | 4 | [] | no_license | import random
arr = random.sample(range(1, 100), 10)
print(arr)
i = 0
for j in range(len(arr) - 1):
if arr[j] > arr[j+1]:
i += 1
print("Кількість інверсій рівна - {}".format(i)) | true |
81bdf0555eb7e723df59f75000298bee6af79893 | Python | GlinZachariah/predictme | /modules/update_tweet.py | UTF-8 | 1,547 | 2.734375 | 3 | [] | no_license | #program to retrieve the tweets from github
import pandas as pd
from datetime import datetime
from datetime import timedelta
#string=[]
#generate today time
datenow= datetime.now().date()
date=input("enter the date:(2019-04-17)")
company=input("enter the name of the company")
header=['Id','Text','Date','Time','Follower... | true |
3ad8df074f04250ec2e5f3cb277324b6650747ba | Python | mserrano/picoCTF-Platform-2 | /example_problems/reversing/minibomb/grader/grader2.py | UTF-8 | 166 | 2.625 | 3 | [
"MIT"
] | permissive | """
Grader file for Minibomb problem
"""
def grade(autogen, key):
if '1 2 6 24 120 720' in key:
return (True, 'Good work!')
else:
return (False, 'Nope')
| true |
209021cc66bd5642d8d89e4744b0979bda36149b | Python | nWhitehill/FlowSolverPython | /flow_ai/back_tracking.py | UTF-8 | 6,247 | 3.34375 | 3 | [] | no_license | from flow_game.flow_board import Flow, Path
import flow_game.utilities as utils
import copy, time
class BackTrackSolver:
def solve_file(self, filename):
"""
Solves the board in filename
:type filename: str
:rtype: Flow
"""
def solve(self, initial_game):
"""
... | true |
2a27d5a0270890344efb235dacd029e0cf855c82 | Python | nodebe/Flask-Blog-Learnt | /app.py | UTF-8 | 8,112 | 2.515625 | 3 | [] | no_license | from flask import Flask, request, render_template, url_for, flash, redirect, session
from forms import Regform, Loginform, Articleform
from functools import wraps
from passlib.hash import sha256_crypt as sha256
import pymysql.cursors
import secrets
app = Flask(__name__)
#for secret key to create unique session
app.sec... | true |
de054f75ce2155e95264d62e581ff562c33f041e | Python | migssgim12/python_class | /2_Functional_Iteration/arb_args.py | UTF-8 | 684 | 4.15625 | 4 | [] | no_license | """
>>> arb(1, 2, 3, 4, 5, True, None, False, 'Python')
The 9 args are: (1, 2, 3, 4, 5, True, None, False, 'Python')
>>> arb(1, None)
The 2 args are: (1, None)
>>> stats(1, 67, 88, 44, 55, 33, 44, 22, 55, 7, 88, 9, 55, 66, 44, 33, 876)
Sum: 1587
Max: 876
Min: 1
Avg: 93
Range: 875
Entries: 17
"""
def arb(*args):
... | true |
9119b219a5067a43b56c9139b4322a97ff0397e5 | Python | pauldraper/advent-of-code-2020 | /problems/day-10/part_1.py | UTF-8 | 226 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import collections
import sys
nodes = [0] + sorted(map(int, sys.stdin))
nodes.append(max(nodes) + 3)
counts = collections.Counter(b - a for a, b in zip(nodes, nodes[1:]))
print(counts[1] * counts[3])
| true |
75260678d000751037a56f69e517b253e7d82ad9 | Python | aasmith33/GPA-Calculator | /GPAsmith.py | UTF-8 | 647 | 4.46875 | 4 | [] | no_license | # This program allows a user to input their name, credit hours, and quality points. Then it calculates their GPA and outputs their name and GPA.
import time
name = str(input('What is your name? ')) # asks user for their name
hours = int(input('How many credit hours have you earned? ')) # asks user for credit hours ea... | true |
c975082536c29fcbb3600888a96a69b90bac43c9 | Python | NirmalaKTomar/Lane-detector | /lanedetector.py | UTF-8 | 2,394 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Import the required libraries
import numpy as np
import matplotlib.pyplot as plt
import cv2
from google.colab.patches import cv2_imshow
import os
import math
def edgedetection(img):
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
clr = cv2.GaussianBlur(gray, (5, 5), 0)
Canny = cv2.Can... | true |
87f686f783220f9a2593bff049328de9bfba8d69 | Python | cponeill/pymotw-practice-examples | /Internet/parse/quote.py | UTF-8 | 253 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
# quote.py
from urllib.parse import quote, quote_plus, urlencode
url = 'http://localhost:8888/~hellman'
print('urlencode() :', urlencode({'url': url}))
print('quote() :', quote(url))
print('quote_plus():', quote_plus(url))
| true |