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 |
|---|---|---|---|---|---|---|---|---|---|---|
ddbf400bd13f6be68f5f164c225169a111b93a6a | Sasszem/cryptopals-solutions | /set2/02_cbc.py | UTF-8 | 751 | 3.25 | 3 | [] | no_license | from Crypto.Cipher import AES
def CBC(text, key, IV = bytes(0 for _ in range(16))):
assert isinstance(text, bytes), "text should be bytes!"
assert isinstance(key, bytes), "key should be bytes"
assert isinstance(IV, bytes), "IV should be bytes"
assert len(key)==16, "Key len should be 16!"
state = IV... | true |
f60ecccfe26086b5e68f57ed60f746e457c3cc5b | CLAY-Z/study | /test_03/IconForm.py | UTF-8 | 1,018 | 2.78125 | 3 | [] | no_license | import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtGui import QIcon
"""
窗口的setWindowIcon方法用于设置窗口的图标,只在Windows中可用
QApplication中的setWindowIcon方法用于设置主窗口和应用程序的图标,但如果调用了窗口的setWindowIcon方法
QApplication中的setWindowIcon方法只能用于设置应用程序的图标
"""
class IconForm(QMainWindow):
def __init__(self, parent=No... | true |
86a7162e7bda2e42a6bda85164356ed6dc6dbf3c | UncleEricB/fossor | /fossor/checks/similar_log_errors.py | UTF-8 | 5,669 | 2.578125 | 3 | [
"BSD-2-Clause",
"BSD-2-Clause-Views"
] | permissive | # Copyright 2017 LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
from difflib import SequenceMatcher
from multiprocessing import Pool, cpu_count
from collections import OrderedDict
from fossor.checks.check import Check
cl... | true |
2fa58a76ddf45e504e1db5f41d0fdb95b117d57c | phvu/theoretical-neuroscience | /python/common/spike_generators.py | UTF-8 | 2,947 | 3.21875 | 3 | [] | no_license | from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from spike_train import SpikeTrain
def poisson_constant_rate(duration, rate):
"""
Poisson process with constant firing rate
:param rate: constant firing rate
:param duration: duration
:return:
""... | true |
bc4d87a3b733d90159f0dd51a3df725c760522a4 | zdhNarsil/Convex-Optimization-Course-Project | /FinalCodes/sinkhorn_newton.py | UTF-8 | 3,016 | 2.65625 | 3 | [] | no_license | import argparse
import time
from dataset import *
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument('--image-class', type=str, default='Shapes')
parser.add_argument('--n', type=float, default=32)
parser.add_argument('--data', type=str, choices=['DOTmark', 'random', 'Caffa', 'ellip... | true |
f71849457d0f4c219ff497958b1e370b1c926064 | FroeMic/CDTM-Backend-Workshop-WT2016 | /solutions/exercises/4-Database-Challenges/challenge3.py | UTF-8 | 1,513 | 3.328125 | 3 | [
"MIT"
] | permissive | import sqlite3
from challenge2 import db_add_user, db_add_cookie
DB = None
# make sure we connect only once to th database
def get_db():
global DB
db = DB
if db == None:
db = DB = sqlite3.connect('cookies.db')
db.execute("PRAGMA foreign_keys = 1")
db.row_factory = sqlite3.Row
r... | true |
2988e081174f65afebcccd2721ee5361f5f71ef4 | hariPakala/TextMining | /src/SentenceModel/setenceModelScoring.py | UTF-8 | 1,859 | 2.90625 | 3 | [] | no_license | '''
Created on Nov 15, 2016
@author: hari
'''
from __future__ import division
import math
import re
class setenceModelScoring(object):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
def getsenCalc(self,sentend,sentenceLen,std,mean):
t1 = 1 / (math.sqrt(2... | true |
2b1fc76e12434a34331b2fbbed7a3fbb954fb91e | deef128/covid | /fetchdata/mexico.py | UTF-8 | 2,702 | 2.78125 | 3 | [] | no_license | import requests
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
from pathlib import Path
from fetchdata.dataclass import CovidData
fbase = Path('data/mexico/')
class CovidMexico(CovidData):
def __init__(self):
population = 126014024
super().__init__('Mexico', popu... | true |
6469af76bcbc903da8a3f9da572a4ed8830d2fb0 | Taoge123/OptimizedLeetcode | /LeetcodeNew/python2/LC_1711.py | UTF-8 | 336 | 2.765625 | 3 | [] | no_license | import collections
class Solution:
def countPairs(self, deliciousness) -> int:
mod = 10 ** 9 + 7
res = 0
count = collections.defaultdict(int)
for num in deliciousness:
for k in range(22):
res += count[2 ** k - num]
count[num] += 1
ret... | true |
98735dd6afbc1c9fafa75c1ed2af1629deadeb56 | EdgarFMO/TrabajosPython | /py2_retos1/reto8.py | UTF-8 | 68 | 3.171875 | 3 | [] | no_license | x = 9
while x < 20 :
x=x+1
a=x%2
if a == 0 :
print(x,'es par') | true |
d14e712edc93b243c339a62f2b85b50c18f23fc1 | TrishaChandra123/Big-Data-Analytics-Project-using-Spark | /BigDataProject_PythonCharts.py | UTF-8 | 1,590 | 3.078125 | 3 | [] | no_license |
# coding: utf-8
# In[40]:
#importing pandas
import pandas as pd
# In[41]:
#importing numpy
import numpy as np
# In[42]:
#importing matplotlib
import matplotlib.pylab as plt
from matplotlib.pylab import rcParams
# In[75]:
#ading the data from csv
newdat = pd.read_csv("C:/Users/trish/Desktop/BD/Clean.csv")
#... | true |
8b0a1ef24dcbf3229e20f7fb2093ed44b18dc776 | prabhakar6372/python | /staircase.py | UTF-8 | 317 | 3 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the staircase function below.
def staircase(n):
for i in range(n):
x = ' '
b = (n-1) - i
a = str((x*b))
d = str(((i+1)*'#'))
print(a + d)
if __name__ == '__main__':
n = int(input())
staircase(n)
| true |
4665b8fcdf8b3f09d22f6bb4ca36d054e8d9cbe3 | MohitBaid/CodeChef | /Long Challenge/NOV18/C.py | UTF-8 | 324 | 2.890625 | 3 | [] | no_license | T=int(input())
while T>0:
s = list(map(int,input().split()))
f = s[0]
k = s[1]
if f == 2 :
print("0.5000000")
continue
while k>0:
if f==1:
break
elif f<=2:
f = 1
elif f%2 == 0:
if (f/2)%2 ==1:
f = f//2+1
else:
f = f//2
else:
f =f//2 +1
k = k-1
ans = 1/f
print('%.6f'%ans)
T =... | true |
85fe224c44a417ee5ce4c8dbb64f9602b457c8f2 | febinstephen/Python-Practice-Book | /chapter5/problem5.py | UTF-8 | 286 | 2.71875 | 3 | [] | no_license | import os
def tot_numlines(x):
l=0
for path,y,z in os.walk(os.getcwd()):
for i in z:
if x in i:
print os.path.join(path,i),":-",len(open(i).readlines())
l+=len(open(i).readlines())
print "Total:-",l
tot_numlines(".py")
| true |
996b3e00dad99b597fd85623769baa7db0a59515 | eventable/PyCalendar | /src/pycalendar/vcard/tests/test_adrvalue.py | UTF-8 | 2,525 | 2.625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] | permissive | ##
# Copyright (c) 2011-2013 Cyrus Daboo. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | true |
c96c5857c712c1e5fa9ffbac1e1bff961f005da6 | vuagieucot/pythoncorner | /pigem/1_3/13.py | UTF-8 | 3,791 | 3.0625 | 3 | [] | no_license | import pygame
from pygame.locals import *
import random
from OpenGL.GL import *
from OpenGL.GLU import *
vertices = (
(1, 1, 1),
(1, 1, -1),
(1, -1, -1),
(1, -1, 1),
(-1, 1, 1),
(-1, 1, -1),
(-1, -1, -1),
(-1, -1, 1))
edges = (
(0, 1),
(0, 3),
(0, 4),
(2, 1),
(2, 3),... | true |
3a1dbae0f9452ed77968214cc1cf985c07919f96 | humeinstein/holbertonschool-higher_level_programming | /0x07-python-test_driven_development/4-print_square.py | UTF-8 | 694 | 3.96875 | 4 | [] | no_license | #!/usr/bin/python3
"""
function that prints a square with the character #
"""
def print_square(size):
"""
returns size * #
"""
wow = checkStatus(size)
if wow == 0:
for i in range(size):
print("#" * size)
elif wow == 1:
raise TypeError("size must be an int... | true |
9341802fd5ee9da0221460767349c9e4959044f6 | FMerlino/NEA | /Calculator_WIP.py | UTF-8 | 971 | 3.390625 | 3 | [] | no_license | #using tkinter create a calculator
import tkinter as tk
#from tkinter import *
root = tk.Tk()
#setting title
root.title('Calculator')
#size of the calculator
root.minsize(300, 400)
root.maxsize(300, 400)
#developing buttons
button_9 = tk.Button(root, text = '9').grid(row=2,column=3)
button_8 = tk.Button(root, text... | true |
323857ef1db66c6b228f992acdfddf4386dbedc1 | king-kenneth/cs20-class-demos-fall2018 | /displaying_html.py | UTF-8 | 331 | 2.78125 | 3 | [] | no_license | import easygui_qt as easy
your_fav = easy.get_string("What's your favourite NBA team?")
best_teams = f"""<h1>Best NBA Teams</h1>
<p>The <em>best teams</em> in the NBA are:</p>
<ul>
<li>Spurs</li>
<li>Warriors</li>
<li>Celtics</li>
<li>Raptors</li>
<li>{your_fav}</li>
</ul>"""
easy.show_message(... | true |
ae8b83a5c97cb9366fca0f370c1a0a7e5bef91b8 | rw1993/arma_with_missing_data | /yule_walker_ar_predicter.py | UTF-8 | 2,117 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# author: rw
# E-mail: weiyanjie10@gmail.com
import numpy as np
import copy
class ArPredicter(object, ):
def __init__(self, p, learning_rate=0.003):
self.p = p
self.xs = []
self.errors = []
def predict_and_fit(self, obersation_x):
if len(self.xs) <= sel... | true |
d4ad974c333ff9f370175e0950460647882735b6 | jaypeeml/PySpark-bigdata | /Build Pipeline/build-pipline.py | UTF-8 | 2,617 | 2.765625 | 3 | [] | no_license | import findspark
#findspark.init()
import pyspark
from pyspark.sql import SparkSession
from pyspark.sql.types import * # convert datatype from one type to another
from pyspark.sql.functions import * # manipulation of data
spark = SparkSession.builder.getOrCreate()
df = spark.sql("select 'name' as colomn") # cr... | true |
e986ac73bdaf9c34e7c3b6a3eb23d927f4809392 | lmgongucd/quantum_code_practice | /GM_electronproblem/one_e.py | UTF-8 | 3,569 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
from __future__ import division
import numpy as np
chemical_elems = {'H':1, 'He':2}
chemical_elems['Li'] = 3
def load_basis(filename):
basis = dict()
reading = False
for line in open(filename):
if line.startswith('#'):
continue
elif line.s... | true |
fc3642323eb7025405bb8bb602032fab721fd0fd | junglejf/DesafioJG | /util.py | UTF-8 | 1,364 | 3.75 | 4 | [] | no_license | '''
Módulo que contém as funções de output do programa
'''
import sys
import const
import rules as rl
def jovensgenios(num):
'''
Funciona que utiliza rules pra retornar a string correta
'''
s = ''
if(rl.divisivel_por_3(num)):
s = "Jovens"
if(rl.divisivel_por_5(num)):
s = ''... | true |
22e4d7126135441afd7d8c07333dec5976a56196 | prgore/Early-Prediction-of-Sepsis-from-Clinical-Data | /test_2.py | UTF-8 | 1,478 | 2.8125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import glob
path_folder = './train/*'
def gen_data(sample):
sample = sample.loc[:, sample.columns != 'FileName']
label = sample.loc[:, sample.columns=='SepsisLabel'].values
num_times = sample.shape[0]
padding = pd.DataFrame(np.tile(sample.iloc[-1], (47, 1)), co... | true |
159fd030be75bfcb41ac99c05a633f1800faa57b | DoubtedGoat/wg_analysis | /wmh.py | UTF-8 | 909 | 2.71875 | 3 | [] | no_license | import matplotlib.pyplot as plt;
import numpy as np;
from mpl_toolkits.mplot3d import Axes3D;
from matplotlib import cm;
# Probability hit rate WMH
def p_hit(rat, defense):
tn_lookup = [
0.0, # 0 - Not real
0.0, # 1 - Not Real
0.0, # 2 - Special case
35.0, # 3+
33.0, # 4+
30.0, # 5+
26... | true |
f7c0864b4197cbc6c93c22926e86e7e88ae1091d | herborspice/Smart-Plug | /Old_Info/SmartPlug3.py | UTF-8 | 2,704 | 2.59375 | 3 | [] | no_license | import sys,os
import time
#from scipy.interpolate import interp1d
#import numpy as np
import sqlite3
#import matplotlib.pyplot as plt
#from scipy import integrate
#from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
#from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as ... | true |
47702d218e8234b08bbddeba4a476f1697021f71 | mla96/Paired-Autoencoder-Image-Fusion | /Registration/dataformat_functions.py | UTF-8 | 2,391 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
"""
This file contains functions to convert FLIO data channels between formats.
"""
import numpy as np
import SimpleITK as sitk
from PIL import Image
import h5py
# Get .mat files from FLIMX study manager directory
def channel_Mat2NpArray(path):
with h5py.File(path, 'r') as channel:
... | true |
5f9e4e9295d6bce80f7cd442d7dc3e98422c6038 | hytera170726574/auto_Test | /test_file.py | UTF-8 | 263 | 2.65625 | 3 | [] | no_license | from PIL import Image
import math
import operator
from functools import reduce
im1=Image.open("4.png")
im2=Image.open("4.png")
h1=im1.histogram()
h2=im2.histogram()
result=math.sqrt(reduce(operator.add,list(map(lambda a,b:(a-b)**2,h1,h2)))/len(h1))
print result | true |
0c8341128039933850d0ded5ba83ca888d60829d | jamiethezim/registration-predictor | /model_builder.py | UTF-8 | 2,402 | 2.984375 | 3 | [] | no_license | import argparse
import pandas
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.tree import DecisionTreeClassifier
from sklearn.naive_bayes import GaussianNB
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn ... | true |
383441aad9b0d4512ce90d70fd2e14f28eaea5bd | donghyukjung/BJproblems | /Solved/15685.py | UTF-8 | 882 | 3.078125 | 3 | [] | no_license | N = int(input()) # 1~20
curves = [list(map(int, input().split())) for _ in range(N)] # x,y,d,g
max_gen = 0
# Find maximum generation
for i in range(N): max_gen = curves[i][3] if curves[i][3] > max_gen else max_gen
M = 101
map = [[0 for col in range(M)] for row in range(M)]
dir = [[1, 0], [0, -1], [-1, 0], [0, 1]]
d... | true |
39451e89eef9ebaaf730bba99d8453cedd8f85a2 | harisrajput/Python-Bootcamp-DSC-DSU | /week_1/Task 3.py | UTF-8 | 241 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import time
def Lyrics(lyric):
lyric= lyric.split(" ")
for i in range(len(lyric)-1):
print(lyric[i])
time.sleep(1)
lyric = input()
Lyrics(lyric)
# In[ ]:
| true |
ad94362b2243bcc4d5699d8effc5651ec736459f | cagriozcaglar/ProgrammingExamples | /Algorithms/Searching/KthMissingPositiveNumber/KthMissingPositiveNumber.py | UTF-8 | 847 | 3.75 | 4 | [] | no_license | """
K-th Positive Missing Number
Binary Search, modified
"""
from typing import List
class Solution:
def findKthPositive(self, arr: List[int], k: int) -> int:
low, high = 0, len(arr)-1
while low <= high: # CAREFUL: equals sign
mid = (low+high) // 2
diff = arr[mid] - mid - 1... | true |
385ee5f98bf8da6e9c1278510d679f54f6d1c59e | ShiJbey/Magpie | /scripts/export_level_bitmap.py | UTF-8 | 5,452 | 2.828125 | 3 | [] | no_license | # Exports a bitmap file containing the level data
# to a bindary format to be imported by c++
#
# Example Usage
# python export_level_bitmap.py level_image.png ../dist/level1.lvl --validate
import argparse
import cv2
import numpy as np
import struct
import sys
########################################################... | true |
8a9065c8c68687d69fa78b4e5388f252c4b47a50 | DivineEnder/D2MT | /custom.py | UTF-8 | 362 | 3.484375 | 3 | [
"Apache-2.0"
] | permissive | #Imports a library used to access certain os features (cmd in this case)
import os
#Own number to string function that places a zero in front of a single digit number
def toString(n):
if (n < 10):
return "0" + str(n)
else:
return str(n)
#Clears the command line current screen
def cls():
os... | true |
29cc3ca89dad7bb9bf8bda98ce6ea8d7f8e80c62 | baewonje/iot_bigdata_- | /python_workspace/01_jump_to_python/4_input_output/3_file_io/q3.py | UTF-8 | 193 | 3.765625 | 4 | [] | no_license | input1 = int(input("첫번째 숫자를 입력하세요:"))
input2 = int(input("두번째 숫자를 입력하세요:"))
total = input1 + input2
print("두 수의 합은 %s 입니다." % total) | true |
2f5a28e2a285a1dab7f0807be980473437f0a03a | gusl0801/2DGP | /project/Isaac/save_code/test_door_connect.py | UTF-8 | 626 | 3.828125 | 4 | [] | no_license | import random
class Way:
Left = 0
Right = 1
Down = 2
Up = 3
def Calculate_Door_Way(way):
while True:
temp = random.randint(0, 3)
if way == Way.Left and temp != Way.Right:
break;
if way == Way.Right and temp != Way.Left:
break;
if way == Way.U... | true |
27ed9e2fb9be8836dab7eecd0317d82519e5020d | redcican/Python-Exercise | /04_prime_number.py | UTF-8 | 446 | 4.0625 | 4 | [] | no_license | # Check whether a number is a prime number or not
# prime number = can only divide evenly by itself of one
import math
def isPrime(num):
if num < 2:
return False
root = math.ceil(math.sqrt(num))
for i in range(2, root+1):
if num % i == 0:
return f"{num} is not a prime number"
... | true |
f02d5df44baa691d9b8b8beb4609785764e80a46 | kaylalee44/Computing-Kids | /info_extract.py | UTF-8 | 5,960 | 3.390625 | 3 | [] | no_license | import pandas as pd
from bs4 import BeautifulSoup
from urllib.request import urlopen
import csv
def jobsUpdated(file_name):
"""
Goes through a data set file and looks through all the job listings for the date it was posted. If the days posted
was 1, 7, 14, or 21 days ago, then the counter goes up. Prints ... | true |
9a588c83892506eee38182e5260c3def655967fd | shadow923540/Python_small_project | /PythonCourse/FIles/002.py | UTF-8 | 144 | 2.625 | 3 | [] | no_license | with open("bear.txt") as file:
content = file.read()
content = content[:90]
with open("file.txt", 'w') as file:
file.write(content) | true |
b50770f528b1b28da41ccb66ad64088a9b5e5f47 | lijielife/NLP-6 | /Word Corrections Dictionary.py | UTF-8 | 428 | 2.625 | 3 | [] | no_license | print('Loading commonly misspelled words and their replacement...')
wordMisspellings = {'exahusted': 'exhausted',
'imporant': 'important',
'kongregate': 'congregate',
'overdrsfted': 'overdrafted',
'peperoni': 'pepperoni',
... | true |
99578f9c08d3aaad11565cddc44a2c2d95180dfa | ssiwapol/fulfillment-optimization | /model.py | UTF-8 | 2,953 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pyomo.environ as pyomo
from pyomo.opt import SolverFactory
def optimize(data, config):
# model
model = pyomo.ConcreteModel()
# parameters
shippingcost = {x['seller']: x['shippingcost'] for x in data}
distance = {x['seller']: x['distance'] for x in data}
ordercou... | true |
6206315a8bc9b7e41e7ad6a789e1d726db826940 | Tsar/parsingLab2 | /testsGenerator.py | UTF-8 | 1,048 | 3.375 | 3 | [] | no_license | import random
CONST_TESTS = """3
5 6 +
65 -99 *
432 123 - 567 +
4 + +
567 876 9 * *
56 abcd
"""
def randomNumber():
return str(random.randint(-5000, 100000)) + " "
def randomOperator():
return random.choice(["+", "-", "*"]) + " "
if __name__ == "__main__":
with open("tests.txt", "w") as outputFile:
... | true |
f76cffb7026478b4414391bd79205fd708baa037 | liuxiao1468/Depth_prediction_network | /zed_camera_code/data_collection.py | UTF-8 | 5,813 | 2.625 | 3 | [] | no_license | ########################################################################
#
# Copyright (c) 2017, STEREOLABS.
#
# All rights reserved.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHA... | true |
6bebe3690db03633ef7141bea5cf4910efa251db | Brun-X/school_linux | /dag2/dag2-2.py | UTF-8 | 153 | 3.078125 | 3 | [] | no_license | #/bin/python3.7
import re
string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
x = re.search("ipsum", string)
print(x.group())
| true |
f2bccabcaf16f322c3034e5800b9d0b7f442cdec | leader1313/GMLRM_DART | /tools/Learning/HIMGP.py | UTF-8 | 14,827 | 2.578125 | 3 | [] | no_license | import numpy as np
import torch
import copy
class HIMGP:
def __init__(self, X, Y, M, iters, kernel, old_sigma = [], K = []):
'''
Argument
X : State
Y : Action
N : Number of data
D : Dimension of Action
... | true |
1c3d093946ef6f84722ae8dfb9dcd7e484e76b40 | KiruChaff/magicTrick | /magic_trick.py | UTF-8 | 4,178 | 3.59375 | 4 | [] | no_license |
suit=['Spades', 'Hearts', 'Clubs', 'Diamonds']
value=['Ace', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King']
cards=[]
props={}
reacurring_rank=[]
weighed={}
def pick_random_card():
global cards
import random
card=value[random.randrange(len(value))]+'_'+suit[random.randrange(len(suit)... | true |
48a5c8651aefbeb510c8befd25abd691249855b1 | RVK10601999/AUTS | /ts.py | UTF-8 | 12,992 | 2.859375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import re
import matplotlib.pyplot as plt
import streamlit as st
import statsmodels
from statsmodels.tsa.seasonal import seasonal_decompose
from statsmodels.graphics.tsaplots import plot_acf,plot_pacf
st.set_option('deprecation.showPyplotGlobalUse', False)
from statsmodels.tsa.ar... | true |
40a8cd610b981d280a8e657fda5b853101c08ba6 | antmicro/prjxray | /prjxray/math_models.py | UTF-8 | 1,736 | 3.296875 | 3 | [
"LicenseRef-scancode-dco-1.1",
"ISC"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2020 The Project X-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
""" Math models are used to represent... | true |
8affa414845860649e7a97f93a87dff5a367e92e | jsadsad/aA_Python | /w1/d3/input_ex.py | UTF-8 | 113 | 3.125 | 3 | [] | no_license | print("hello world")
answer = input("how are you? ") # <== notice space before closing quote
print("I am fine")
| true |
9b11e154ccd06fc0adf3e7d3b950b89921772ba9 | warshauerm/haiku | /haiku.py | UTF-8 | 1,756 | 3.15625 | 3 | [] | no_license | import sys
from nltk.tokenize import word_tokenize, wordpunct_tokenize, sent_tokenize, WhitespaceTokenizer
import curses
from curses.ascii import isdigit
import nltk
from nltk.corpus import cmudict
import string
d = cmudict.dict()
def num_syllables(word):
# if word in string.punctuation:
# return 0
word = word.... | true |
3f4acf5390d8c0dd3a37d7613fcd4703a64b41d5 | laura-zhang-cn/digital_image_preprocessing_and_recognition | /image_generate_DCGAN/image_collect.py | UTF-8 | 4,424 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat May 15 20:03:51 2021
@author: yxzha
数据收集: 男idol的头像
使用urllib去百度搜收集到图片的url,之后爬取图片并保存
"""
import urllib
import re
import random
import time
# 存储函数
def data_write(strx):
#数据 追加式写入
write_path1='E:\\google_download\\image_baidu_urllib\\caixukun\\cxk... | true |
427bba7f9ff68c519f8911d2890179dd65a61a5c | TerryLun/Code-Playground | /Leetcode Problems/lc703e.py | UTF-8 | 1,638 | 4.3125 | 4 | [] | no_license | """
703. Kth Largest Element in a Stream
Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order,
not the kth distinct element.
Your KthLargest class will have a constructor which accepts an integer k and an integer array nums, which contains
initial ele... | true |
9b33b5617bfdfa4a7919c058851c6093eeb5c982 | alistairwgillespie/sagemaker_ml_case_studies | /Moon_Data/source/predict.py | UTF-8 | 2,565 | 2.6875 | 3 | [
"MIT"
] | permissive | import argparse
import os
import sys
import pandas as pd
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.utils.data
from io import StringIO
from six import BytesIO
# import model
from model import SimpleNet
# accepts and returns numpy data
CONTENT_TYP... | true |
55bdf7f85f057849cb00b8266e7630e4d68c8f96 | Iverance/leetcode | /395.longest-substring-with-at-least-k-repeating-characters.py | UTF-8 | 1,168 | 3.875 | 4 | [] | no_license | #
# [395] Longest Substring with At Least K Repeating Characters
#
# https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters
#
# Medium (35.86%)
# Total Accepted:
# Total Submissions:
# Testcase Example: '"aaabb"\n3'
#
#
# Find the length of the longest substring T of a gi... | true |
2a53f1d50f758c0842eefbedb2c6fd24f3cc6741 | baidongbin/python | /疯狂Python讲义/codes/12/12.8/tempfile_test.py | UTF-8 | 814 | 4.03125 | 4 | [] | no_license | import tempfile
# 创建临时文件
fp = tempfile.TemporaryFile()
print(fp.name)
fp.write('两情若是久长时,'.encode('utf-8'))
fp.write('又岂在朝朝暮暮。'.encode('utf-8'))
# 将文件指针移到开始处,准备读取文件
fp.seek(0)
print(fp.read().decode('utf-8')) # 输出刚才写入的内容
# 关闭文件,该文件将会被自动删除
fp.close()
# 通过 with 语句创建临时文件,with 会自动关闭临时文件
with tempfile.TemporaryFile() as f... | true |
b25458b7118ba37a5dfdfcecdd4dfcec31a34b11 | BinbinPrime/ML-Assessment | /Densityplot.py | UTF-8 | 512 | 3.109375 | 3 | [] | no_license | import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
# Import Data
df = pd.read_csv("D:\pythonProject2\clinical_dataset.csv")
# Draw Plot
sns.kdeplot(df.loc[df['Status'] == 'healthy', "BMI"], shade=True, color="g", label="healthy", alpha=.7)
sns.kdeplot(df.loc[df['Status'] == 'cancerous', "BMI"]... | true |
75d2f8a5da0a8744ca83ce4f022a2a715347cb45 | JakeHuneau/NumericalTools | /NumericalTools.py | UTF-8 | 10,831 | 3.265625 | 3 | [] | no_license | import numpy as np
from scipy.signal import butter, lfilter, cheby1, cheby2, filtfilt
from scipy.optimize import curve_fit
pi = np.pi
#Numerical Tools
def two_point_diff(x,y):
'''
2 point numerical derivate. does dy/dx
-Input-
x: array. that y data is dependent of.
y: array. y data that is b... | true |
2c2dd5f8bac61689264144eab9105fefa97f3845 | AnujCodeZ/PyNet | /ImprovingNNs/AdvanceOptims.py | UTF-8 | 5,844 | 2.5625 | 3 | [] | no_license | import numpy as np
from Utils import DeepNet
class GDWithMomentum(DeepNet):
def __init__(self, beta=0.9):
super(GDWithMomentum, self).__init__()
self.beta = beta
self.averages = {}
self.init_averages()
def init_averages(self):
for i in range(len(self.l... | true |
fe06547919ac81d5f2642ebadc0f9d1f5408b918 | jacktheripperlondon/twitterbot200 | /untitled2.py | UTF-8 | 2,616 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 24 21:30:50 2020
@author: kali
"""
from newsapi import NewsApiClient
import requests
from selenium import webdriver
from datetime import timedelta
# from datetime import date
import datetime
import sys
current_date = datetime.datetime.now()
to_d... | true |
85b531884c651e8e792f113b443dd23347c8f1ec | MaseraTiGo/4U | /codes/scrapy/hdb/tutorial/test/resub.py | UTF-8 | 744 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# file_name : resub.py
# file_func :
# file_author : 'Johnathan.Wick'
# file_create_date: 2019/8/24 10:25
import re
url = 'http://www.hdbss.com/article-list-id-6-page-3.html'
flag = 0
def add_or_not(fn):
def wrapper_add_or_not(*args, **kwargs):
res = fn(*args, **... | true |
c4f43e1014c55439c9924972f23ba23f34dd0a8a | jianqiang3334/Python | /16.4.py | UTF-8 | 1,320 | 3.1875 | 3 | [] | no_license | #coding=utf-8
import pygame,sys
pygame.init()
screen = pygame.display.set_mode([640,480])
screen.fill([255,255,255])
my_ball = pygame.image.load("beach_ball.png")#把秋栽入到my_ball
x = 50
y = 50
x_speed = 10
y_speed = 10
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT : sys.exit()
... | true |
23bbd6c3d0847e7edba279b2feee5593301f346b | KrishnaRauniyar/python_assignment_II | /f11.py | UTF-8 | 408 | 3.90625 | 4 | [] | no_license | # Create a variable, filename. Assuming that it has a three-letter extension, and using slice operations, find the extension. For README.txt, the extension should be txt. Write code using slice operations that will give the name without the extension. Does your code work on filenames of arbitrary length?
filename = ... | true |
efbf473ee7855b206c1e47cd55a29bf109cf3aaa | hyesungoh/AA_Algorithm | /python/BOJ_10995.py | UTF-8 | 158 | 3.203125 | 3 | [] | no_license | # n = int(input())
# for i in range(n):
# print('* '*n if i % 2 == 0 else " *"*n)
n=int(input())
[print('* '*n if i%2==0 else " *"*n) for i in range(n)]
| true |
4b18a67d813e8a8d476601f38c167d662b839a67 | eunkyoung-jo/BDA_KS | /tokenise_ko_with_nltk.py | UTF-8 | 675 | 3.28125 | 3 | [] | no_license | #2018/10
import nltk
def tokenise_with_nltk(infn):
my_file = open(infn, encoding='utf-8')
all_tokens = [] # for a list of all tokens from all lines
for l in my_file:
tokens = nltk.word_tokenize(l)
all_tokens.extend(tokens)
my_file.close()
return all_tokens
def write_tokenised(all_... | true |
c022c7b5885f16df4fd094d1e30c37d0d47b76f7 | kandarpam87/Python_Learning | /LoggingExample.py | UTF-8 | 141 | 2.890625 | 3 | [] | no_license | import logging
try:
print('-'*40)
raise TypeError
print('-'*40)
except TypeError as e:
logging.exception("Observed error ")
| true |
06cde80a1c1cf56dd455c1906ec39b515beb1416 | pessini/LetterFrequency | /python/plot-code.py | UTF-8 | 826 | 3.328125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import matplotlib.pyplot as plt
import plotly.express as px
filename = "./frequency-letter.txt"
df = pd.read_csv(filename, sep='\t', header=None)
df.columns = ['Language', 'Letter', 'Frequency']
df.head()
# English
data_english = df[df.Language == 'en']
plot = px.bar(data_english, x = 'Letter', y... | true |
99c7ebd39bc932f19b4f7599b35d01023717846b | VillanCh/schedium | /schedium/handlers.py | UTF-8 | 3,608 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# coding:utf-8
import typing
import traceback
from datetime import datetime, timedelta
class SchediumTask(object):
def __init__(self, target: typing.Callable, vargs: typing.Optional[tuple] = None,
kwargs: typing.Optional[dict] = None,
id: str = None, start... | true |
eed96b64e9f7e9c433a856f38cf8334425373339 | kumardigamberjha/python-tutorial-for-everyone | /fibonacciser.py | UTF-8 | 150 | 3.65625 | 4 | [] | no_license | # a= 0
# b= 1
# 0+1= 1
# 1+1= 2
# 1+2=3
# 2+3=5
a= 0
b= 1
print(a,b, end=" ")
for i in range(10):
c= a+b
print(c, end=" ")
a= b
b= c | true |
4190e17d5b4251133de3c19ae7e6c4d9618c89c3 | yamnikov-oleg/aoc2020 | /day12/day12.py | UTF-8 | 4,681 | 3.546875 | 4 | [] | no_license | from dataclasses import dataclass, replace
from enum import Enum
class CmdCode(Enum):
N = 'N'
S = 'S'
W = 'W'
E = 'E'
R = 'R'
L = 'L'
F = 'F'
@dataclass
class Command:
code: CmdCode
value: int
def parse_command(line: str) -> Command:
"""
parse_command("R90") # => Comma... | true |
f3181f5c8af0b59b9dd355d3fd78e8fe37f73610 | vijayyevatkar/project_lc | /Easy/Level_Order_Traversal.py | UTF-8 | 958 | 2.96875 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def levelOrder(self, root: Optional[TreeNode]) -> List[List[int]]:
if not root:
... | true |
773febaa90ea821954c71c79c25b2891012b6d2c | blackshadev/HWlinkTV | /Netwerken/operations.py | UTF-8 | 2,876 | 3.046875 | 3 | [] | no_license | """
Classes in this file define the behaviour of that operation.
These operators still need to be called upon, this is done by the
Operations::getFn method in lab4.~.py
"""
class NOOP:
""" Starting value of data """
@staticmethod
def init(node):
return 0
""" What needs to be done after the echo wave """
@stati... | true |
6d4a3ad10bbe4960e2031c3dac430c42e121ddab | capflaum/sqlalchemy-challenge | /climate_app.py | UTF-8 | 5,572 | 2.765625 | 3 | [] | no_license | import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
import datetime as dt
import numpy as np
from flask import Flask,jsonify
#Setup Database
engine = create_engine('sqlite:///Resources/hawaii.sqlite')
Base = automap_base()
Ba... | true |
c2b6356f595a1a988f2ee5125a9c524f60873d69 | USF-Computer-Networking/lanchat-Mlu13 | /send.py | UTF-8 | 428 | 2.984375 | 3 | [] | no_license | import socket
host = '127.0.0.1'
port = 50008
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
print("Connected to " + (host) + " on port " + str(port))
initialMessage = raw_input("Send: ")
s.sendall(initialMessage)
while True:
data = s.recv(1024)
print("Recieved: " + (data))
... | true |
c791b032e8e9f3a738794f31b19c8bbf354af9cb | asobolev/aerodventure | /transform.py | UTF-8 | 2,388 | 2.75 | 3 | [] | no_license | import numpy as np
import os
import colorsys
import math
from PIL import Image
def html_to_rgb(color):
"""
Converts HTML (e.g. E3DBC3) to RGB triple (e.g. (227, 219, 195))
:param color: HTML code as string
:return: RGB triple (3 ints)
"""
if color[0] == '#':
color = color[1:... | true |
b0985147a5af30c454ef4c1d0bc7e4b2b120b0e7 | apalom/EV-Flexibility | /archive/krasserm_orig.py | UTF-8 | 3,782 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 24 15:17:40 2019
@author: Alex
http://krasserm.github.io/2018/03/19/gaussian-processes/
"""
import numpy as np
def kernel(X1, X2, l=1.0, sigma_f=1.0):
''' Isotropic squared exponential kernel. Computes a covariance matrix from points in X1 and X2. Args: X1: Array of... | true |
f64cb7a86fd6fefd1d7e938c2beb0a249103163e | sbrady521/teamDCC | /dynamic_cc.py | UTF-8 | 14,374 | 2.90625 | 3 | [] | no_license | import numpy
import cv2
import itertools
import os
import class_out
#lul
UNCLASS = 0
WHITE = 1
GREEN = 2
ORANGE = 3
MAXVOTES=100
def convertToYUV(BGR):
B = BGR[0]
G = BGR[1]
R = BGR[2]
Y = int(R * 0.29900 + G * 0.58700 + B * 0.11400)
U = int(R * -0.16874 + G * -0.33126 + ... | true |
641cd1eab708866846239ff202f74f36e28d22d9 | amberheilman/StationDown | /stationdown/scrapers/python_scraper/rss.py | UTF-8 | 220 | 2.890625 | 3 | [] | no_license | import feedparser
def print_feed():
firenews = feedparser.parse('http://www.phillyfirenews.com/category/fire_wire/pennsylvania/city-of-philadelphia/feed/')
for item in firenews.feed:
print type(item)
print_feed() | true |
38ffbf2c4ccbdd76933f1c465396077fabe38674 | chelroot/script | /script/script/python/ttime.py | UTF-8 | 202 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import datetime,time
a=datetime.datetime.now().hour
if a>=17:
print ('Запись включена')
if a >= 20:
print ('Запись выключена')
| true |
57aaf9db119dc58fc8493c394f0794bcbe14785e | guillermoojeda/Megachess_EDA5 | /MegaChess/packages/classes/User.py | UTF-8 | 22,604 | 3.5625 | 4 | [] | no_license | import random
from .pieces.Pawn import Pawn
from .pieces.Rook import Rook
from .pieces.Horse import Horse
from .pieces.Bishop import Bishop
from .pieces.Queen import Queen
from .pieces.King import King
from .Board import Board
class User(object):
"""Class that represent a player, or user. It is the actual AI of ... | true |
dc10f0423292ca4888dff4a8ebbf05de99e7372f | antonAce/python-assessment | /students/km62/Kozyryev_Anton/Homework_2.py | UTF-8 | 15,266 | 4.53125 | 5 | [] | no_license | # -*- coding: utf-8 -*-
"""
Домашня робота №2
Тема: "Умовні конструкції"
Студент: Козирєв Антон Юрійович
Група: КМ - 62
"""
import math
#Task_1----------------------------------------------------#
"""
Умова: Дано два цілих числа. Вивести найменше з них.
"""
#print("Task #1");
... | true |
770e55da3f0c4ab74d36f7caf27d0a5dc225fb30 | dmesquita/talks | /[TDC Recife 2019]/data/trilhas-spider.py | UTF-8 | 692 | 2.59375 | 3 | [] | no_license | import scrapy
trilhas = []
class TrilhaSpider(scrapy.Spider):
name = "trilhaspider"
start_urls = []
for cidade in ["saopaulo", "florianopolis","belohorizonte","portoalegre"]:
for ano in range(2014, 2020):
l = "http://www.thedevelopersconference.com.br/tdc/{}/{}/trilhas".format(ano,cida... | true |
fa6ef4ba1aff27d9c98d494167ed7f513f4c0035 | kozr/gZoom | /rpi/camera/opencv5.py | UTF-8 | 1,253 | 2.890625 | 3 | [] | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
def canny(image):
gray = cv2.cvtColor(lane_image, cv2.COLOR_RGB2GRAY)
blur = cv2.GaussianBlur(gray,(5, 5),0)
canny =cv2.Canny(blur, 50, 150)
return canny
def display_lines(image, lines):
line_image = np.zeros_like(image)
... | true |
cbed5b90212561d0d58c1d6ad0eed42983e69194 | avishwas/Zeus2-cycle-box | /old_tests/hkpc_data_parser.py | UTF-8 | 391 | 2.53125 | 3 | [] | no_license | import numpy as np
import datetime
def parse(line):
line = line.strip()
elems = line.split('\t')
datetimestr = elems[0]+' '+elems[1]
timestamp=datetime.datetime.strptime(datetimestr,"%m/%d/%Y %I:%M:%S %p")
values = list(map(float,elems[2:]))
return (timestamp,values)
def get_filename(sensor):
... | true |
6143c2efe8a04e19d4f9f86d6175e3427c20de70 | elyobb/jig-see-python | /Main.py | UTF-8 | 1,262 | 2.703125 | 3 | [] | no_license | import cv2
import numpy as np
from matplotlib import pyplot as plt
def reject_outliers(data, m=2):
return data[abs(data - np.mean(data)) < m * np.std(data)]
img = cv2.imread("img.jpg", 0)
img50 = cv2.imread("img50.jpg", 0)
ret, thresh1 = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY)
ret, thresh2 =... | true |
a2ee2b3c1e43baf0bbe789d8582707968ac956fb | gabrielStanovsky/mt_gender | /src/generate_table.py | UTF-8 | 1,937 | 3.03125 | 3 | [
"MIT"
] | permissive | """ Usage:
<file-name> --in=INPUT_FILE --out=OUTPUT_FILE [--debug]
Create a table format with delta-G and delta-S from an output of several systems.
"""
# External imports
import logging
import pdb
from pprint import pprint
from pprint import pformat
from docopt import docopt
from pathlib import Path
from tqdm im... | true |
cfb8e1c326adba2b90ecd785cdd8e0556dbb1fe5 | ferry5245/Basic-Coding | /Python learning/Coursera/Vid_Ex/Strings3.py | UTF-8 | 304 | 3.859375 | 4 | [] | no_license | def count(a,b):
counting=int(0)
i=int(0)
for i in a:
if i==b:
counting+=1
return counting
sentence = input("Input your word here : ")
letter = input("What letter do you look for? ")
found=count(sentence,letter)
print("The sentence has %d letter %s" %(found,letter))
| true |
a53afd2cee8c72ac75a0825ea3c5ea89fc41215e | lianglee123/leetcode | /utils/list_node_utils.py | UTF-8 | 667 | 3.71875 | 4 | [] | no_license | from typing import List
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Utils:
@staticmethod
def array_to_node(values: List):
sentry = ListNode()
ptr = sentry
for v in values:
ptr.next = ListNode(v)
... | true |
6d976260dd422e2b8cd8a2ff13b17fb0b6ecf4f9 | bit1creative/pandas_lab2 | /names.py | UTF-8 | 3,793 | 3.28125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
df = pd.read_csv('names.csv')
def countNames(names):
males = names.loc[names["Sex"]=='M'].groupby('Sex').sum()['Count'].to_numpy()
females = names.loc[names["Sex"]=='F'].groupby('Sex').sum()... | true |
d12658597302b18d4cc074688e18fc8d4328d528 | DigitalSlideArchive/HistomicsTK | /histomicstk/utils/simple_mask.py | UTF-8 | 8,431 | 3.03125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | import numpy as np
def simple_mask(im_rgb, bandwidth=2, bgnd_std=2.5, tissue_std=30,
min_peak_width=10, max_peak_width=25,
fraction=0.10, min_tissue_prob=0.05):
"""Performs segmentation of the foreground (tissue)
Uses a simple two-component Gaussian mixture model to mask tissue... | true |
c897657e60be0cf2efe0f131c612a13b8a00afb0 | helenlavr/Tic-Tac-Toe | /Problems/Favor/main.py | UTF-8 | 246 | 3.8125 | 4 | [] | no_license | '''
1: count sum from 1 to k.
2: add numbers from 1 to k --> print
'''
k = int(input())
i = 1
list_of_k = []
while i <= k:
list_of_k.append(i)
i += 1
print(sum(list_of_k))
'''
k = int(input())
print(sum(i for i in range(1, k + 1)))
'''
| true |
581dac4171f9075b535fd1451ef61d53bdd1596a | Jeremyy55/AO_TP1 | /jeremy.py | UTF-8 | 3,797 | 2.953125 | 3 | [] | no_license | import numpy as np
from random import shuffle
from collections import namedtuple
from hypervolume.jer import domine_max, domine_min
Combo = namedtuple('Combo', 'x solution')
def create_combo(x, objs):
return Combo(x=x, solution=get_solution(x, objs))
def avoid_double(archive):
"""
convertis l'arch... | true |
35a0c52a5ba91252d3f9cb02446dd955b7ed3211 | lpianta/ai_fall_exercises | /B1/goodreads_short_scraper.py | UTF-8 | 3,366 | 2.703125 | 3 | [] | no_license | from gevent import monkey as curious_george
curious_george.patch_all(thread=False, select=False)
import grequests
import pandas as pd
import numpy as np
import re
import click
from bs4 import BeautifulSoup
link_base_string = "https://www.goodreads.com/list/show/6.Best_Books_of_the_20th_Century?page={}"
def three_genr... | true |
b26a2d58a9074dc9ea5c90d11e662242d3c0cab5 | Aayush360/Shamshad_Ansari_CV_ANN | /list_2_4.py | UTF-8 | 507 | 3.46875 | 3 | [] | no_license | # Drawing a rectangle to an image
from __future__ import print_function
import cv2
image_path = '../images/test.jpg'
image = cv2.imread(image_path)
start = (100,70)
end = (350,100)
# set the thickness and outline
color =(0,255,0)
thickness =5
# draw a rectangle
cv2.rectangle(image,start,end,color,thickness)
# sa... | true |
95ca13d2ed0359a4e243d32f77b49ab03e70a873 | malbt/PythonFundamentals.Exercises.Algos | /test_search.py | UTF-8 | 669 | 3.15625 | 3 | [] | no_license | import unittest
import search
class TestSearch(unittest.TestCase):
def test_binary_search(self):
self.assertEqual(search.binary_search([24, 10, 1, 64, 99, 9, 12], 9), 1)
self.assertEqual(search.binary_search([20, 10, 31, 4, 800, 799, 600], 600), 4)
self.assertEqual(search.binary_search([... | true |
94d7397d25705bc31381db4b932d96d5fd2ff979 | korylprince/adventofcode | /2021/15/main.py | UTF-8 | 1,007 | 3.28125 | 3 | [] | no_license | import heapq
G = dict()
with open("./input.txt") as f:
for y, row in enumerate(f.read().strip().splitlines()):
for x, v in enumerate(row):
G[(x, y)] = int(v)
START = (0, 0)
END = (max([x for x, y in G.keys()]), max([y for x, y in G.keys()]))
rows, cols = END[1] + 1, END[0] + 1
d = ((0, 1), (0... | true |
3d4f4990939c722093b5e6b6a30473822ee1cd41 | Klose6/Leetcode | /65_valid_number.py | UTF-8 | 528 | 3.4375 | 3 | [] | no_license | """
65 valid number
"""
def valid_number(s):
s = s.strip()
point = False
e = False
number = False
number_after_e = True
for i in range(len(s)):
if s[i].isdigit():
number = True
number_after_e = True
elif s[i] == ".":
if e or point:
return False
point = True
elif s[i] == "e":
if e or not... | true |
e99891bef363821c6fbde4d5ba3148ec5a9f803a | sergei-romanenko/staged-mrsc-python | /smrsc/mock_sc_world.py | UTF-8 | 551 | 2.8125 | 3 | [] | no_license | from typing import List
from smrsc.big_step_sc import ScWorld
class MockScWorld(ScWorld[int]):
History = List[int]
C = int
def is_dangerous(self, h: History) -> bool:
return len(h) > 3
def is_foldable_to(self, c1: C, c2: C) -> bool:
return c1 == c2
def develop(self, c: C) -> List... | true |
fc3823e7d79dfedc1fb37cd39b23a4cb15ba675a | Raulbjj928/URI.RaulFurtado | /1080.py | UTF-8 | 138 | 3 | 3 | [] | no_license | LISTA=[]
for i in range(1,101):
N=int(input(''))
LISTA.append(N)
MAIOR=max(LISTA)
POS=LISTA.index(MAIOR)
print(MAIOR)
print(POS+1) | true |
05baffe6fece8f7e1afe64ed658956066fe1d22b | sourav-coder/Python-Code-Challanges | /Python Code Challenges/100-plus-Python-programming-exercises-extended-master/solutions/Day-17/68.py | UTF-8 | 46 | 2.53125 | 3 | [] | no_license | import random
print(random.uniform(10,100))
| true |
5bdad73079e91509273de1c7882fe2ab84d2226e | ca-scribner/general_utils | /general_utils/decorators.py | UTF-8 | 1,163 | 3.234375 | 3 | [] | no_license | def read_only_properties(*attrs):
"""
Decorator to make select attributes from a class read-only.
Overrides _setattr_ to raise an AttributeError whenever any attributes listed in attrs is set. This results in
attributes that are initially writable (during __init__ of the object), but immediately after... | true |