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
43d7d335660745a5d3bd1b192ea57f0deef539ad
codingsona/fcc
/Scientific_computing/time_calculator/main.py
UTF-8
482
3.125
3
[]
no_license
# This entrypoint file to be used in development. Start by reading README.md from time_calculator import time_calculator from unittest import main '''The code is written in time_calculator.py. For development, we are using main.py to test the functions in time_calculator. When we'll Click the "run" button the main.py...
true
b0c1465e89fe569d8e211a2f4b6eb92029eaeda4
ceilingcranes/BroadChallenge
/tests.py
UTF-8
2,684
2.96875
3
[]
no_license
import unittest import main class TestMBTA(unittest.TestCase): def test_find_connections_one(self): """ Test one connection """ test_connections = {"R2":"R1"} end = "R2" returned_connections = main.find_connections(test_connections, end) self.assertListEqua...
true
b5024309207f312d079f08a59a159ecd6a3900ef
OreNot/MicroBDMigration
/p1/base_actuality.py
UTF-8
41,588
2.5625
3
[]
no_license
from openpyxl import load_workbook import psycopg2 import re orderBaseFile = 'C:\\microservices\\order_base.xlsm' dlWithoutGen23BaseFile = 'C:\\microservices\\dl_without_gen23.xlsx' organizations = [] dls = [] db_config = {'database':'OKZ_DB', 'user':'root', 'password':'test', 'host':...
true
03343dae27562a1bff45bed821de24d63b8fe5bc
Lam129/Amazon-Crawler-
/Scrapper/main.py
UTF-8
1,464
2.875
3
[]
no_license
import requests from bs4 import BeautifulSoup import pandas as pd import time import json reviewlist = [] def get_reviews(soup): reviews = soup.find_all('div', {'data-hook': 'review'}) try: for item in reviews: review = { 'product': soup.title.text.replace('Amazo...
true
d036ac66b24efd14b6fc8cd6bb04901c3476309e
DuxJing/AID1911python
/epoll_server.py
UTF-8
934
2.671875
3
[]
no_license
""" epoll 重点代码 """ from socket import * from select import * s = socket() s.setsockopt(SOL_SOCKET,SO_REUSEADDR,1) s.bind(('0.0.0.0',8888)) s.listen(3) #创建epoll对象 ep= epoll() #查找字典,用于通过文件描述符查找对象 #时刻与关注的IO保持一致 map = {s.fileno():s} ep.register(s,EPOLLIN) while True: #{(fd,event),()} events = ep.poll() #将关注的I...
true
72f097cbd39ce31e98b47682f06907a224898d9d
gngp/ReactSelfbotCloud
/api/scripts/tits.py
UTF-8
1,094
2.546875
3
[ "MIT" ]
permissive
@React.command() async def tits(ctx): blacklisted_words = ['redgifs', 'gifv'] whitelisted_words = ['gif', 'png', 'jpg', 'jpeg'] subreddits = ['boobs', 'tits', 'boobies', 'stacked', 'bigboobsgw', 'ghostnipples', 'hugeboobs'] response = requests.get(f'https://www.reddit.com/r/{random.choice(subreddits)}/h...
true
50a622f6bc7f0e10fc3035bb5190f88351d62fd6
OliverGraham/231A3ograham
/231A3ograham.py
UTF-8
3,997
3.3125
3
[]
no_license
# Assignment 3 # CIS 231 / Cuesta College # Fall, 2019 / R. Scovil # Oliver Graham, olivergraham916@gmail.com # Due: October 31st, 2019 import json import math def getSummary(data): summaryList = [] for day in data: aDay = dict() date = day['date']['weekday'] + ","...
true
e5ef4ac3f20b6fbba5ab520b5176d270624a836b
hungld/www.gittip.com
/tests/test_public_json.py
UTF-8
2,392
2.515625
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import json from gittip.testing import Harness from gittip.testing.client import TestClient class Tests(Harness): def test_anonymous_gets_receiving(self): alice = self.make_participant('alice', last_bill_result='') self.make_participant('bob') alice.set_tip_to('bob', '1.00') ac...
true
b5538426bd1291baf26202620f85d135ad72032d
baharev/sdopt-tearing
/tearing.py
UTF-8
12,457
2.765625
3
[ "BSD-3-Clause" ]
permissive
# Copyright (C) 2014, 2015 University of Vienna # All rights reserved. # BSD license. # Author: Ali Baharev <ali.baharev@gmail.com> from __future__ import print_function from copy import deepcopy import six import networkx as nx from blt_decomp import Dulmage_Mendelsohn from plot import dummy as plot __all__ = [ 'tear...
true
3c1767b0ea2456d1eeed1799488780693ed68f9b
jlin332/NBA-Hackathon-2017
/CloseGames.py
UTF-8
5,999
2.84375
3
[]
no_license
import csv # for this file, we want to find games whose score difference between 2 teams are <-2 or >20 # return game id, players, period homeTeamID = 0 avgRateDic = {} def closeGames(filename): games = {'gameID': 'player'} # this dictionary stores for last row lastRow = {"id": "lastRowDiff"} with op...
true
80550f470b795f59826db5ab1d42429536126af5
wiseknown/LBM_CERA
/Python_Files/PostProcessing/csv_writer.py
UTF-8
435
3.171875
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- ''' Created on Sat Mar 13 23:18:53 2021 @author: Ayrton M and jmatailov11 This funtion take a index matrix as input and writes this matrix in a .csv file. ''' import numpy as np def csv_wr(name, matrix): # Save index matrix using numpy library. Comma delimiter is used. index_matrix = ...
true
c715f556e02f470c9f86480e5a4385c417fbaada
joshpelkey/cmap-parse
/cmap_parse.py
UTF-8
11,697
2.546875
3
[ "Apache-2.0" ]
permissive
## # # cmap_parse.py # An attempt to parse concept maps, exported from cmap tools...take one # # Copyright 2016 Josh Pelkey # # 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...
true
6c683f2681dca3aff8478bbc34279d8e35b7dd9d
MJSiddu/ASE-Project-And-Assignments
/hw/4/zeroR.py
UTF-8
308
2.578125
3
[]
no_license
from tbl import Tbl class ZeroR(object): def __init__(self, cols): self.tbl = Tbl() self.tbl.generateCols(cols) self.goalIndex = self.tbl.goals[0] def train(self, row): self.tbl.addRow(row) def classify(self, row): return row[self.goalIndex], self.tbl.cols[self.goalIndex].mode
true
169b397fcf9259f622d7b92dbdb215086af7661d
supistar/PiAirRemote
/Scripts/mode2-parser.py
UTF-8
935
3
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- encoding:utf8 -*- from __future__ import print_function import argparse class Parser(object): @classmethod def parse(cls, target_file): print("Target file : %r" % target_file) if target_file is None or len(target_file) == 0: return with open(...
true
8637b4462fb14c0e6eed5fc9c5f3f5d8de68de3e
eltnas/ExerciciosPythonBrasil
/02 - EstruturaDeDecisao/02.py
UTF-8
134
3.984375
4
[]
no_license
numero = int(input("Insira o numero: ")) if (numero % 2) == 0: print("Esse numero é par") else: print("Esse numero é impar")
true
fedad51c59c3b3fa0b0dbd69400f4efcf57015aa
XixiePi/NND_BPB
/ErrorBank.py
UTF-8
588
3.03125
3
[]
no_license
# In this file, all concreat implementation of transfer function is provided. from math import pi, sin, exp, cos def get_error_cal(fun_name): if fun_name == 'MSE': return mse elif fun_name == 'default': return mse else: raise ValueError(fun_name) def get_error_dri(fun_name): ...
true
6b1d8e6273b42999147480e93f833113b626fbc9
TimHeideck/LUNA
/templates/gpioTemplate.py
UTF-8
1,093
3.078125
3
[]
no_license
import RPi.GPIO as GPIO # Beschreibung ''' Template für die Steuerung von Geräten über die GPIO-Pins des Raspberry Pis. Die Geräte werden in einer Liste verwaltet, die zugehörige Pinnummer in einer weiteren Liste. Wird ein Gerät genannt, wird die entsprechende Pinnummer gesucht und an- bzw. ausgeschaltet. ''' # Gerae...
true
eca7e33dcb8035596c4d635d53fc8084c52a7321
alan0415/AI_ML-project
/practice_6.py
UTF-8
487
3.75
4
[]
no_license
#用for loop 解 practice_4.py 的象限判斷 A = [-1, -10] B = [5, -5] C = [1,1] D = [-2, 3] dots = [ ['A', A], ['B', B], ['C', C], ['D', D] ]#把A,B,B,D四個list塞進dots這個list裡面 for i in dots: print(i[0], "is in", end =' ') if i[1][0] > 0 and i[1][1] > 0: print("I") elif i[1][0] < 0 and i[1][1] > 0: ...
true
64c04a4b5bbd9d29a64653a4482aa62e6825628c
Crkonova76/iris_data_set
/analyses.py
UTF-8
2,385
3.546875
4
[]
no_license
# April 2019 # GMIT, Project Iris Data Set # Imported libraries pandas, numpy, seaborn and matplot import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # Load Iris data set from provided url link data = pd.read_csv('https://raw.githubusercontent.com/uiuc-cse/data-fa14/gh-pages...
true
1f599f86d0ddb052d4789cda08f39575a30cecbd
simhonchourasia/leetcodesolutions
/leetcode/Medium/coin change.py
UTF-8
765
3.234375
3
[]
no_license
# https://leetcode.com/problems/coin-change/ class Solution(object): def coinChange(self, coins, amount): """ :type coins: List[int] :type amount: int :rtype: int """ intmax = 3000000000 # Create DP array where dp[i] is the minimum number of coins t...
true
0fe5b7123c331c3cba8cba4ef3f81cb3cb408783
deebee07/Febreze-home-hack
/REST-API-Server/python-test-scripts/test-rekog.py
UTF-8
1,031
2.609375
3
[]
no_license
def search_faces_by_image(bucket, key, collection_id, threshold=75, region="us-west-2",profile="default"): rekognition = boto3.client("rekognition", region) response = rekognition.search_faces_by_image( Image={ "S3Object": { "Bucket": bucket, "Name": key, } }, CollectionId=collection_id, FaceM...
true
66447fccdda2cb7d172e9051b8c37b537f9bbf72
cyphar/ncss-2020-syd-group1
/travel-bot/get_time.py
UTF-8
495
3
3
[]
no_license
import datetime #get current time (anyone can use this to get local time) #Don't DELETE!!! #-------------------------------------------------------- def get_time(): now = datetime.now() hour = int(now.strftime("%H")) + 11 current_time = now.strftime(f"{hour}%M") print(current_time) return current_time def get...
true
60cc4ba75e8544393a3c61eec8ed05138e9ee066
leoliuyt/workspace_python
/python_grammar/my_string.py
UTF-8
810
3.796875
4
[]
no_license
stringInDoubleQuotes = "Hello Python!" stringInSingleQuotes = ' Hello Python! ' stringInTripleQuotes = '''Hello Python ! This might be a long string going through mutiple lines. ''' print(stringInDoubleQuotes) print(stringInSingleQuotes) print(stringInTripleQuotes) aNumber = 123 aString = str(aNumber) print(aStrin...
true
8b902019b2bbecd7164f9a30b8024145f31fbf90
OceanicSix/Python_program
/Study/ADT/Module 3/tictactoe_Gavin_version.py
UTF-8
5,929
4.21875
4
[]
no_license
class TicTacToe: # if we visualize the tic tac toe gird as position values like # [ 1 2 3 ] # [ 4 5 6 ] # [ 7 8 9 ] # the following list store the set of winning positions win_pos = [{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {1, 4, 7}, {...
true
a41a86fe82cc4909be8b82d87b72628d954b3b2f
rkdora/keras-fgsm-cifar10
/advs_train.py
UTF-8
4,270
2.734375
3
[]
no_license
from keras.datasets import cifar10 from keras.models import model_from_json from keras.utils.np_utils import to_categorical from keras.optimizers import Adam import numpy as np import matplotlib.pyplot as plt from keras import backend as K batch_size = 32 epochs = 5 eps = 0.01 loop = 2 max_n = 100 num_classes = 10...
true
88611303a5547be01388fd549c0bd9860fc31abb
asd55667/Jianzhi_offer
/38TreeDepth.py
UTF-8
542
3.359375
3
[]
no_license
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None def TreeDepth(t): if not t: return 0 s = [(t,1)] m = 1 while s: node, depth = s.pop() if depth > m: m = depth if node.left: s...
true
4abfb3922b426c6cd307bce2040a946262a74d86
yueyang1101/ece143team15
/src/DataProcessing/process_1_5.py
UTF-8
1,022
3.375
3
[]
no_license
import pandas as pd def process1_5(df15 = pd.read_csv("Data/OriginalData/mitigation_curves_1.5C_191203_data.csv")): ''' This function takes a data frame file and returns a dataframe of historical carbon emissions data and a dataframe with migitation values from 2000-2026 for maximum +1.5 Degrees warming. :param ...
true
e1763993567c429a2d7df5112a2c9ce31cd9a3a6
kbehouse/VGG_SVM_lfw_expand
/copy_exceed_2_pic.py
UTF-8
929
3
3
[]
no_license
""" Copy the src_dir/ subdir which "exceed 2" (inlcude 2) pictures to tar_dir Set Parameter: src_dir = 'lfw/' tar_dir = 'lfw_more_2pic/' want_num = 2 """ import os, sys from shutil import copytree, rmtree # src_dir = 'lfw' # tar_dir = 'lfw_more_2pic' src_dir = sys.argv[1] tar_dir = src_dir + '_more2pic' want_num ...
true
fc2fede5a61b2ef58a3ab9274d0c9640313f18a2
Sullivannichols/csc221
/hw/hw4/hw4.py
UTF-8
2,208
3.421875
3
[]
no_license
i#!/usr/bin/env python3 from hw4_solution import ( is_odd, is_even, is_mult_of_four, is_mult_of_divisor, both_ends, ) # -------------------------------------------------------------------- # Problem 1 # # Create a function, is_odd, that takes a number and returns True if # that number is odd. ...
true
8ad9a5fb6294dd03184acc4bcf7b512644fd8a83
arneesser/CaseStudySpatialData
/floorsflooded.py
UTF-8
1,803
3.21875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jan 29 13:02:44 2021 @author: Craig """ import csv import math path = 'C:/Users/Craig/Desktop/Case Study files/zonalstatistics1_5m.csv' storage = 'C:/Users/Craig/Desktop/Case Study files/' n_floors = [] # Create a list to that will contain the total number of ...
true
70b1fb403a022494b227b13c987f8c14cfbf03d5
TanyaTomashuk/Meowmere
/camera.py
UTF-8
678
2.890625
3
[]
no_license
from game_map import WINDOW_SIZE class Camera: def __init__(self): self.scroll_speed = [0, 0] self.scroll_mob_speed = [0,0] self.displacement_y = -200 self.displacement_x = -200 def moving_cam(self, player_x, player_y): self.scroll_speed[0] += (player_x - self.scroll_spe...
true
d1aca1e4f276f396bb25e235a32c2868a2975189
university-of-southampton-1920/qiuzhao2020
/2020_04_29/runroz_446.py
UTF-8
391
2.703125
3
[]
no_license
class Solution: def numberOfArithmeticSlices(self, A: List[int]) -> int: dp = [dict() for _ in range(len(A))] res = 0 for i in range(len(A)): for j in range(i): d = A[i] - A[j] c1 = dp[i].get(d, 0) c2 = dp[j].get(d, 0) ...
true
1f75852b576935d621cc68ef68b11ff808181737
khandelwal/owning-a-home-api
/oahapi/ratechecker/tests/test_load_daily_data_command.py
UTF-8
1,939
2.59375
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
from decimal import Decimal from datetime import datetime from django.test import TestCase from ratechecker.management.commands.load_daily_data import Command class LoadDailyTestCase(TestCase): def test_string_to_boolean(self): c = Command() b = c.string_to_boolean('abc') self.assertEqu...
true
ba8640099c1e1075c25d75d71c9f0635af1b71f6
ChangshengZhang/gre
/main.py
UTF-8
3,608
2.953125
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- # File Name: data.py # Author: Changsheng Zhang # mail: zhangcsxx@gmail.com from openpyxl.reader.excel import load_workbook import random import time def loadWord(vocab,meaning): fileName = "data.xlsx" wb = load_workbook(fileName) sheetnames = wb.get_sheet_names() ws = w...
true
224d1697cc7d044f49c5d6158affc900f8f29afe
verilylifesciences/analysis-py-utils
/verily/query_kit/template.py
UTF-8
7,734
2.90625
3
[ "Apache-2.0" ]
permissive
# Copyright 2019 Verily Life Sciences Inc. 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 required by appli...
true
8e557736af695e413ca2a8dbe2e75ab9a3558d92
Irene-Busah/holbertonschool-higher_level_programming-1
/0x0B-python-input_output/8-load_from_json_file.py
UTF-8
196
2.765625
3
[]
no_license
#!/usr/bin/python3 """ Function to load from json """ import json def load_from_json_file(filename): """ Code """ with open(filename) as file: return json.loads(file.readline())
true
128eb86af9e561b9ee28396d9196cb2ecd582dac
zesameri/Beginner-Python-Projects
/Basic Concepts/moodsensor.py
UTF-8
702
3.375
3
[]
no_license
''' Created on Oct 4, 2011 @author: Meredith ''' import random print('--- Mood Sensor v1.0 ---') print('Your ttrue emotions are coming across my screen.') print('At this moment, you are...') mood = random.randint(1, 4) if mood <= 1: print(''' HAPPY! ------- | | | O O | | < | |...
true
faf408b0297873c7cc934b3c1accf6bd1886c565
mithro/fasm
/fasm/__init__.py
UTF-8
5,748
2.59375
3
[ "ISC" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (C) 2017-2020 The SymbiFlow 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 from __future__ import print_function fr...
true
4174068ab8e9c1b0c7ffbcc992315ba2d2e4d9e8
MohitVerma786/hospital_management
/doctor_login_page.py
UTF-8
2,433
2.84375
3
[]
no_license
from tkinter import * from tkinter import messagebox from tkinter import ttk from PIL import Image,ImageTk import home_page # main Class class main: def __init__(self, master): self.master = master self.master.geometry("800x450+260+110") self.master.title("LOGIN PAGE") ...
true
d85d0b374a2126c1aac40ac9cb10b954925f187c
eltechno/python_course
/Strings.template-method.py
UTF-8
953
3.78125
4
[ "MIT" ]
permissive
from string import Template my_string = Template('Data science has been called $identifier') my_string.substitute(identifier="sexiest job of the 21st century") job= "Datascience" name ="sexiest job of the 21st century" my_string2= Template('$title has been called $description') my_string2.substitute(title=job, desc...
true
e27fb6e718934638561855f27f27da0a625dea39
julielee9067/keto-crawler
/databases/ten_thousand_recipe.py
UTF-8
1,475
2.53125
3
[]
no_license
import logging from typing import List from constants import WebsiteNames from crawlers.ten_thousand_recipe import get_total_recipe_dict_list from databases.db import BaseRecipeDB logging.root.setLevel(logging.INFO) class TenThousandRecipeDB(BaseRecipeDB): def insert_into_keto_recipe_instructions( self,...
true
8ab61f29b7c1664d97ca48f43b5b2f35a67f00bc
sm-svyat/monsterscan
/mscan/mscan.py
UTF-8
1,987
3.015625
3
[]
no_license
import requests from bs4 import BeautifulSoup as bs from pprint import pprint import time URL = 'https://www.monster.com/jobs/search' class MonsterScan: '''Monster scan object. ''' def __init__(self, search_query, location=None, pages=1): self.search_query = search_query self.location = loc...
true
726e32ac08d4811252385b77d54b779b27a3817d
Hugo-Fuente/LearningHTML
/Python/aula16 - funcoes.py
UTF-8
343
3.546875
4
[]
no_license
def calcula_dobro(numero): total = numero * 2 return total def calcula_suma_numeros(num1, num2, **numeros): import pdb ; pdb.set_trace() return sum(numeros.values()) resultado = calcula_dobro(8) print(resultado) soma = calcula_suma_numeros(num1=5, num2=10, num3=20, num4=7, num5=90) print("O resultado...
true
9e953dba8372e9994872bd37dd3cd69edc4b0067
maksoodmohiuddin/ml-trader
/StrategyLearner.py
UTF-8
10,023
2.890625
3
[]
no_license
""" Template for implementing StrategyLearner (c) 2016 Tucker Balch """ import datetime as dt import QLearner as ql import pandas as pd import util as ut import numpy as np class StrategyLearner(object): # MDP # States - indicators & holding # Actions - BUY, SELL & NOTHING # Reward - Daily Return ...
true
bce2d39fb5171eb0f5c39169f28b8efdb54ee3a2
jonathanlpw87/scraping-service
/main.py
UTF-8
820
2.546875
3
[ "MIT" ]
permissive
# main.py from flask import Flask, send_file from selenium import webdriver from selenium.webdriver.chrome.options import Options import chromedriver_binary # Adds chromedriver binary to path app = Flask(__name__) # The following options are required to make headless Chrome # work in a Docker container c...
true
858b30bf5a7b9fc4ce3013b345653c46c7d5ff13
dmresearch15/docplex-examples
/examples/cp/visu/sched_job_shop_flex.py
UTF-8
3,936
2.59375
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# -------------------------------------------------------------------------- # Source file provided under Apache License, Version 2.0, January 2004, # http://www.apache.org/licenses/ # (c) Copyright IBM Corp. 2015, 2016 # -------------------------------------------------------------------------- """ This problem is an...
true
50db80c85edffb0608eac928ff598f6e8f19f738
Silverutm/Concursos-Algoritmia
/OtrosConcursos/RevimexAgo2018/HongosMagicos_Solucion.py
UTF-8
842
3.765625
4
[]
no_license
Tabla_Res = [-1 for x in range (10000)] #dinero(i) = la maxima cantidad de dinero que se puede obtener en el intervalo [i, n) def dinero(i): #a partir de este lugar ya no hay dinero if i >= N: #condicion de paro | muy importate return False if Tabla_Res[i] != -1: #si ya lo calculé antes return Tabla_Res[...
true
5e8fa7eb40e8eb7a3875d76f21cfb1691050f232
Franferrreras/HLC
/Python/Listas/U1T2_Listas_Ex7.py
UTF-8
322
4.0625
4
[]
no_license
# Ejercicio 7 # Agregue el elemento 7000 después de 6000 en la siguiente lista # Dado: # list1 = [10, 20, [300, 400, [5000, 6000], 500], 30, 40] # Resultado: # [10, 20, [300, 400, [5000, 6000, 7000], 500], 30, 40] list1 = [10, 20, [300, 400, [5000, 6000], 500], 30, 40] list1[2][2].append(7000) print(list1[2][2])...
true
e6870ee76f635975b0b6cb1ceb6a732c2b184585
seansio1995/codefights
/unstablePair.py
UTF-8
644
3.234375
3
[]
no_license
def compare(file1,file2): maxLen=max(len(file1),len(file2)) if len(file1)<maxLen: file1=file1+" "*(maxLen-len(file1)) else: file2=file2+" "*(maxLen-len(file2)) for i in range(maxLen): if file1[i]!=file2[i]: if file1[i] > file2[i]: return ">" ...
true
48044959745da58573c98b6b2e058907a985c408
MokhtarNajjar/Intelligence_Artificielle_Chainage_Avant_Arriere
/Intelligence_Artificiel_Exemple.py
UTF-8
9,756
2.6875
3
[]
no_license
from tkinter import * from tkinter import messagebox import os from tkinter import * from tkinter import filedialog from tkinter.filedialog import askopenfilename from tkinter.messagebox import * class Fait: def __init__(self, num=-1, fait=""): self.num=num self.fait=fait class Regle:...
true
3d1cbc9417e6a0f34838f921ae8bb1aa7ad4d4f7
mossj77/recipe-app-api
/app/core/tests/test_models.py
UTF-8
2,730
2.609375
3
[ "MIT" ]
permissive
from django.test import TestCase from django.contrib.auth import get_user_model from unittest.mock import patch from core import models def sample_user(email='test@testmail.com', password='testPass'): return get_user_model().objects.create_user(email, password) class UserModelTest(TestCase): def test_ema...
true
d766fa37db60b9b3db85bf06befe26aefb6475cd
XSilverBullet/scikit-multilearn
/skmultilearn/adapt/brknn.py
UTF-8
4,705
3.078125
3
[ "BSD-2-Clause-Views", "BSD-2-Clause" ]
permissive
from builtins import range from ..base import MLClassifierBase from ..utils import get_matrix_in_format from sklearn.neighbors import NearestNeighbors import scipy.sparse as sparse import numpy as np class BinaryRelevanceKNN(MLClassifierBase): """Binary Relevance adapted kNN Multi-Label Classifier.""" def __i...
true
4fa80c564dc87171687d4745bf40039886ba5124
lwneal/keras-examples
/catdog/catdog_intermediate.py
UTF-8
1,690
3.078125
3
[]
no_license
import time import os import random from imutil import show, decode_jpg from keras import models, layers, applications import numpy as np def load_data(DATASET_SIZE=1000): files = ['train/' + f for f in os.listdir('train')] np.random.shuffle(files) files = files[:DATASET_SIZE] # Cats will be class 0,...
true
336610462c8992855d5efec05442fa61cf13f46a
dsayan1708/Python
/Sieve_of_Eratosthenes.py
UTF-8
395
3.828125
4
[]
no_license
from math import sqrt def sieve_prime(num): prime_arr = [1] * (num+1) #makes a list of 1 prime_arr[0] = 0 #initialize first index with 0 prime_arr[1] = 0 for i in range(2, int(sqrt(num))+1): if prime_arr[i] == 1: j=2 while i*j<num+1: prime_arr[j*i...
true
6f11127886fd8697a6a9ba345858e655b3ff4780
Palgg/python_ocr
/neuron.py
UTF-8
4,229
3.234375
3
[]
no_license
#! usr/bin/python3 import math, random BIAS = -1 """ class to represent an individual neuron """ """ TODO: implement sigmoid function """ class Neuron: # constructor def __init__(self, num_inputs): self.num_inputs = num_inputs self.set_weights( [random.uniform(0, 1) for x in range(0, num_inputs+1)] ) # ...
true
fff0dd9dcc21ec027c03009e1442e64536f67540
KujouNozom/LeetCode
/python/2021_07/LCP07.py
UTF-8
666
3.4375
3
[]
no_license
# LCP 07. 传递信息 [动态规划] import collections from typing import List class Solution: def numWays(self, n: int, relation: List[List[int]], k: int) -> int: end_index = collections.defaultdict(list) for edge in relation: end_index[edge[1]].append(edge[0]) dp = [[0] * n for _ in rang...
true
9bb3b4225268eefc9a1882d2acb8c438191b5d57
inteljack/EL6183-Digital-Signal-Processing-Lab-2015-Fall
/project/Examples/Examples/PP2E/Other/docstr.py
UTF-8
308
2.71875
3
[]
no_license
"module documentation: docstr.__doc__" class spam: "class documentation: spam.__doc__, docstr.spam.__doc__" def method(self, arg): "method documentation: spam.method.__doc__, self.method.__doc__" code... def func(args): "function documentation: docstr.func.__doc__" code...
true
110c514a3f402885021ae2c77aae4423c3557c46
StingzLD/Codecademy
/Python3/10.Classes/Inheritance_and_Polymorphism/6_Polymorphism.py
UTF-8
206
3.640625
4
[]
no_license
a_list = [1, 18, 32, 12] a_dict = {'value': True} a_string = "Polymorphism is cool!" # See how the same method is used against different classes. print(len(a_list)) print(len(a_dict)) print(len(a_string))
true
fe730ac3e87d494ac07bdf50111f64f79671f395
ornichola/learning-new
/pythontutor-ru/02_ifelse/12_chocolate.py
UTF-8
719
3.65625
4
[ "Unlicense" ]
permissive
''' http://pythontutor.ru/lessons/ifelse/problems/chocolate/ Шоколадка имеет вид прямоугольника, разделенного на n×m долек. Шоколадку можно один раз разломить по прямой на две части. Определите, можно ли таким образом отломить от шоколадки часть, состоящую ровно из k долек. Программа получает на вход три числа: n, m, k...
true
82e6d23f73ef7b331f7fcf16589dd2c5790f9861
terrenceliu01/python1
/src/languageBasics/datatype/datetime3.py
UTF-8
1,636
3.875
4
[]
no_license
""" Convert string to datetime.datetime (string-parse-to-time) - Module: datetime - Class: datetime - Function: strptime() datetime.datetime.strptime(datestring:str, formatstring:str) -> datetime.datetime Convert datetime to string (string-format-of-time) - Module: datetime - Class: datet...
true
00c4d2529725eb3a2b1be1de61cace8424b4d5bc
eessm01/100-days-of-code
/python_para_todos_p2/day38_objects.py
UTF-8
799
3.984375
4
[]
no_license
class Coche: """Abstraccion de los objetos coche For the name of the class using CamelCase notation. """ def __init__(self, gasolina): self.gasolina = gasolina print('Tenemos {} litros'.format(self.gasolina)) def arrancar(self): if self.gasolina > 0: print('...
true
5aac66f827bb1ae452a77e6f996618f04f2d8746
julmanb/practice
/arrays.py
UTF-8
1,501
4.375
4
[]
no_license
# you cannot add elements or remove them after it has been created # elements must be of the same type # arrays allows to create grids, unlike lists that are just one-dimensional # need to use numpy package from numpy import array from numpy import zeros a = zeros(4, float) print(a) print("\n") print("two dimensional ...
true
505ef8325f62585c0c1abdf9df3542314c6cfb8e
kekraft/golden_eye
/src/pong_vision/src/blob_tunning.py
UTF-8
4,540
2.65625
3
[ "BSD-2-Clause" ]
permissive
#!/usr/bin/env python import sys import cv2 import numpy as np import matplotlib.pyplot as plt import copy import sift class Blob_Detect: def __init__(self, image): self.image = image self.minThreshold = 1 self.maxThreshold = 2000 # Filter by Area. self.filter...
true
e4930d31ccfa2851dcd6cddf56b50a3160a899b3
saisaranyaatti/100_days-coding-challenge
/16.Right_Truncated_Prime.py
UTF-8
822
3.625
4
[]
no_license
#Right_Truncated_Prime '''239=it has to be prime 23=it has to prime 2=it has to prime by truncated the right side digit the remaining digit has to be prime then that is called as right truncated prime''' import math def prime(n): if n>1: for i in range(2,int(math.sqrt(n))+1): ...
true
5c7a197cef9b49a60c749b83c74914fa91e59141
AuliaAPratama/Pyhton_Basic
/PangkatSederhana.py
UTF-8
386
3.78125
4
[]
no_license
''' program pangkat ''' # cara pertama def pangkat(num1,num2): number = 1 for _ in range(num2): number *= num1 return number # cara kedua def pangkat1(x,y): if y ==0: return 1 else: return x*pangkat(x,y-1) print(pangkat(2,2)) print(pangkat(3,3)) print(pangkat(10,5)) ...
true
1bee4afb384ac2469ebce3e53e9b705db7d2260b
Shuli/OpenMachineLearning
/simplenovelty.py
UTF-8
3,959
2.890625
3
[]
no_license
# -*- coding: utf-8 -*- """ ============================================================================================= 1.simplenovelty_kernel_matrix From simple novelty detection algorithm, a novel test to get the point ========================================================================================...
true
3ef9055ec4f909516c6605678a8e738bae228130
samueltong6355/MinecraftStuffs
/blockhit.py
UTF-8
359
2.90625
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
import pyautogui, time def main(): pyautogui.PAUSE = 0 #set duration between each click while True: pyautogui.click() #left click pyautogui.click(button="right") #right click if __name__ == "__main__": time.sleep(2) #just some time to get things ready (not necessary; feel free to delete) ...
true
9ca625e2d58bdbf1d89438856eb3ce842fa7047a
Phibi95/PythonBasics
/08-vars&if/ifstatementsbank.py
UTF-8
246
3.3125
3
[]
no_license
tv_available = True bank_balance = 400.10 preis = float(input('Wie viel möchstest du ausgeben?')) bank_balance = bank_balance - preis if bank_balance > 0: print('Kontostand ist positiv. Super!') else: print('Achtung du bist im Minus!')
true
f95a4fa4175be0a299c2879f72e81c138b21f2e5
tmbo/questionary
/examples/text_name.py
UTF-8
138
3.40625
3
[ "MIT" ]
permissive
import questionary if __name__ == "__main__": name = questionary.text("What's your first name?").ask() print(f"Hey {name} 🦄")
true
acf5957906378c22b2cfe4e1fbe660e41ef8c1ae
shukyp/Python-Lang
/date_time.py
UTF-8
1,135
3.15625
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
#=========================================================================== # Date Time Module #=========================================================================== """ # Demonstrates using the Date/Time services of the Python Standard Library # # Author: Shuky Persky # """ #=========...
true
2ffd94d6e488b26a0436316f8f3b1b6d237b19b5
yysung1123/mAiLab
/mAiLab_0002_Random_Number.py
UTF-8
2,428
3.828125
4
[]
no_license
#!/usr/bin/env python3 # HW0002 Random Number import random import numpy as np import time # Basic # 1. Generate 5 random numbers and print print([random.random() for i in range(5)]) # 2. Generate N random numbers within -1 to 1 and calculate mean and stddev and # print. Random numbers shouldn't be printed. N = 10...
true
4aa164e43d71431506399f25567eeffb20c2a8ee
MattMulhern/game-off-2019-scratch
/RPi/lcd.py
UTF-8
1,200
2.84375
3
[]
no_license
import board import digitalio import adafruit_character_lcd.character_lcd as character_lcd import time lcd_rs = digitalio.DigitalInOut(board.D17) lcd_en = digitalio.DigitalInOut(board.D27) lcd_d4 = digitalio.DigitalInOut(board.D22) lcd_d5 = digitalio.DigitalInOut(board.D23) lcd_d6 = digitalio.DigitalInOut(board.D24) ...
true
3cc3bd054acbb1b0071680717d0da0eb1d5e2159
teamsnactsukuba/ev3-cgs-qe-ik
/main-steps/present-method/GenerateSamplePoint.py
UTF-8
1,038
2.53125
3
[ "BSD-2-Clause" ]
permissive
from math import sqrt from ctypes import * from sympy import * from sympy import im from sympy import polys from scipy.optimize import fsolve from fractions import Fraction from decimal import Decimal import random import time import numpy as np import sympy as sp SamplePoint = [] # Although (X,Y,Z) should satisfy ...
true
b1cf1a6cafb1dd4b47de10a7d13935930fda68d9
CollegeBoreal/INF1039-202-19A-01
/C.Loops/300116685.py
UTF-8
44
2.84375
3
[]
no_license
for v in range(3): print('var v is', v)
true
c552ff0799e14124522f5e213494903ad1fc26a1
Smart-Sparks/HEMS
/central-server/central-frontend/HomeRepresentation.py
UTF-8
15,916
2.84375
3
[]
no_license
# HomeRepresentation.py # START IMPORTS import tkinter as tk from tkinter import ttk import numpy as np from copy import deepcopy import sqlite3 import os import datetime import pandas import csv import matplotlib.pyplot as plt # https://matplotlib.org/3.1.0/gallery/user_interfaces/embedding_in_tk_sgskip.html fro...
true
a249527b3287ca2815a447f4cd6376dd45f4d413
ang421/yelp_challenge
/recommendation_prediction/process_data.py
UTF-8
11,090
2.71875
3
[]
no_license
import json import csv from tqdm import tqdm import numpy as np def parse_data(source1, output_path, numData): # setup an array for writing each row in the csv file rows = [] # extract fields from business json data set # # setup an array for storing each json entry business_data = [] # setup ...
true
4b1ffea7b4e5a5096f791f8e88574404af18d011
sbultmann/QPCR
/function.py
UTF-8
12,432
2.734375
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import random from matplotlib import colors import matplotlib.patches as mpatches import pandas as pd import math import statistics #check out seaborn for prettier plots def make_plate(ids, samples=[],genes=[]): #set grid numb_cols = 24 #int(form["cols"]) ...
true
faf8c4cb3023e0c5de17c57f0ede55a145394fe7
zomodo/spider_project
/schedule_task.py
UTF-8
3,287
2.59375
3
[]
no_license
import schedule import time import pymysql import requests import re from fake_useragent import UserAgent from concurrent.futures import ThreadPoolExecutor import get_more_ip as getip class check_data: def __init__(self): self.test_url='https://www.baidu.com/' def select_data(self): try: ...
true
5593a52c38556ff8127982fcf6c926e0ccc166a1
elliotgreenlee/machine-learning-examples
/basic_machine_learning/gaussian_bayes_classification/LikelihoodRatio.py
UTF-8
1,968
3.421875
3
[]
no_license
import numpy import math # Compute the likelihood ratio decision function # using gaussian probability distribution function def gaussian_likelihood(x, mu0, mu1, var0, var1, p0=0.5, p1=0.5): pdf1 = gaussian_pdf(x, mu0, var0) pdf2 = gaussian_pdf(x, mu1, var1) return (pdf1 / pdf2) - (p1 / p0) > 0 # Compu...
true
baf786601e73c5f78622c508f09b7e5d3bbdce71
theanht1/flask_api_template
/app/commons/exceptions.py
UTF-8
2,216
2.765625
3
[]
no_license
from flask import jsonify, make_response from app.commons.enums import ErrorMessage, ErrorStatus, StatusCode class AppBaseException(Exception): status_code = 0 status_message = ErrorMessage.ERROR def __init__( self, message, status_code=None, status_message=None, ...
true
4ee35661e1a859372af11c945cbe8460ad971b49
Egolas/YouTube-Sentiment-Analysis
/tag_statistics.py
UTF-8
3,609
2.796875
3
[ "MIT" ]
permissive
import csv import os import re from wordcloud import WordCloud from collections import Counter import matplotlib.pyplot as plt from scipy.misc import imread from wordcloud import WordCloud, ImageColorGenerator def get_filenames(path): file_names = [] for x in os.listdir(path): # print(x) y = os...
true
5852154a1d0075b212078c97a5645c88fdbade86
Shreejichandra/September-Leetcode
/459_repeated_substring_pattern.py
UTF-8
716
3.390625
3
[]
no_license
'''Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase English letters only and its length will not exceed 10000.''' class Solution: def repeatedSubstringPattern(self, s: ...
true
0a1b3579c344c7aec3886bab3b5e662f174c0918
CraigMorris1986/cp1404_practicals
/prac_01/Electricity bill estimator.py
UTF-8
1,437
4
4
[]
no_license
# This is an electricity bill calculator which multiplies kWh price to daily use in kWh # over a period of time. TARIFF_11 = 0.244618 TARIFF_31 = 0.136928 def main(): print("Electricity bill estimator") kwh_cost = float(input("Please enter the cost of electricity per kWh : ")) kwh_daily_use = float(input(...
true
388186f449fa7c52c7a9d979c6a61a2c5eaef9e7
tvalcourt/Adventure-Game
/enchantments.py
UTF-8
901
3.3125
3
[]
no_license
import items # abstract base enchantment class Enchantment(): # Element # Extra Damage # Prefix def __init__(self, element, damage, prefix): self.element = element self.damage = damage self.prefix = prefix # self = Player # item = best_weapon def apply_enchantment(...
true
ff9fd3243c600d3aea63c0c4bbef8b289d4ca479
FirdausAsri99/Phyton
/TimeProtocol.py
UTF-8
1,041
3.265625
3
[]
no_license
import socket import sys import datetime import time from time import sleep s = socket.socket() host = "192.168.42.3" port = 8888 print(f"Connecting to {host}:{port}") s.connect((host, port)) print("connected") time.sleep(1) #Front page function def fmenu(): print("-------------------------------THE TIME ZONE---...
true
9e53872781993aa4dc6e354dbb7db74ad723d76d
cyphar/epyc
/test.py
UTF-8
1,834
2.625
3
[ "LicenseRef-scancode-other-permissive", "Python-2.0" ]
permissive
#!/usr/bin/env python3 # epyc: python-like templating langauge (Embedded PYthon Code) # Copyright (C) 2014 Cyphar # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, includi...
true
9110b31b66a3e98484d39cb990144a3d0e689e0a
leeeo/maryjane
/mjpegserverpython.py
UTF-8
1,738
2.546875
3
[ "MIT" ]
permissive
from sanic import response, Sanic import asyncio import timeit # MaryJane is an mjpeg server - it works by fetching *the same* jpeg image over and over from a ram drive # MIT license # copyright 2021 Andrew Stuart andrew.stuart@supercoders.com.au app = Sanic(__name__) def package_mjpeg(img_bytes): return (b'--fra...
true
d15a47beeb8dccea30d708942b02645eae03aa1c
nonatin1000/superensino
/superensino/quiz/models.py
UTF-8
2,453
2.640625
3
[]
no_license
from django.contrib.auth.models import User from django.db import models class Quiz(models.Model): name = models.CharField(max_length=50) description = models.CharField(max_length=500) number_of_questions = models.IntegerField(default=4) status = models.BooleanField(default=True) class Meta: ...
true
3e3347bdfa95dfb1039795620ac82397c231825d
AdamZhouSE/pythonHomework
/Code/CodeRecords/2962/60827/317786.py
UTF-8
225
3.234375
3
[]
no_license
n = input() if n.__eq__("6 11"): print('3 0 10 9 6 1') elif n.__eq__('4 11'): print('3 10 4 0') elif n . __eq__('5 19'): print('8 11 10 9 12') elif n . __eq__('1 13'): print('1') else : print('8 2 6 9')
true
a370cabb78927e0b59a9a0a759f664072b6f65db
yuly3/atcoder
/other/diverta2019-2/B.py
UTF-8
553
2.8125
3
[]
no_license
from collections import defaultdict def solve(): N = int(input()) if N == 1: print(1) exit() xy = [[0, 0] for _ in range(N)] for i in range(N): xy[i][0], xy[i][1] = map(int, input().split()) dxy = defaultdict(int) for i in range(N - 1): for j in range(i + 1...
true
ef61eaf77f9adcaf79f32961c448a45dbe38af1f
dankernel/AlgorithmTest
/acmicpc/1157.py
UTF-8
372
3.0625
3
[]
no_license
import sys def f(i): return -i[1] inputs = str(sys.stdin.readline()) inputs = inputs.lower() freq = [[0 for i in range(2)] for j in range(26)] for i in range(len(freq)): freq[i][0] = i for i in inputs[:-1]: freq[ord(i) - ord('a')][1] += 1 freq = sorted(freq, key=f) if freq[0][1] == freq[1][1]: pri...
true
6dc487a021dc41ca2b58e7c3618f9f7ba09853c5
jvanbrie/universal_register_machine
/rm_macro_compiler.py
UTF-8
5,870
2.625
3
[]
no_license
import argparse import re verboseprint = lambda *a, **k: None def main(args): global verboseprint verboseprint = print if args.v else lambda *a, **k: None macro_files = ["copy.txt","zero.txt","pop.txt","dest_copy.txt","read.txt","mult_2.txt","push.txt","write.txt", "universal_register_machine.txt"] command_fil...
true
b6313bc9f99958246bca5c33e6a23a8c43eae5ad
ptsouth97/DeepLearn
/supervised_learning/2.Regression/6-regularized_regression_ridge.py
UTF-8
2,073
3.59375
4
[]
no_license
#!/usr/bin/python3 import matplotlib.pyplot as plt import pandas as pd import numpy as np from sklearn.linear_model import Ridge from sklearn.model_selection import cross_val_score def main(): ''' Linear regression minimizes a loss function It choose a coefficient for each feature variable Large coefficients ca...
true
1e53859f14503e2e6af1aaf09b2be961d89d52a3
mayank888k/Python
/class_overwriting.py
UTF-8
936
3.765625
4
[]
no_license
class A(): var="Class variable of A" def __init__(self): self.var="Constructor instance variable in A" self.aconsvar="Constructor instance variable of A" class B(A): var="Class Variable of B" def __init__(self): super().__init__() self.var="Constructor instance variable ...
true
e3a652388bc7e305196f064549ca23b76063e9f5
stellakim1012/IP-Barcode-Detection
/accuracy.py
UTF-8
3,619
2.984375
3
[]
no_license
import numpy as np import argparse import pdb # read filename and position data from a given file # and create a dictionary def readRectData(fname): file = open(fname, 'r', encoding='UTF8') pos_dict = {} num = 0 for line in file: data = line.split() pos_dict[data[0].replace(u"\ufeff", '')] = [int...
true
3fcad4e587d1e6dc6bfe44c99d4b896eaee228ef
green-fox-academy/yuuu1234
/DSA-2019/week-04/day03/Music/main.py
UTF-8
1,737
2.75
3
[]
no_license
import psycopg2 import sys import re connection = psycopg2.connect( host='localhost', database='music', user='postgres', password='199329Wy.' ) cursor = connection.cursor() insert_query = "INSERT INTO music(name,title) VALUES (%s,%s)" select_all_query = "SELECT * FROM music" select_by_artist_query = "S...
true
60db2b85ead62785c71160a3df1d3c8518ce302f
itsharshitb/Playing-With-Data
/all types of graphs/multiple ploting.py
UTF-8
641
3.515625
4
[]
no_license
import matplotlib.pyplot as plt #imported only pyplt import numpy as np #imported all numpy def f(t): return np.exp(-t)*np.cos(2*np.pi*t) #calculation t1=np.arange(0.0,5.0,0.1) #Defiening: from 0.0 to 5.0 in step of 0.1 t2=np.arange(0.0,5.0,0.02) #Defiening: from 0.0 to 5.0 in step of 0.02 plt.subplot(211) #syn...
true
e701d79ca5995265622bd1bfe69ad3d27cc0d78a
Deathn0t/majore
/notebooks/scripts/load_text.py
UTF-8
3,654
2.734375
3
[ "BSD-2-Clause" ]
permissive
import io import os import re import numpy as np import torch from torch.utils.data import DataLoader, Dataset class TextDataset(Dataset): def __init__(self, path_texts, path_embeddings): self.path_texts = path_texts # avg pool self.texts, self.splitted, self.max_seg_word = self.load_texts() ...
true
8cd86016dc112eb4587c37893615a35ef128220e
ingong/Py_Algorithm
/Programmers-Level2/카카오 2018 프렌즈4블록.py
UTF-8
1,762
3.75
4
[]
no_license
# checkList False + 본인이 '' 이 아니면서 + 좌, 우, 대각선에 있는 것들이 동일 # 블록지우기 # 이동시키기 # 오래걸린 이유 # 1. 첫번째 반복문에서 board_list 가 아니라 board 참조 # 2. rjust 함수를 사용할 때 세로를 기준으로 작성했어야했는데, 가로 기준으로 작성함 # => 2차원 배열에서 행과 열의 개념이 아직도 좀 헷갈린다. 특히 뒤집을 때 더 헷갈리는 것 같다. 반복학습이 필요하다 def isRemovable(board, row, column): return (board[row][column] == bo...
true
9090b5f9f8b1f9b45360261923135a63e577f259
robin3773/Codeforces-Problem-Solution-in-Python-3
/Type A/Magical Sticks.py
UTF-8
107
3.484375
3
[]
no_license
test_case = int(input()) while test_case: n = int(input()) print((n+1)//2) test_case -= 1
true