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
eaacb78c75c763c984a2199624aeced9363443a3
JGuevara27/datacamp
/4_ML_w_treebased_models_python_incomplete/3_bagging_and_random_forests/2-obb_evaluation.py
UTF-8
1,278
3.25
3
[]
no_license
# OOB EVALUATION IN SKLEARN # Import models and split utility function from sklearn.ensemble import BaggingClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split # Set seed for reproducibility SEED = 1 # Split data int...
true
012f1d64bc09e1d962aae095eee63af151546b16
PandorasFox/kaie
/parsing/ntwewy_types/loc.py
UTF-8
1,714
2.890625
3
[ "LicenseRef-scancode-public-domain" ]
permissive
from collections import defaultdict class LocaleError(Exception): """Exception raised when trying to access a field not available in locale""" def __init__(self, lang, needed_lang): # TODO: dict of {lang => error message} # The locale error should probably be localized itself :) super()...
true
103a0cf57edf524853a93c28a2477c87d143d594
surinnin2/flask-blogly-part3
/models.py
UTF-8
1,839
2.609375
3
[]
no_license
"""Models for Blogly.""" from flask_sqlalchemy import SQLAlchemy from datetime import datetime db = SQLAlchemy() def get_time_now(): now = datetime.now() dt_string = now.strftime("%m/%d/%Y %H:%M:%S") return dt_string def connect_db(app): db.app = app db.init_app(app) class User(db.Model): "...
true
cee2a1da6538ed546430dcda8d85ac7bb9ae8282
snst/bikecomputer
/src/display.py
UTF-8
5,134
3.03125
3
[]
no_license
import math from const import * import data_global as g class Display: width = 135 height = 240 def __init__(self, tft): self._tft = tft #self.m = 0 #self.buffer = bytearray(2900) def draw_aligned_text_old(self, font, text, x, y, align = Align.left): if align == Al...
true
5d7d2f00b44a77709b8eb949f03e74ebba0f5541
IceFree2014/python_study
/Use_Python_crawl/code/data-science/lagou_data_product_manager/BA_jobs_lagou_multiple.py
UTF-8
5,576
2.78125
3
[]
no_license
#!/usr/bin/env python3 # -*- encoding:utf-8 -*- # Scraping the web page using Selenium # Selenium with geckodriver # Since we are unable to access the content of the web page using BeautifulSoup, # we first need to set up a web driver in our python script # 1.Using selenium with Firefox web driver # 2.Using a headle...
true
9941da624adc17ad737eebbd325560eeb3a65241
KevinZWong/Kevin_PythonClasses
/Assignment3/Assignment3a.py
UTF-8
172
3.90625
4
[]
no_license
import math print("3.4") print("Enter a side lenth:") side = int(input()) area = (5*side**2)/(4*math.tan(math.pi/5)) print("The area of the pentagon is", area)
true
900434d2d6a58178537c76e63ac8a63a5776fd52
dannyotown/Intro-Python-II
/src/room.py
UTF-8
799
3.90625
4
[]
no_license
# Implement a class to hold room information. This should have name and # description attributes. from item import Item class Room: def __init__(self, location, description, items): self.location = location self.description = description self.n_to = None self.s_to = None se...
true
247572a2ce7eab662f10f4d6e26f1b81477709ef
DilaraPOLAT/Algorithm2-python
/6.hafta(dict,set)/labfonk.py
UTF-8
3,534
3.03125
3
[]
no_license
# # #örnek1 # # import time # # # # def mukemmel_bul(adet,altlimit=0): # # sayac =0 # # if altlimit <=0: # # altlimit = 1 # # sayilar =list() # # def mukemmelmi(sayi): # # bolen_top = 0 # # for i in range(1,sayi): # # if sayi%i == 0: # # bolen_top +=i...
true
509aac21136e28ad89671ad200810e38b360143c
Chinyenwu/-FJU
/templates/computer.py
UTF-8
5,890
2.578125
3
[]
no_license
import numpy as np #import matplotlib.pyplot as plt import csv import math # import matplotlib.pyplot as plt list2010 = [] list2011 = [] list2012 = [] list2013 = [] list2014 = [] list2015 = [] with open('C0ACA0-2010-03.csv' , newline = '') as csvfile: rows = csv.reader(csvfile) for row in rows : l...
true
67ef1d602c0aee99de958016b7f6136e29952d38
VL-Impact/arcade-curtains
/tests/test_events.py
UTF-8
1,646
2.671875
3
[ "MIT" ]
permissive
from unittest.mock import Mock import pytest from arcade.key import ESCAPE from arcade_curtains.event import EventHandler @pytest.mark.parametrize("event,triggers", [ ('down', [('trigger_down', (50, 50))]), ('up', [('trigger_up', (50, 50))]), ('click', [('trigger_down', (50, 50)), ('trigger_up', (50, 50...
true
ca4db53357e07c4747bf0894e2d183f693adb183
haratzouvara/document_image_binarization
/attention_Ushape/attention_modules.py
UTF-8
4,246
2.546875
3
[ "MIT" ]
permissive
class AttentionModules(tf.keras.layers.Layer): """ -- Attention Modules -- 'attention module' based on : This method includes channel attention and spatial attention modules It uses decoder's feature map to weight skip encoder f...
true
f05b38e8edae94b3efc8113a48f199c4c85beb76
Namanbukday/SAS-projects
/GradientBoostingClassification.py
UTF-8
4,716
3.8125
4
[]
no_license
# importing libraries import pandas as pd from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report, confusion_matrix from sklearn.ensemble import GradientBoostingClassifier # Loading titanic dataset (test and train) : train_...
true
9723a6ea77e4ca683a5a0d60e715547398fd73b9
kentfrazier/Exhibitionist
/Examples/boilerplate/app.py
UTF-8
3,082
2.765625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import print_function import os from exhibitionist import get_server from exhibitionist.util.common import UrlDisplay import handlers pjoin = os.path.join dirname = lambda x: os.path.abspath(os.path.dirname(x)) # tell the server where the templates and stat...
true
a9cbf1578815cb02271aed4b2878a73f11a3d08b
tebot/Instagram-Automation
/instabot.py
UTF-8
2,125
2.8125
3
[]
no_license
from selenium import webdriver import webbrowser from time import sleep class InstaBot: def __init__(self, username, pw): self.driver=webdriver.Chrome("C:\\<Path to chromedriver>\\chromedriver.exe") self.driver.get("https://www.instagram.com/") sleep(2) #accept coolkies se...
true
8c3cd9265940117048b5049bc31b547977c1cc2a
gabrielvtan/ByteAcademy-FullStack
/Phase1/Week3/3.4-BattleShip/battleshipV2/view.py
UTF-8
1,103
3.484375
3
[]
no_license
from board import Board import os import re MAXTRIES = 100 W = 7 H = 7 def inputxy(): print("x from 1 to {}, y from 1 to {}.".format(W, H)) inp = input("Input x,y: ") m = re.search("(\d+)[, ]+(\d+)", inp.strip()) if not m: return None, None x = int(m.groups()[0]) y = int(m.groups()[1...
true
d6011f06454a6b6cc263298429e597cf406c23bf
Ratonhnaketon/Raspberry_pi_controllers
/Core/slaveController.py
UTF-8
797
2.84375
3
[]
no_license
from threading import Thread import RPi.GPIO as GPIO voltageMaps = { 'HIGH': GPIO.HIGH, 'LOW': GPIO.LOW } class SlaveController(Thread): def __init__(self): Thread.__init__(self, controllerType) self.daemon = True self.controllerType = GPIO.IN if 'IN' else GPIO.OUT self....
true
e1c848c95fb2933853f5535061fc17a259d260f7
SenitCo/machine-learning-code
/SVM_SMO/kernel_svm.py
UTF-8
10,831
2.703125
3
[]
no_license
#encoding:utf-8 from numpy import * import svm ''' 以下是有核函数的版本 http://www.cnblogs.com/tonglin0325/p/6107114.html ''' ''' 核转换函数 @X 样本矩阵 @A 某一个样本 @kTup 核函数 @return 变换后的样本(高维空间) ''' def kernelTrans(X, A, kTup): m, n = shape(X) K = mat(zeros((m, 1))) if kTup[0] == 'lin': # 线性核函数 K = X * A.T elif...
true
cbc37bfd481bc36abdfa477090f75ab922c62f04
Giulianos/ss-2018b-tp4
/python/plot_positions.py
UTF-8
865
3
3
[]
no_license
import sys import matplotlib.pyplot as plt inputs = [] for index in range(1, len(sys.argv), 2): input = { 'filename': sys.argv[index], 'label': sys.argv[index+1], 'file': open(sys.argv[index], "r") } inputs.append(input) for input in inputs: read = True input['positions'] ...
true
7def89d7b7f875c09431a07e51ee7a049ed2dca4
richardph911/adv-python-learning
/helper_func/lecture12.py
UTF-8
2,693
4.09375
4
[]
no_license
# ---------------------------------------------------------------------- # Name: lecture12 # Purpose: Demonstrate context managers # # Author: Rula Khayrallah # ---------------------------------------------------------------------- """ Module containing some definitions to be used in lecture 12. A Time...
true
1ecf595437bb80e7817042987974a00cfcd672fa
Rudy-balzano/ASAIoT
/Projet/Arduino/testArduino.py
UTF-8
116
2.78125
3
[]
no_license
import serial import time ser = serial.Serial('/dev/ttyACM0', 9600) while 1 : print(ser.readline()) time.sleep(1)
true
942ba8111cb33c3ba8110a69f67172c48d11bdd0
RPMorganomous/Linux-Server-Configuration
/lotsofalbums.py
UTF-8
17,805
2.671875
3
[]
no_license
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from band_database_setup import Band, Base, AlbumItem, User engine = create_engine('postgresql://catalog:catalog@localhost/bandalbumswithusers') # Bind the engine to the metadata of the Base class so that the # declaratives can be accessed t...
true
545f7bee096343433db07be2647446e075214ddc
drewthayer/py-utils
/resize_image.py
UTF-8
726
2.609375
3
[]
no_license
import argparse from py_utils.io.filehandling import create_output_filepath from py_utils.image_processing.resize import resize_image def main(): parser = argparse.ArgumentParser() parser.add_argument('f', help='file') parser.add_argument('--frac', default=0.5, type=float, help='fraction to resize to') ...
true
c9020b85c35f7242b7da2b73c401893e94d7d24e
ZhongruiNing/ProjectEuler
/Code of ProjectEuler/problem4.py
UTF-8
500
3.25
3
[]
no_license
def ishuiwen(num): #flag = 0 回文数 #flag = 1 非回文数 flag = 1 str_yuan = str(num) str_fan = str_yuan[::-1] if str_fan == str_yuan: flag = 0 return flag result = 0 for i in range(100,1000,1): for j in range(i,1000,1): temp = i * j if ishuiwen(temp) == 0: ...
true
4c2be7a12ce7d6c193af222044e3e407dd9a061e
kduan005/Leetcode
/leetcode576.py
UTF-8
921
2.765625
3
[]
no_license
class Solution(object): def findPaths(self, m, n, N, i, j): """ :type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int """ def dfs(m, n, N, i, j, dic): if (i, j, N) in dic: return dic[(i, j, N)...
true
c1dce41cb54b0d026e4cae3d1456d6f62c76800a
solgenomics/nicotiana
/subGenomeAssignment/TE/repeats.py
UTF-8
5,579
2.78125
3
[]
no_license
import bisect from scipy import stats import numpy as np import matplotlib.pyplot as plt def find_gt(a, x): #Find the index of leftmost value greater than x i = bisect.bisect_right(a, x) if i != len(a): return i raise ValueError def find_lt(a, x): #Find the index of rightmost value less th...
true
3a54a6e5e1f8f1794448dd1b24adfe1d0a9cd719
WillianPessoa/LIpE-Resolution-of-Exercises
/A01E11_cedulas.py
UTF-8
984
4.03125
4
[]
no_license
#!/usr/bin/python3 print("[CALCULANDO A MÁXIMA QUANTIDADE DE CÉDULAS]\n") valor = int( input("Insira o valor: ") ) # Calculando a quantidade de notas através do operador de divisão inteira notas100 = valor // 100 # Atualizando o valor utilizando o operador módulo (resto) valor = valor % 100 # Repetindo para todas a...
true
d6702dab3ff7ad019af7fcf3e5a58fbb4649f3fd
vishy1988/mass_mutual
/practice.py
UTF-8
4,421
2.640625
3
[]
no_license
import sqlite3 import pandas as pd from flask import * import matplotlib.pyplot as plt from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from io import BytesIO,StringIO app = Flask(__name__) @app.route("/social_media_summary") def show_graph(): connection = sqlite3.connect('recruit.db') ...
true
d0e54f77d045d765b69a07157d66215c6e52a016
tranquyenbk173/20201_Courseworks
/Intro_DataScience/checkData.py
UTF-8
1,150
2.875
3
[]
no_license
# link visualize data # https://colab.research.google.com/drive/1J4FrbZ9lpRp87hK2hfYc0Wyu1B9d8SqF?usp=sharing import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns import warnings; warnings.filterwarnings(action='once') import random import math df =...
true
238d10ddbde78bd7cec81e3c8d2a1ad1fc79bded
nguyenngochuy91/programming
/google kick start/2019/round c/Circuit_Board.py
UTF-8
1,090
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun May 26 05:24:49 2019 @author: Huy Nguyen """ def solve(R,C,K,matrix): nums = set() for item in matrix: for number in item: nums.add(number) currentMax = 0 for number in nums: res, histRow = 0, ([0 for _ in matrix[0]]) if matrix else...
true
8bd392d24399e1c5700f8770fac6019b2a35390a
Valkyrja3607/AtCoder
/atcoder.jp/abc039/abc039_d/Main.py
UTF-8
1,130
2.703125
3
[]
no_license
h,w=map(int,input().split()) s=[] s.append("#"*(w+2)) l=set() for i in range(h): s.append("#"+input()+"#") for j in range(1,w+1): if s[-1][j]=="#": l.add((i,j-1)) s.append("#"*(w+2)) f=[] for i in range(1,h+1): p="" for j in range(1,w+1): if s[i][j]=="#": c=0 ...
true
6aca71b95aab7b6ad3b2d45c273706354eee3eac
mor282/DBS
/DBS_FINAL_PROJECT/SRC/APPLICATION-SOURCE-CODE/queries.py
UTF-8
14,351
2.578125
3
[]
no_license
""" This module contains all the app queries """ import mysql.connector from mysql.connector import errorcode #db connection-------------------------------------------------------------------------------------------- def connect_to_db(): """ connects to the database, execute the query and return cnx. cn...
true
b6ee34073463e5422a377021ddb78009adf8f009
mloveys/PY4E
/Assignment 4.6/main.py
UTF-8
661
3.75
4
[]
no_license
def computepay (hours, rate): try: hours = float(hours) rate = float(rate) except: print("Invalid hours or rate received") return 0; totalpay = 0 if hours > 40: # Standard Pay for first 40 hours totalpay = (40 * rate) # Total Pay...
true
67d6f3451c232835c785d738b92e4c93a7e0a6d4
harzival/uniscan-compose
/misc.py
UTF-8
420
3.40625
3
[]
no_license
from os import mkdir, path def create_dir_if_absent(directory): if path.isdir(directory) is False: try: mkdir(directory) except OSError: print("UNISCAN: Creating %s FAILED ! Exiting :(" % directory) return -1 else: print( "UNI...
true
4086d0539cce50b8283762677013b9d9b5239941
jchaconm/PythonGroup_12
/Python 2/Clase N8/django_skeleton/apps/common/datastructures.py
UTF-8
3,356
3.28125
3
[]
no_license
# coding: utf-8 """ Estructuras de Datos ==================== """ class Enumeration(object): """ Una clase de ayuda que provee `choices` más entendibles para los fields de Django. Puede utilizarse una instancia de esta clase directamente como ``choices`` al momento de definir algún field. Ejemplo...
true
bbb48be9afdd75fe67e20cc504a1acfe376545d3
dmweiwei/improve_bank_MLflow
/new_main.py
UTF-8
2,401
2.671875
3
[]
no_license
import mlflow import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.ensemble import AdaBoostClassifier from sklearn.model_selection import RandomizedSearchCV from sklearn.model_selection import train_test_split from settings import hy...
true
a272105718034e5c52dfce4cb70bd3e9f39671ee
srmurthy428/mypython
/PhysicsScore.py
UTF-8
880
3.171875
3
[]
no_license
def takeSecond(elem): return elem[1] def takeFirst(elem): return elem[0] def lowMarkk(elem): return elem[0][1] if __name__ == '__main__': fullList=[] for _ in range(int(input())): name = input() score = float(input()) l = list((name,score)) fullList.append(l) ...
true
6e5a90a16cb5bf219b31476c3df08ab0ffb46eaf
rknLA/pale
/tests/example_app/api/endpoints.py
UTF-8
6,557
2.5625
3
[ "MIT" ]
permissive
import datetime from multiprocessing import Manager from pale import Endpoint, PatchEndpoint, PutResourceEndpoint from pale.arguments import BooleanArgument, IntegerArgument, StringArgument from pale.resource import DebugResource, NoContentResource from pale.errors.api_error import APIError from tests.example_app.mod...
true
772a0fada8450721f4d9b970e01172a8a91345dc
chaoshangcs/core
/av4_input.py
UTF-8
12,910
2.65625
3
[]
no_license
import tensorflow as tf from glob import glob import os,time from av4_utils import generate_deep_affine_transform,affine_transform def index_the_database_into_queue(database_path,shuffle): """Indexes av4 database and returns two lists of filesystem path: ligand files, and protein files. Ligands are assumed to ...
true
0b0ecb6b295e5e600b6465d252a5b8041aad2e51
abhimanyupandey10/python
/maths.py
UTF-8
402
4
4
[]
no_license
import math , random s = float(input('Enter a number with decimal: ')) print('Rounded up your number: ' , math.ceil(s)) print('Rounded down your number: ' , math.floor(s)) num = 4 print( num , 'Squared: ' , math.pow(num,2)) print( num , 'Squared Root: ' , math.sqrt(num)) nums = random.sample(range(1,49) , 6) prin...
true
7afc21c3d71e8a49feca14875689c30821e6ac48
18521449/Nhom-5
/week 3/Python/Imatotext.py
UTF-8
1,990
2.875
3
[]
no_license
import cv2 import numpy as np import ctypes def de2hex_floating_point(x): return hex(ctypes.c_uint.from_buffer(ctypes.c_float(x)).value) img_rgb = cv2.imread('image.jpg') img_resize = cv2.resize(img_rgb, (100, 100), interpolation = cv2.INTER_NEAREST) # Lay thong tin cua anh (h, w, d) = img_resize.s...
true
f229da618079d4563c6b4872d7647602543912a9
lucasheriques/leetcode-solutions
/algorithms/sorting.py
UTF-8
862
3.90625
4
[ "MIT" ]
permissive
def selection_sort(nums): length = len(nums) for i in range(length): smallest_index = i for j in range(i + 1, length): if nums[j] < nums[smallest_index]: smallest_index = j if i != smallest_index: nums[i], nums[smallest_index] = nums[smallest_inde...
true
cd537d97e74af8b4dfe87d2f15fe2e2843f53316
grepthink/grepthink
/teamwork/apps/core/helpers.py
UTF-8
8,012
2.515625
3
[]
no_license
"""Helper functions for core module.""" # csv import csv from django.conf import settings from django.contrib.auth.decorators import login_required # Django from django.contrib.auth.models import User from django.db.models import Q from django.http import (HttpResponse, HttpResponseBadRequest, ...
true
25153e4f0f30a62038138186f891a34650d2502b
rohansaphal97/Reinforcement_learning
/policy_eval.py
UTF-8
679
2.546875
3
[]
no_license
import numpy as np import sys if "../" not in sys.path: sys.path.append("../") from lib.envs.gridworld import GridworldEnv env=GridworldEnv() def policy_eval(policy,env,discount_factor=1.0,theta=0.00001): V=np.zeros(env.nS) while True: delta=0 for s in range(env.nS): v=0 for a,action_pro...
true
5833f594b405bb41326ebd063941dd3041bc7da9
coke05288/Python-Study
/DataStructure/02-Python-Review/4_custom_function.py
UTF-8
322
3.375
3
[]
no_license
list1 = [22, 3, 4, 45, 24, 0] def find_MAX_MIN(list1): max = list1[0] min = list1[0] for i in range(0, len(list1)): if max < list1[i]: max = list1[i] if min > list1[i]: min = list1[i] return max, min # return tuple answer = (find_MAX_MIN(list1)) print(answer...
true
0e3caab3ed6504e9facdce139b4a5b500df1aa64
mattbellis/matts-work-environment
/PyROOT/RooFit_intro/intro5.py
UTF-8
3,253
2.625
3
[]
no_license
#!/usr/bin/env python ############################################################### # intro5.py # Matt Bellis # bellis@slac.stanford.edu # Dec. 6, 2008 # Rewritten from intro5.C from RooFit tutorials found at # http://roofit.sourceforge.net/docs/tutorial/intro/index.html #############################################...
true
ea400b4a1e6fdb262be546441bc7dc8a4e445768
thhsu116/LeetCode
/BinaryTree/236_LowestCommonAncestorofaBinaryTree_med.py
UTF-8
1,353
3.328125
3
[]
no_license
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None # https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/discuss/65225/4-lines-C++JavaPythonRuby class Solution(object): # recursive def ...
true
026417e35697e5d94396d18bb627f95ef1b8cd20
eburbanol/mecanica-celeste
/punto1[1].py
UTF-8
1,582
3.28125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed May 22 16:41:45 2019 @author: Someone in Somewhere """ G=6.674e-11*(1/149596870700**3)*(86400**2) #constant G en unidades de UA^3/(dia^2 kg^2 ) m1=0. m2=2.0e30 def datos(x,y,z,dx,dy,dz): r=(x*x+y*y+z*z)**(1/2) u=G*(m1+m2) """ Par...
true
6dda2c9ae995cd573f3eb6021b73dcb79530177b
ChechG/holbertonschool-higher_level_programming
/0x0F-python-object_relational_mapping/11-model_state_insert.py
UTF-8
601
2.59375
3
[]
no_license
#!/usr/bin/python3 """ comment """ import sys from model_state import Base, State from sqlalchemy.orm import sessionmaker from sqlalchemy import (create_engine) if __name__ == "__main__": MY_STATE = "Louisiana" engine = create_engine('mysql+mysqldb://{}:{}@localhost/{}' .format(sys....
true
2c3aeb7789739e7d07013b0620e10301c4dfa5c6
BrechtVandevoort/AdventOfCode
/2018/day_01/day01_1.py
UTF-8
173
3.296875
3
[]
no_license
result = 0 with open("input.txt") as puzzle_input: for freq_change in puzzle_input: result += int(freq_change) print("The resulting value is {}".format(result))
true
dcdffb81c779ad3590d7a5d76f7898a77077bf3e
RZachLamberty/adventofcode
/2016/day2.py
UTF-8
2,616
3.078125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Module: day2.py Author: zlamberty Created: 2016-12-02 Description: day 2 puzzles for the advent of code (adventofcode.com/2016/day/2) Usage: <usage> """ import os import eri.logging as logging # ----------------------------- # # Module Constants ...
true
37ea0ac15895817c13098773f4010a90d3796969
chandana44/sketch2cartoon
/src/preprocess/preprocessing.py
UTF-8
837
2.625
3
[]
no_license
from __future__ import print_function from os import listdir from os.path import isfile, join import sys from PIL import Image if len(sys.argv) != 3: print('Please provide <raw_images_path> and <cropped_images_path> as arguments..') sys.exit(1) raw_images_path = sys.argv[1] cropped_images_path = sys.argv[2]...
true
faba15d2069e1db41b1a9717bde6e276b4cef6b3
akihiro-hosoya/study-python
/python-izm_basic/import.py
UTF-8
334
3.046875
3
[]
no_license
class TestClass: def __init__(self): print('create TestClass') def test_method(self, val): print('call test_method') print(val) import testmod test_class_1 = testmod.TestClass() test_class_1.test_method('1') from testmod import TestClass test_class_2 = TestClass() test_class_2.te...
true
fd4da2c6e784d04d8c47a37b8e947f4687635596
patelankit706/encrypted-student-data
/dependencies/display_info.py
UTF-8
2,103
2.703125
3
[]
no_license
import sys try: from Tkinter import * except ImportError: from tkinter import * try: import ttk py3 = False except ImportError: import tkinter.ttk as ttk py3 = True from . import unknown_support info=() def vp_start_gui(): ''' display information of student in textbox ''' g...
true
165ede7116601214b1dfa85afbc2d39dff80d546
muniswarv/PythonBasics
/StdLibs/json/Ex2_IBISParserUseModel_try.py
UTF-8
1,185
3
3
[]
no_license
#!/usr/bin/env python import json class c1: """ Not working Strategy. Need to write class specific methods """ Json = "JsonDBName.db"; dataHash = {}; def __init__(self): self.dataHash["prop1"] = "C1_Model" self.dataHash["prop2"] = "C1_ModelName" self.dataHash...
true
c34e0766ea1e02b52c9e1a2bfd2dfdc0b80f3dfc
manogna-s/traffic_rlagent
/util.py
UTF-8
3,438
2.921875
3
[]
no_license
import pandas as pd from cycler import cycler import matplotlib.pyplot as plt import numpy as np plt.rc('lines', linewidth=2) plt.rc('axes', prop_cycle=(cycler('color', ['#e41a1c','#377eb8','#4daf4a','#984ea3']))) # line colors class encodeStates(object): def __init__(self, observation_space, num_green_phases, ma...
true
746dc4502d4e7a68f70ea6f10db88bf2676d5d19
CoderPrans/Hello_py
/robotic_vision/edgedetection.py
UTF-8
929
2.78125
3
[]
no_license
#!/usr/bin/env python import numpy as np import scipy import matplotlib.pyplot as plt from skimage import io, color, exposure, data from pylab import subplot # Load the image img = data.astronaut() # Convert the image to grayscale (1 channel) img = color.rgb2gray(img) subplot(1,2,1) plt.imshow(...
true
daf924a20992aa4c2d80f2483823b16d4ad590d6
happyquokkka/TIL_Python
/common_education/06. While/01_While.py
UTF-8
628
4.28125
4
[]
no_license
# 01.While.py # While문 : 조건식이 만족하는 동안 반복을 수행(반복의 횟수가 결정되어지지 않았을 때 주로 사용) # 초기값 - 초기값이 없으면 조건 확인이 불가능(but 생략가능) # While 조건 : # 문장 1 # 문장 n # 증가감 - 증가감이 없으면 반복을 종료할 수 없음(생략가능) i=1 # 초기값 while i <= 10 : #조건 print(i, end='') i = i +1 # 증가(반복을 탈출하기 위한 코드) print(i) # 초기값이 없는 경우 # 증가감이 없는 경우 # test 문자를 무한으로 ...
true
d146bd1d9e1c865c4921b9a771a438ce48d474a6
DL2021Spring/CourseProject
/data_files/Flowers.py
UTF-8
617
3.140625
3
[]
no_license
__author__ = 'Danyang' class Solution(object): def solve(self, cipher): N, K, C = cipher C.sort(reverse=True) group_cnt = N / K + 1 total_cost = 0 for i in xrange(group_cnt): unit_cost = i + 1 total_cost += unit_cost * sum(C[i * K:(i + ...
true
00388a3477e1c0cbb2d35ea228362461fac68e78
Mrxwise/MLearn
/BayesClassificator.py
UTF-8
3,606
3.390625
3
[]
no_license
import numpy as np import pandas as pd import math def NaiveBayesMethod(dataSet): # 朴素贝叶斯方法 attrSet = dataSet.columns[:-1] # 获得数据集的特征列 labelTag = dataSet.columns[-1] # 获得数据集的label attrProbabilityMap = {} # 构建特征-概率图 labelCount = dict(dataSet.iloc[:, -1].value_counts()) # 统计label的数目 ...
true
3f7f4b959e3f8780df3c0f994a5ef69222830796
johnsogg/cs1300
/code/py/if_statements.py
UTF-8
206
3.734375
4
[]
no_license
x = 17 if x < 0: print "It is in the FIRST category." elif x < 11: print "SECOND category" elif x < 40: pass elif x > 100: pass else: print "FINAL category." if x > 6: print "Yay"
true
5a5f95305d57f249d98cecefaa7e24fc54d3f388
gomsvicky/PythonAssignmentset2
/Program37.py
UTF-8
804
3.484375
3
[]
no_license
dic1 = { "name" : "Goms", "ID" : "123456", "status" : "Active" } dic2 = { "age" : 27, "year" : 1991, "month" : "September" } dic3 = { "location" : "Bangalore", "husband" : "Vignesh", "Marriage" : True } print("Comparison operator is not supported in Python 3") print("Dictiona...
true
586b6b0bc237447c9d1c9430358c3e8c60d19c75
kn25ha01/kaggle-competitions
/2020/cassava-leaf-disease-classification/util/yml.py
UTF-8
214
2.65625
3
[ "MIT" ]
permissive
import yaml def get_config(yml_path, logger=None): if logger: logger.info(f'open {yml_path}') with open(yml_path, 'r') as f: config = yaml.load(f, Loader=yaml.FullLoader) return config
true
480bfce65aae082a943dd8dd972fa751bc6ddff6
COS301-SE-2020/Swift
/ml-api/controller/estimatedPrepTime.py
UTF-8
146
2.578125
3
[]
no_license
# estimatedPrepTime Module - updates the item's estimated preperation time according to prior data def updatePrepTime(): return "hello world"
true
0fc8ed4e877faa45244932f80ddd919565f3837e
LoriSanduleac04/Introducere_Afisare_Calculare
/problema 6.py
UTF-8
354
3.609375
4
[]
no_license
""" Doi copii au primit acelaşi număr de mere Introducând de la tastatură numărul de mere primte, afişaţi câte mere are fiecare copil după ce primul copil mănâncă un măr şi dă unul celuilalt copil. """ n=int(input("introduceti nr de mere")) c1=n-2 c2=n+1 print("primul copil are", c1,"mere") print("al doilea co...
true
e97f0968a9d4a8e745b37d06621ccc0d73a9ae64
fqx9904/distributed-de
/de/distributed/manager.py
UTF-8
2,385
2.640625
3
[]
no_license
import multiprocessing as mp import zmq import time import numpy as np from de import DifferentialEvolutionSP from worker import DEWorker class DEManager(object): def __init__(self, ports, work_count): self.send_port = ports['send'] self.receive_port = ports['receive'] self.control_port ...
true
c682d24d9d015a0abcf754d2c15a716c2047ee65
HAN-ARK/GVSS-S.A.Drone
/Decoding QR.py
UTF-8
3,137
2.640625
3
[]
no_license
import cv2 import numpy as np import pyzbar.pyzbar as pyzbar import CoDrone from CoDrone import Direction,Degree lowerBound=np.array([0,120,70]) upperBound=np.array([10,255,255]) lower = np.array([170,120,70]) upper = np.array([180,255,255]) cam= cv2.VideoCapture(0) kernelOpen=np.ones((5,5)) kernelClos...
true
d2e89aa3350b7c4eab56a9828f3e3cbe3ec10437
Darkblader24/ApexStats
/src/analysis.py
UTF-8
8,475
2.875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import os # to convert time survived to seconds import datetime import time from scipy.optimize import curve_fit from scipy.special import gamma # 0 to disable use_last_n_games = 50 # empty list to disable show_only_group_size = [] show_only_legend = [] def fil...
true
7c53ec8bdb0f50253636ec24162f72ba284d2d67
hng-teamfury/team-fury-1
/scripts/Subomi.py
UTF-8
199
3.09375
3
[]
no_license
full_name = "Idris Kuforiji" hng_id = "HNG-03091" language = "Python" email = "idriskuforiji@gmail.com" print(f'Hello World, this is {full_name} with HNGi7 ID {hng_id} and email {email} using {language} for stage 2 task')
true
66a60db8887d62e16e33a4c05504c784e6b7df63
Jackyzzk/Algorithms
/动态规划-最长增长子序列-01-0300. 最长上升子序列-O(n2).py
UTF-8
1,127
3.734375
4
[]
no_license
class Solution(object): """ 给定一个无序的整数数组,找到其中最长上升子序列的长度。 输入: [10,9,2,5,3,7,101,18] 输出: 4 解释: 最长的上升子序列是 [2,3,7,101],它的长度是 4。 可能会有多种最长上升子序列的组合,你只需要输出对应的长度即可。 你算法的时间复杂度应该为 O(n2) 。 进阶: 你能将算法的时间复杂度降低到 O(n log n) 吗? 链接:https://leetcode-cn.com/problems/longest-increasing-subsequence """ def lengthOfLIS(self, nums):...
true
e6d5bad9c03983d5562648ae8fa0f4c1d8e8325e
Boberkraft/Data-Structures-and-Algorithms-in-Python
/chapter1/C-1.24.py
UTF-8
367
4.21875
4
[]
no_license
# Write a short Python function that counts the number of vowels in a given # character string. def count_vovels(word): vovels = 'aeiou' count = {} for letter in word.lower(): if letter in vovels: count[letter] = count.get(letter, 0) + 1 return count if __name__ == '__main__': ...
true
8bdc08de9552921fe230cc18d654d48e2dad2bba
dhnesh12/codechef-solutions
/01-CodeChef-Begginer/95--IPL and RCB.py
UTF-8
114
2.828125
3
[]
no_license
# cook your dish here a=int(input()) for i in range(a): p,q=map(int,input().split()) print(max(0,p-q))
true
08243225476bc516cf028eef7ec48071b7cfc710
Dilshodbek23/Python-lessons
/34_4.py
UTF-8
951
3.046875
3
[]
no_license
import json with open('students.json') as f: students_py = json.load(f) print(students_py) print(type(students_py)) name1 = students_py['student'][0]['name'] lastname1 = students_py['student'][0]['lastname'] course_num1 = students_py['student'][0]['year'] faculty1 = students_py['student'][0]['faculty'] ...
true
e1cf4fdae56889fd424831cc676c68b6b02b7b88
milalukic/DijkstrasAlgorithm
/dajkstra.py
UTF-8
1,383
3.671875
4
[]
no_license
import sys from queue import PriorityQueue class Graph: def __init__(self, num_of_vertices): self.v = num_of_vertices self.edges = [[-1 for i in range(num_of_vertices)] for j in range(num_of_vertices)] self.visited = [] def add_edge(self, u, v, weight): self.edges[u][v] = weight self.edges[v][u] = weigh...
true
583233e45c9b0850edc2fce9daea2a2324bb189d
AK-1121/code_extraction
/python/python_25632.py
UTF-8
160
3.65625
4
[]
no_license
# Build dictionary from list contents (values) and sequential letters as keys &gt;&gt;&gt; [dict(zip(letter, names))] [{'a': 'bob', 'c': 'tracy', 'b': 'fred'}]
true
eedf2c31658abc8942f133ba0e7527c7046a7d22
malidrsn/Machine-Learning-Prediction-Algorithms-w-Examples-V2
/Support_vector_regression_svr/support_vector_regression.py
UTF-8
1,672
3.46875
3
[ "MIT" ]
permissive
import pandas as pd import matplotlib.pyplot as plt import numpy as np # Veri Yükleme veriler = pd.read_csv("maaslar.csv") # dataframe dilimleme(slice) x = veriler.iloc[:, 1:2] y = veriler.iloc[:, 2:] print(x) # eğitim seviyesi print(y) # maas # Linear Regression from sklearn.linear_model import LinearRegression ...
true
a3fb17fce41798ad7e490dc809e72bf8add4787f
ApoorvaSrinivasa/Cleaning-Farmers-Market-Dataset
/Cleaning_with_OpenRefine/OpenRefineCode.py
UTF-8
2,209
3
3
[]
no_license
### This data cleaning was carried out in OpenRefine using Python language ## Removing "NA", "n/a", "None", "No" from Facebook, Twitter, Youtube # For Facebook if value.lower() == "n/a" or value.lower()=="none" or value.lower()=="no": return "" else: return value # For Twitter if value.lower() == "n/a" or va...
true
2b5c7405a44f5c1feeb178fefc7c1a0f11e25a27
tigerjython/tjinstall
/tigerjython/TJExamples/02-Tu/Tu10d.py
UTF-8
163
2.75
3
[]
no_license
from gturtle import * def onMouseMoved(x, y): moveTo(x, y) makeTurtle(mouseMoved = onMouseMoved) setCustomCursor("sprites/cutemouse.gif") speed(-1)
true
6b6f2b8d2f746388559f2f1d4ee4bea56672ca55
david-ryan-alviola/utilities
/modeling/model_utils.py
UTF-8
5,154
3.265625
3
[ "Unlicense" ]
permissive
import pandas as pd from math import sqrt from sklearn.metrics import classification_report, confusion_matrix, mean_squared_error, \ r2_score, explained_variance_score def generate_xy_splits(train, validate, test, target, drop_columns=None): """ Utility function that splits samples into X and y values. ...
true
17643f941a3071e685322764be227c40015f9e37
frillecode/CDS-spring-2021-visual
/src/assignment2/image_search.py
UTF-8
3,161
3.21875
3
[ "MIT" ]
permissive
#!/usr/bin/python # Import libraries import os import sys sys.path.append(os.path.join("..", "..")) import cv2 import csv import glob import numpy as np from utils.imutils import jimshow from utils.imutils import jimshow_channel import matplotlib.pyplot as plt from pathlib import Path import pandas as pd # Function f...
true
05c49041c0e991b2df1172af49511cc2e8bf7a29
zhang-chao-zhi/autoTestBook
/3.3.1/3.3.3/stringtoint.py
UTF-8
570
3.15625
3
[]
no_license
class Solution(object): def myAtoi(self, str: str) -> int: str=str.lstrip() strlen = len(str) if strlen == 0: return 0 start = 1 if str[0] == '+' or str[0] == '-': start = 2 result = 0 while start <= strlen: try: ...
true
eee73ab1cb429d45a3cca9ac7c6a9283aadf75a5
kshitijmamgain/Health-Analysis
/src/utils.py
UTF-8
11,233
2.765625
3
[ "Apache-2.0" ]
permissive
import os import glob import pandas as pd import numpy as np from datetime import datetime import plotly.express as px import plotly.figure_factory as ff import plotly.graph_objs as go from plotly.subplots import make_subplots from preprocess import (sleep_preprocess, heart_preprocess, exercise_preprocess, stepcount_...
true
eb7cefdbef13ffec6d3b118ce8cde613f5a0bb5f
rasemenov/ebay-downloader
/ebay_pics/settings.py
UTF-8
925
2.703125
3
[]
no_license
""" This file contains settings that user probably wants to control. Please, be careful with formatting of this file and try to follow already set rules. In fact this is an executable, a program to run, so special syntax applies. """ # Size in bytes. All images with smaller size will be skipped. SKIP_SIZE = 2 ** 14 # ...
true
c0afc41e4be17d71bf19f17990d97793a9e162ba
erenyt12/test-contador
/__test__/usuario_test.py
UTF-8
791
3.03125
3
[]
no_license
import unittest from juampi.usuario import Usuario\ class TestUsuario(unittest.TestCase): def setUp(self) -> None: self.juampi = Usuario("Juampi") def test_elContadorDelUsuarioInicializaEnCero(self): self.assertEqual(self.juampi.contador.valor, 0) def test_incrementarElContadorDelUs...
true
7acd5e90bb0346d9c25be5cde7605c41b645bc9d
harisankarsnair/Sketchbot
/main.py
UTF-8
1,187
3.203125
3
[]
no_license
import cv2 import numpy as np from PIL import Image import streamlit as st st.title("Image to Pencil Sketch App :camera: ") uploaded_file = st.file_uploader("Choose an image for conversion") if uploaded_file is not None : img = Image.open(uploaded_file) image = np.array(img) input = cv2.imwrite('input.jpg'...
true
59e5c0e87f37b1cce0b9f09d19f8fed2bde54ec6
porekhov/cgmktop
/example/itp.py
UTF-8
11,034
2.609375
3
[]
no_license
# -*- coding: utf-8 -*- # Classes for handling of the MARTINI itp topology files import re, numpy class Atom: '''Atom object''' def __init__(self, id, type, resid, resname, name, cgnr, charge): '''Init function for Atom object''' self.id = int(id) self.resid = int(resid) self.r...
true
9c464c6213ea7358710c71cf4114751c66df6800
Erianafranky/andela_bootcamp
/Week1/Self_Learning_Clinic/Primes/prime_numbers_test.py
UTF-8
716
3.90625
4
[ "MIT" ]
permissive
import unittest from prime_numbers import get_primes class TestPrimeNumbers(unittest.TestCase): def test_assert_input_is_not_string(self): self.assertRaises(TypeError,get_primes('a_string')) def test_assert_input_is_not_list(self): self.assertRaises(TypeError,get_primes([1,3])) def test_assert_input_is_not_flo...
true
d7b0ed15f2c5076d6787c5e0dc9375996a8c7ac4
PyCSP/aPyCSP_lockver
/test/channeltest.py
ISO-8859-15
2,877
2.640625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: latin-1 -*- """ Copyright (c) 2018 John Markus Bjrndalen, jmb@cs.uit.no. See LICENSE.txt for licensing details (MIT License). """ import asyncio from common import handle_common_args from apycsp import process, poisonChannel, One2OneChannel, One2AnyChannel, ChannelPoisonException,...
true
61d727e5a46ceeca270e80a5a0205487f4723fb0
sSoKoSs/GameProject
/GameProject/SQLCon.py
UTF-8
3,318
2.96875
3
[]
no_license
import mysql.connector class sqlcon: def __init__(self): self.cnx = mysql.connector.connect(user='root', password='123qwe', database='gamedb') self.cursor = self.cnx.cursor() def sqlQuery(self, query): self.cursor.execute(query) return self.cursor.fetchall() d...
true
a951a8abc7e8636b6a7f4b05203169a20cc7d87c
Sequd/python
/Game tutorial/rpg_game/skills/Skill.py
UTF-8
1,011
3.1875
3
[]
no_license
from units.Unit import * class Skill: def __init__(self, mp_cost, timeout, damage): self.timeout = timeout self.mp_cost = mp_cost self.damage = damage self.level = 1 self.modification_value = 0 def use(self, target): pass def self_use(self): pass ...
true
262d04fb3764c9f9ab1a0473b2ccf44f59468a5a
Spiros94/PIano
/src/touch_sound.py
UTF-8
4,676
2.75
3
[ "MIT" ]
permissive
#!/usr/bin/python # -*- coding: utf-8 -*- import Adafruit_MPR121.MPR121 as MPR121 import sys, os, time from PySide import QtCore import pygame # for playing sounds only pygame.mixer.pre_init(44100, -16, 2, 2048) pygame.init() class touch_sensor(QtCore.QThread): dataEmit = QtCore.Signal(object) instrument = No...
true
3bb14c67f6657caa0511722a2c7a7e3b4ce56c20
mnowiasz/spottelbot
/spottelbot/botconfig.py
UTF-8
13,669
3.1875
3
[ "MIT" ]
permissive
""" Bot's config """ import configparser from spottelbot import botexceptions # Both a bookmark name and a value (Currently playing) bookmark_current = "current" # /delete all, /clear all bookmark_all = "all" # Make sure that "current" is first in list. After that, the list can be sorted alphabetically def _bookm...
true
d5349f2687da1efa785b580af015c68b35cbe5d9
jatimberlake2/CS150
/dataStructure.py
UTF-8
443
3.625
4
[]
no_license
def NodeCreate(value, next): return [value, next] def NodeValue(node): return node[0] def NodeNext(node): return node[1] def NodeSetValue(node, value): node[0] = value def NodeSetNext(node, value): node[1] = next #return def main(): node1 = NodeCreate(15, None) print(node1) node...
true
51f3b0eeb4d68fe5875be1ad63bcee36bf56d676
aquib-sh/DSA-C-PY
/Python/Recursion/digit_sum.py
UTF-8
177
3.921875
4
[ "CC0-1.0" ]
permissive
def digit_sum(n): if n == 0: return 0 return (n % 10) + digit_sum(n//10) if __name__ == "__main__": n = int(input("number: ")) print(digit_sum(n))
true
8c484dfcd7615926d7d88594606d7ca32804e2e1
openGDA/gda-diamond
/configurations/i22-config/scripts/beamlineScripts/diagnostics/diodeAverage.py
UTF-8
2,368
3
3
[]
no_license
import java import gda.device.scannable.ScannableBase from math import log from time import sleep """ Purpose: A pseudo device for measuring several points on the diode before returning Author: M. Malfois Date: Dec 07 2010 This dummy scannable acts like a diode might, e...
true
54bcced45d06e379a63e4ed264126e43a9c37e60
YonseiLidar/reinforcement_learning
/env.py
UTF-8
8,754
3.515625
4
[]
no_license
""" Difference between env.py and dqn_env.py In env.py we assume that we know where are the boundaries. We effectively implement the boundary behaviour at state 3 and 6 by setting V[3] = 1. V[6] = -1. Q[3, :] = 1. Q[6, :] = -1. So, in this case we set if next_state == self.win_state: ...
true
288e42a7f3dbcb4b15572a96bc6bf0bfe9d1d134
rajdharmkar/Python2.7
/Exception handling/logerror1.py
UTF-8
392
2.75
3
[]
no_license
import logging import sys def throws(): raise RuntimeError('this is the error message') def main(): logging.basicConfig(level=logging.WARNING) log = logging.getLogger('example') try: throws() return 0 except Exception, err: log.exception('Error from throws():...
true
bf1ef2706a673f5f6ac0d34da1cc70292f7f07eb
AK-1121/code_extraction
/python/python_27664.py
UTF-8
105
2.9375
3
[]
no_license
# How to extract letters except from middle part by using slice operator in python? word[:3] + word[-3:]
true
94c8530963761a7d690ea6ee9a6cfd484cad0f90
nijisakai/learn-ai
/codes/chapter5/SelfDrivingCar/computer/camera_capture.py
UTF-8
506
2.890625
3
[]
no_license
#!coding:utf-8 """ @author: wanqingfeng """ import cv2 import time cam = cv2.VideoCapture(0) i = 0 while True: (isCaptured,frame) = cam.read() #采集摄像头 if(isCaptured): cv2.imshow("one",frame) # time.sleep(1)#每隔一秒采一帧 if cv2.waitKey(1) & 0xFF == ord("s"): #按‘s’采集 cv2.imwrite("calib/frame%d...
true
e30ef0bc64102f0de4ca794198656cd1545871bd
joojaeyoon/PS
/BOJ/11000-12000/11279/11279.py
UTF-8
269
2.921875
3
[]
no_license
import heapq import sys MAX_NUM=2**31 heap=[] cnt=int(input()) for _ in range(cnt): data=int(sys.stdin.readline()) if data!=0: heapq.heappush(heap,MAX_NUM-data) elif heap: print(MAX_NUM-heapq.heappop(heap)) else: print(0)
true
7decf9fcee3fa944c06005faefc96e61fbdae44e
wsgan001/PyFPattern
/Data Set/bug-fixing-3/f4ce7da38f9efecf0d660e9821cd291e9d49683e-<trimmed_std>-fix.py
UTF-8
728
2.828125
3
[]
no_license
def trimmed_std(a, limits=(0.1, 0.1), inclusive=(1, 1), relative=True, axis=None, ddof=0): 'Returns the trimmed standard deviation of the data along the given axis.\n\n %s\n ddof : {0,integer}, optional\n Means Delta Degrees of Freedom. The denominator used during computations\n is (n-ddof). DDO...
true