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
469338584b81e4b1df7602904cd71ca6e9bd48c9
enerrio/Anomaly-Detection-Simple
/anomaly_detection.py
UTF-8
1,535
3.46875
3
[]
no_license
#!/usr/bin/env python3 import numpy as np import matplotlib.pyplot as plt def main(): """ Implement simple anomaly detection model. """ # Create random train data data = np.random.normal(size=(50, 2)) # Mean of 0, std of 1 mu = (1 / len(data)) * np.sum(data, axis=0) # (2,) var = (1 / l...
true
1d46139bdd1316987852349d36a87ddd6aae4535
Atwinenickson/Socialmediaclassifier-
/venv/Lib/site-packages/emailverifier/models/response.py
UTF-8
1,783
2.953125
3
[]
no_license
""" emailverifier.models.Response ~~~~~~~~~~~~~~~~~~~~~~~ Response model which represents service response like an object """ from json import loads from .audit import Audit class Response: json_string = '' def __init__(self, json): """ Initialise the Response object :param str json...
true
037c6bbee7a8dec1884016b15af5f08a00dc2323
falco-tigris/Opencv
/PoseModule.py
UTF-8
1,471
2.515625
3
[]
no_license
import cv2 import mediapipe as mp import time class poseDetector(): def __init__(self,mode=False,upBody=False,smooth=True,detectionCon=0.5,trackCon=0.5): self.mode = mode self.upBody = upBody self.smooth = smooth self.detectionCon=detectionCon self.trackCon = trackCon ...
true
3833875f7daefabe763075423e27b89aba43af71
antonia-luciana/Calcul-Numeric
/CN_Tema5/GUI.py
UTF-8
1,972
2.703125
3
[]
no_license
from Tkinter import * from tema import * from nm import * n = 4 A = creaza_A(int(n)) Anm = creaza_Anm(3, 4) def afiseaza(A, metoda, label): res, iteratii = metoda(A) n = len(A) text = "" if type(res) == type("ana"): text = res + "\n" + "Nr de iteratii: " + str(iteratii) els...
true
b9023fec734e2ced6ccf7c212584e18aab052446
kszytko/BMWFanucGen
/Test_IOParser.py
UTF-8
8,167
2.984375
3
[]
no_license
import unittest from IOParser import IOParser from xml.etree import ElementTree as et class ConfigTestCase(unittest.TestCase): def assertConfig(self, input, output): #[port_number, phys_rack, phys_slot, phys_start] io = IOParser() configs = io.calculateConfig(input) self.assertEqual...
true
e67d5915433b0060dc99b7ec2f7d30328a426c31
aaronleechan/AlgorithmPractice
/Recursion/flattenList.py
UTF-8
878
3.609375
4
[]
no_license
def flatten(test): stack = [test] flatten_list = [] while stack: top = stack.pop() if isinstance(top,list): for elem in reversed(top): stack.append(elem) else: flatten_list.append(top) return flatten_list def permutaton(test): print("Come in here") if test is None: return [] if test is []: ...
true
e0daa3ad15fd281915a9adcaec5d123176490602
thomashopkins32/RedBlueGame
/RedBlueGame/models.py
UTF-8
1,819
3.1875
3
[ "MIT" ]
permissive
''' network.py Module for different neural networks useful for Deep Q-Learning Agents ''' from collections import namedtuple import random import torch import torch.nn as nn import torch.nn.functional as F Transition = namedtuple('Transition', ('state', 'action', 'next_state', '...
true
6d660646ac03fe1b6861e985c8e8bcd64874b2e7
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/travis_nelson/lesson03/slicing_lab.py
UTF-8
3,442
4.5
4
[]
no_license
# Tasks # Write some functions that take a sequence as an argument # and return a copy of that sequence: # with the first and last items exchanged. # with every other item removed. # with the first 4 and the last 4 items removed, # and then every other item in the remaining sequence. # with the elements reversed (...
true
7343cd327b895ca21de948d7e6492ef28d648f49
Urvashi-91/Urvashi_Git_Repo
/Leetcode_Practice/minByColumn.py
UTF-8
459
3.390625
3
[]
no_license
from collections import defaultdict def minByCol(table:list, col_name:str) -> dict: col = set() for row in table: if col_name in row: col.add(row[col_name]) else: row[col_name] = 0 col.add(row[col_name]) print (min(col)) #def sortByCol(table:list, col_...
true
7ad789da7ea22d1b672844fc3f0eef82f9180473
SirArlo/Networks-Lab-3
/Lab 3 UDP Server Exercise 2.py
UTF-8
1,993
3.203125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Feb 25 11:33:47 2018 @author: Arlo Eardley 1108472 """ #Import the required libraries import threading import socket #Define a class to handle the threads related to the client class Server(threading.Thread): #Over-ride the init fucntion to handle the threads ...
true
7efb820020f9565036b552222e74de9eefba614e
luanpotter/monte-carlo
/part1/task01_4a.py
UTF-8
980
3.390625
3
[]
no_license
#!/bin/python import random import math import numpy as np import matplotlib.pyplot as plt def plot(i, values, bins): plt.figure(i) plt.hist(values, bins, histtype='bar', rwidth=0.8) plt.xlabel('x') plt.ylabel('y') plt.title('Histogram %s' % i) plt.legend() plt.draw() ctheta = lambda x: 2*x - 1 theta =...
true
cf2b8eb43787c1c4fe8d863d5d847dd9300e7dbc
rebeccabartels/Image-Web-Scraper
/PythonImgScraper.py
UTF-8
839
2.890625
3
[]
no_license
from bs4 import BeautifulSoup import requests import lxml import pandas as pd import re myArray = [] links = [] search_url ='URL' # HTTP GET requests page = requests.get(search_url) # Checking if we successfully fetched the URL if page.status_code == requests.codes.ok: print('Everything is cool!') bs = BeautifulSo...
true
c0f8b2d07538ddf897be6eac29dad19cd407c6b7
EarthCodeOrg/earthcode-curriculum
/modules/m000X_hashmap.py
UTF-8
2,837
4.0625
4
[]
no_license
# A Hash Map Implementation a_dictionary = {'monkey':'blue'} # this is a hash map aka a dictionary a_dictionary['panda'] = 'pink' # mapping a pair into our dictionary #a_dictionary.put('panda','pink') #print(a_dictionary['panda']) # here we are getting the value associated with the key 'panda' del a_dictionary['panda'...
true
26965754c07544a5d68d23f6e224eb3317bc2aa8
Genpeng/building-project-assistant
/app.py
UTF-8
2,074
2.5625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ The Web APIs based on tornado Author: Genpeng Xu (xgp1227atgmail.com) """ import json import tornado.ioloop import tornado.web import tornado.httpserver from tornado.options import define, options from bpa.bill_classify import classify_bill from bpa.bill_similarity_search import find_k_ne...
true
10464d20279fb5cd4c02b698e942734c09de7516
duongthebach/duongthebach-labs-c4e
/lab2/itunes.py
UTF-8
923
2.828125
3
[]
no_license
from urllib.request import urlopen from bs4 import BeautifulSoup url = "https://www.apple.com/itunes/charts/songs/" conn = urlopen(url) raw_data = conn.read() html_page = raw_data.decode("utf-8") soup = BeautifulSoup(html_page,"html.parser") section = soup.find("section", "section chart-grid") div = section.find("div...
true
10b3bd8404a1d8c325d17c7d55964ce0b9e75c6f
h2r/slu_core
/tools/forklift/python/forklift/rrt_interface.py
UTF-8
3,437
2.578125
3
[]
no_license
import cPickle from numpy import transpose, arctan2 import agile import random import sys pi = 3.141 def hash_float(num): return int(round(num)) def round_orientation(num): #reduces orientation to 4 cardinal directions +- 45 degrees val = int(3/pi * (num + pi/3)) if val >= 5: val = 4 eli...
true
7578a2d95c3e048e81a9cb120bddb2f6b800dbc6
ZHANG-Quentin/baruch-mfe-lab
/MTH9893/hw2/plot_quote_trade_data.py
UTF-8
722
2.703125
3
[]
no_license
#!/usr/bin/anaconda3/bin/python import csv import numpy as np import matplotlib.pyplot as plt f, axarr = plt.subplots(2, 2) with open('jpm_quotes.csv', 'r') as quotes_csv: quotes = np.array(list(csv.reader(quotes_csv))[1:]).astype('double') axarr[0, 0].plot(quotes[:,1]) axarr[0, 0].set_title('quote ...
true
a08a3e8d4d1b3c3996718308c82f70fa277bff48
mannodermaus/Clydes-Fate--Indie-Horror-Game-
/src/view/View.py
UTF-8
15,833
2.59375
3
[]
no_license
# CS 386 # Introduction to Game Design and Production # Assignment 6: Final Game Project # by Marcel Schnelle # mschnelle@csu.fullerton.edu from src.constants import SCREEN_HEIGHT, SCREEN_WIDTH, APP_NAME, STATE_MAIN_MENU, \ STATE_GAME_MAP_LOADING, STATE_GAME_RUNNING, STATE_GAME_INVENTORY, COLOR_BLACK, \ COLOR_...
true
60020ca276cbcb96ea09e529372eaa783f616a69
JonSmebye/Machine-learning---tdt4173
/nonLinearClassification.py
UTF-8
2,037
3.140625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt def compute_error(x,y,w): z = np.dot(w, x.T) sigmoid_ = sigmoid(x,w) loglike = np.sum(y*np.log(sigmoid_) + (1-y)*np.log(1-sigmoid_)) return -1/y.shape[0] * loglike def sigmoid(x,w): z = np.dot(w.T,x.T) return 1/(1+np.exp(-z)) #one step in gradient def step_g...
true
1e4b62d5709b5003ba4adfd827bbc470825ac00b
rajashekar546/raj-localbranch
/testCases/demo_print.py
UTF-8
355
2.65625
3
[]
no_license
import configparser from configparser import ConfigParser config=configparser.ConfigParser() # config.read('sampleconfig.ini') config.read('..\Configurations\config.ini') for sect in config.sections(): print('Section:',sect) print(config.get(sect,'baseurl')) for k,v in config.items(sect): print...
true
abfa4b2f4c7f4fb7c03357bc2fcd3984fb669634
AnuragAnalog/codechef
/august_cookoff_2019/chef_pepperoni_pizza.py
UTF-8
1,022
3.109375
3
[ "MIT" ]
permissive
t = int(input()) def rev(part, n): for i in range(0, int(n/2)): part[i], part[n-1-i] = part[n-1-i], part[i] return part def diff_pepperoni(pizza, n): p1 = 0 p2 = 0 for i in range(n): for j in range(int(n/2)): if pizza[i][j] == '1': p1 = p1 + 1 ...
true
8ce01eacfc33869dae43a17920bab8c0d8f9be7d
w7374520/Coursepy
/day9/队列2.1列表生成式.py
UTF-8
258
2.75
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- coding:utf-8 -*- #Author:xp #blog_url: http://blog.csdn.net/wuxingpu5/article/details/71209731 res1=[i for i in range(10)] print(res1) res1=[i for i in range(10) if i > 5] #判断大于5的写入列表 不能有else print(res1)
true
c750194f2b7c5bc5e416a36efa3878d352457950
sosudo/USACO-Archive
/General/Fence_Painting/main.py
UTF-8
1,305
4.03125
4
[]
no_license
# We use sys to reassign our input and output import sys # Reassign standard input and output by opening the necessary files and setting them # to the values of sys.stdin and sys.stdout sys.stdin = open('paint.in', 'r') sys.stdout = open('paint.out', 'w') # Taking in the input lines as strings line_one = input() line_t...
true
c1d267c2e32bec24cbb8ac1464d900257421ea33
tueswking511/TQC_Python
/Ch08/1.py
UTF-8
193
3.3125
3
[]
no_license
while True: strinput = input() if strinput == 'end': break else: lst = strinput.split(':') print('hour: %s, min: %s, second: %s' % (lst[0], lst[1], lst[2]))
true
b83c7fd6529203f9d2021c05b9211e46c6cc0ad9
JSpeleers/GW2-AscendedFoodsCalculator
/material.py
UTF-8
1,815
3.046875
3
[ "Apache-2.0" ]
permissive
import config class CraftingMaterial: def __init__(self, item_id, name, numb_fine, numb_masterwork, numb_rare, numb_exotic): self._id = item_id self.name = name self.numb_fine = numb_fine self.numb_masterwork = numb_masterwork self.numb_rare = numb_rare self.numb_e...
true
b07e7f9139007a48b58322c5beccdfd46298d3dc
rohinikavitake/pa
/error_exceptional_h.py
UTF-8
371
3.265625
3
[]
no_license
try: number=int(input("enter number: ")) print(number) except: print("invaid number") try: value=10/0 except: print("sorry number is not divied by zero") while True: try: number=int(input("enter number")) except: print("please provid number") continue e...
true
e8e2851555af3faca921e3fb3d992e4d3ffd016c
FrankEntriken/Modelling-Population-Growth-of-Physical-Organisms
/test_midterm.py
UTF-8
591
3.171875
3
[ "MIT" ]
permissive
import midterm as m import math def test_sequence_attribs(): s = m.MysterySequence(2.5, x0 = 0.1, N = 10) assert math.isclose(s.r, 2.5), "r value not 2.5" assert math.isclose(s.x0, 0.1), "x0 value not 0.1" assert s.N == 10, "N value not 10" def test_sequence_eval_1(): s = m.MysterySequence(2.5) ...
true
92a803899aef13f6739fbcb58f86d55f4f074fc6
Mohican-Bob/CIT-228
/Chapter6/nested_dictionary.py
UTF-8
798
2.609375
3
[]
no_license
GPU = { 'GPU1': { 'Name':'GTX 970', 'VRam': '4 GB', 'Brand': 'Geforce', 'Clock Speed': 1051, }, 'GPU2': { 'Name':"RX 470", 'VRam': '4 GB', 'Brand': 'Radeon', 'Clock Speed': 1206, }, 'GPU3': { 'Name':"RX 5700XT", ...
true
ad54ce7007cc80c826d16685b7cc269552c0f35e
Autrach/Sudoku-Backtracking
/sudoku_solver.py
UTF-8
1,722
3.65625
4
[]
no_license
def solve_sudoku(board): row, column, solved = get_empty_coordinates(board) if solved: return True for value in range(1, 10): if value_can_be_placed(board, row, column, value): board[row][column] = value if solve_sudoku(board): return True ...
true
edfb4821af86bc1cfd8e1d07c443cd125bb9d964
Dhruvvvx17/Capstone-Project
/Review3Capstone2/download.py
UTF-8
2,061
2.640625
3
[]
no_license
from libraries import * from hdf_links import * class SessionWithHeaderRedirection(requests.Session): AUTH_HOST = 'urs.earthdata.nasa.gov' def __init__(self, username, password): super().__init__() self.auth = (username, password) # Overrides from the library to keep headers when redirect...
true
b72e30925c0c98ea65b2cf376ec6460418113dbc
olivia-burca/Movie-Rentals-App
/Movie Rentals/repository/RentalPickleRepo.py
UTF-8
1,031
2.734375
3
[]
no_license
import pickle from repository.rentalRepo import RentalRepository class RentalPickleRepository(RentalRepository): def __init__(self,file_name,rented_movies): super().__init__([],rented_movies) self._file_name = file_name self._rented_movies = rented_movies self._load() def _s...
true
4cbaea24fc2f4d61859e2ec3f460e6ea291953e2
zjc798719285/barefoot_fast_rcnn
/RoiPooling.py
UTF-8
1,081
2.625
3
[]
no_license
import tensorflow as tf class RoiPooling(object): def __init__(self, pool_size, num_rois): self.pool_size = pool_size self.num_rois = num_rois def __call__(self, base_layer, rois): pool_layer_list = [] for idx in range(self.num_rois): (batch_size, height, width, cha...
true
f7c62ac2153382ef2d4b9c28a0c336493f2ab0fa
krasotinpa/Stepic
/Python/Basics/task1-4-1.py
UTF-8
671
2.8125
3
[]
no_license
def add(name, var): global NameSpace NameSpace[name]['vars'].add(var) def create(name, parent): global NameSpace NameSpace[name] = {'parent': parent, 'vars': set()} def get(name, var): global NameSpace # print('=>'+name) if var in NameSpace[name]['vars']: print(name) return if name == 'glob...
true
b5e954a3ca5b89195ed6340e82df98af28de46a2
si1Z/spider
/data_scrapy_redis/data_scrapy_redis/pipelines/sec_pipelines.py
UTF-8
2,830
2.90625
3
[]
no_license
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import pymongo import pymysql from DBUtils.PooledDB import PooledDB from scrapy.exceptions import DropItem # 字典转换为字符串 def dict...
true
9572b9005659cabbd246b7d62db19fd81a07aa32
adelfranco/Follette-group
/MagAOX/webapp/call.py
UTF-8
6,007
2.78125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # #### Goal: Create a prototype web tool that turns a list of Simbad-resolvable astronomical object names into a properly formatted Magellan catalog entry. # > Please consult the Las Campanas Observatory website: http://www.lco.cl/telescopes-information/magellan/instruments/obser...
true
47bcd0a5bab1693d44eba2c1f94ca84b0a52e7ed
devquint/2020OSS-merge-practice
/print_team.py
UTF-8
270
2.890625
3
[]
no_license
if __name__ == "__main__": f = open("teams.txt", 'r', encoding='utf-8') names = [] ids = [] for line in f: args = line.split(' ') names.append(args[1]) ids.append(args[0]) print(names) print(ids) f.close()
true
70640c0c6f866e343fcc035b4c54f1803e22db6b
xufive/ways2grow
/第8章 机器学习工具包Scikit-learn/code_8.4.5.py
UTF-8
786
2.953125
3
[]
no_license
# -*- encoding: utf-8 -*- """ 8.4.5 支持向量机分类 """ from sklearn.datasets import load_breast_cancer from sklearn.model_selection import cross_val_score from sklearn import svm ds = load_breast_cancer() # 加载乳腺癌数据集 msvc = svm.SVC() # 实例化SVC分类器 mnusvc = svm.NuSVC()# 实例化NuSVC分类器 mlsvc = svm.LinearSVC(dual=False) # 实例化Linear...
true
2832295cd1f94909bf870d9832c6780b991f365d
carlosaragao/Facial-Recognition
/connection.py
UTF-8
1,061
3.125
3
[]
no_license
import mysql.connector from mysql.connector import Error class Connection: def __init__(self): self.host='localhost' self.database='tree_mainframe' self.user='aps' self.password='aps2019' def insertCadastro(self, nome_usuario): try: connection = mysql.co...
true
41b81017e0eabd689e361c3759694fbff0e34843
nabeen/AtCoder
/abc/abc103/b.py
UTF-8
389
3.015625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # https://atcoder.jp/contests/abc103/tasks/abc103_b def main() -> None: S = input() T = input() flag = False for i in range(len(S)): if S == T: flag = True break S = S[-1] + S[:-1] if flag: print("Yes") ...
true
54e7b93fd319ef173fa870fcbf376242df50e0c7
GChristensen/enso-portable
/enso/enso/quasimode/linewindows.py
UTF-8
5,932
2.703125
3
[ "BSD-2-Clause" ]
permissive
# Copyright (c) 2008, Humanized, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditi...
true
4996cc085c766c11ba96d8ae9d95aa872b23919e
joostsijm/vboo_refill_and_predict_system
/app/app.py
UTF-8
5,858
2.578125
3
[]
no_license
"""General function module""" import random from datetime import datetime, timedelta # libraries and data import matplotlib.pyplot as plt import matplotlib.dates as mdates import pandas as pd from pandas.plotting import register_matplotlib_converters from telegram import ParseMode from app import LOGGER, SCHEDULER,...
true
d900441b2818820b890ccfea8e0b2d5f93650fd2
seonukim/Study
/python/python05_dict.py
UTF-8
786
4.3125
4
[]
no_license
# 3. 딕셔너리 ; 중복 x # {키 : 밸류} # {key : value} a = {1: 'hi', 2: 'hello'} print(a) print(a[1]) b = {'hi': 1, 'hello': 2} print(b['hello']) # 딕셔너리 요소 삭제 del a[1] # del은 딕셔너리의 요소 삭제 print(a) del a[2] print(a) a = {1: 'a', 1: 'b', 1: 'c'} # 키 값이 중복되었을 경우, 가장 마지막 원소가 나옴 print(a) b = {1: 'a', 2: 'a', 3: 'a'} print(...
true
1b42eeedc9723506589ccbbd985d040dfcec1352
mjpcollins/bullrisk-model
/utils/model.py
UTF-8
3,349
2.78125
3
[]
no_license
from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split import pandas as pd def run_model(df): threats = df[df['Risk Type'] == 'Threat'] l = ['RiskID', 'Risk Status', 'Risk Category', 'Phase Impacted', 'Initial Likelihood'] threats = threats[l] categor...
true
4d6963c1443e01558a1d851fee6f8e0070714b9d
Zapadlo13/Python
/Task_5/Kharytonenko_Aleksandr_dz_4.py
UTF-8
116
2.890625
3
[]
no_license
src = [300, 2, 12, 44, 1, 1, 4, 10, 7, 1, 78, 123, 55] src2 = [j for i, j in zip(src, src[1:]) if j > i] print(src2)
true
5c8203272bf5e73e5c3227c6b9f75dc997e73af0
vfceball/RC-FIAP
/getSaT.py
UTF-8
2,704
2.75
3
[ "MIT" ]
permissive
def getSaT(EQ, dt, T, xi, npts): from math import pi, sqrt import numpy as np g = 9.81 # ----------------------------------- # Inputs: # ----------------------------------- # EQ: Filename which is a single column file in units g (e.g "Eq.txt") # dt: Time step in seconds (e.g 0.01) # xi: Elas...
true
d25ab7a5963a5d265bb00c7cf890d83c1563bfc8
BarryWangQwQ/Defter
/defter/feature/frontendc.py
UTF-8
3,282
2.578125
3
[ "MIT" ]
permissive
import os import re import sys import shutil import argparse from defter.feature import xpopen # Parser options ⬇ def main(): parser = argparse.ArgumentParser(description='Defter Python Front-End Compiler') parser.add_argument( "script", type=str, help="Defter Python front-end script....
true
aff064cecd31e5e950a453941caad562b88b30d2
KnightKnight27/MiscellaneousCode
/Jobs/Man/sqltest.py
UTF-8
2,249
3.3125
3
[]
no_license
# Write an sql query to find books that have sold fewer than # 10 copies in the last year, excluding books that have been # available for less than 1 month. import sqlite3 conn = sqlite3.connect('example.db') c = conn.cursor() c.execute("""create table products (product_id number primary key, ...
true
8f6dc2fd10086598eafa2accdd971ccad2065cc5
sdlcwangsong/ocr_training
/capchaEn_better.py
UTF-8
1,314
3.140625
3
[]
no_license
#!/usr/bin/env python #coding: utf-8 import PIL.Image, PIL.ImageDraw, PIL.ImageFont, PIL.ImageFilter import string, random fontPath = "/System/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/matplotlib/mpl-data/fonts/ttf/" # 获得随机四个字母 def getRandomChar(): return [random.choice(string...
true
fbc8698bf234db6e60df2e2a49487b0c78a42137
barabanus/starcontrol
/planet.py
UTF-8
13,816
2.796875
3
[]
no_license
#!/usr/bin/python ######################################################################################################################## # This script generates planet surface like "Star Control 2" game did. # It uses the so called "Fault Formation" algorithm. You can find its detailed description in the internet. # ...
true
660cddde5f135faed6b963bcb00aaabfce5a1c2f
mhhoban/basic-blog
/auth_tools.py
UTF-8
847
2.953125
3
[ "MIT" ]
permissive
""" tools for user authentication """ from hasher import verify_cookie from user_tools import fetch_penname def auth_user(self): """ Authenticates visitor as logged-in user, returns data about user :param self: :return: {'authorized', 'user_id', 'penname'} or {'authorized: false'} """ try: ...
true
590798e6effe58588aff498706e88f2445353c3a
LTimusk/Y10Design-PythonLT
/VolleyballCalculator.py
UTF-8
9,761
2.859375
3
[]
no_license
import tkinter as tk from PIL import ImageTk, Image #************************* MY COMMANDS ***************************** def clicked1(event): print("Clicked - 1") x = event.x y = event.y #You need to write an if statement for every region if x > 0 and x < 15 or y > 0 and y < 33: print("OUT") aimLabel.co...
true
e12b1c58acb45fe956459cbccf63e9a58941adf7
jiangshipan/intel_logistics_python
/model/logistics.py
UTF-8
1,011
2.5625
3
[]
no_license
from config.db import db class Logistics(db.Model): __tablename__ = 'logistics' id = db.Column(db.Integer, primary_key=True, doc='快递单唯一标识') order_id = db.Column(db.Integer, nullable=False, default=0, doc='订单id') user_id = db.Column(db.Integer, nullable=False, default=0, doc='快递员id') contents = db...
true
6b4e2006d9cf1068457deac81e435c838cf7e7c4
aaspeel/optiMeasRL
/estimators/estimator.py
UTF-8
1,893
3.09375
3
[]
no_license
""" Class estimator """ class Estimator: def __init__(self): """ Construct the estimator. """ self.reset() def reset(self): """ Reset the estimator if necessary (initial conditions,...). """ pass def estimate(self,measureme...
true
8617614767d3dcbc8223daac61609b3645d84468
gabestein/muck
/fetch-url.py
UTF-8
1,082
2.546875
3
[ "CC0-1.0" ]
permissive
#!/usr/bin/env python3 # Dedicated to the public domain under CC0: https://creativecommons.org/publicdomain/zero/1.0/. import argparse import requests import sys from common import io assert(sys.version_info.major == 3) # python 2 is not supported. arg_parser = argparse.ArgumentParser(description='fetch contents of...
true
550a28e307c1ae11a9f53583c06dcea74b488e59
Jay2645/Crime-Reports-App
/togaImp.py
UTF-8
1,531
2.640625
3
[ "MIT" ]
permissive
import toga from toga.style.pack import * window = toga.MainWindow('id-window', title='This is a window!') #window.show() def button_handler(widget): print("hello") def locationbutton_handler(widget): print("Location Button has been selected") def refreshbutton_handler(widget): print("Refresh Button h...
true
e3fa1cc7af5a5fb6c2e883088c06b5912f54bba8
jerryneedell/aio_via_esp8266
/aio_uart.py
UTF-8
369
2.71875
3
[]
no_license
import time import urequests while True: print("enter feed,value") line=input() s=line.split() data=int(s[1]) feed=s[0] payload={'value':data} response=urequests.post("https://io.adafruit.com/api/v2/<YOUR_AIO_USERNAME>/feeds/"+feed+"/data",json=payload,headers={"X-AIO-KEY":"<YOUR_AIO_KEY>"})...
true
9c29aee1f003c3f35d4ca09de95a3543b56ad3a3
facebookresearch/ClassyVision
/classy_vision/generic/registry_utils.py
UTF-8
1,966
2.828125
3
[ "MIT", "Apache-2.0" ]
permissive
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import importlib import logging import os import sys from pathlib import Path def import_all_modules(root: str, bas...
true
1e11287fb0bd78b83cf625bff12f37bcc67bb323
skanin/NTNU
/Informatikk/Bachelor/H2018/TDT4120/Øving 6/dynamisk_programmering.py
UTF-8
406
3.078125
3
[]
no_license
weights = [[3, 6, 8, 6, 3], [7, 6, 5, 7, 3], [4, 10, 4, 1, 6], [10, 4, 3, 1, 2], [6, 1, 7, 3, 9]] def cumulative(weights): rows, cols = len(weights), len(weights[0]) new = weights for i in range(0, rows): for j in range(0, cols): if j == 0: new[i][j] += min(new[i][j] + ...
true
feff84b935e52d614f734f2d3d2af158c581c3ee
SamoFMF/Slovenia---Settlements-Post-Offices
/python/utils.py
UTF-8
1,139
4
4
[ "MIT" ]
permissive
# Utilities import pickle from math import pi, cos, sin, asin, sqrt def saveFile(filename, data): with open(filename, "wb") as f: pickle.dump(data, f) def loadFile(filename): with open(filename, "rb") as f: return pickle.load(f) def coordToDeg(coord): return coord[0] + coord[1] / 60 + co...
true
96067d15e8aa04b899046fe5735fdd628ccff832
Abdoelabassi/excursion
/excursion/plotting/onedim.py
UTF-8
10,746
2.71875
3
[ "Apache-2.0" ]
permissive
import gpytorch import numpy as np from excursion.utils import point_entropy from excursion.utils import point_entropy_gpytorch import torch import matplotlib.pyplot as plt from matplotlib import gridspec def plot(axarr, gps, X, y_list, scandetails, batchsize=1): gp_axes = axarr[: len(y_list)] mu_stds = [] ...
true
539b035f716871a6d0e9989ba9c4a54a80864b6b
john-ppd/Python
/classes_and_objects.py
UTF-8
934
3.796875
4
[]
no_license
''' importing a class from file custom_class and using class called Student within it ''' ''' Can use one of these to just import one class but does not work for multiple imports for multiple imports you need to import the custom_class and then use custom_class.Student(,,,,) to call the Student and Bot classes from cu...
true
394b106fbbc43c4f9b0c6474cb6137f3e551b4e4
think-panda/torfaeneyp
/TorfaenEYP.py
UTF-8
3,524
2.9375
3
[]
no_license
import matplotlib.pyplot as plt import pandas as pd import streamlit as st import requests from pandas import json_normalize st.set_page_config(layout="wide") #Load & cache data. Clear cache periodically - 5mins - so that any changes to the Airtable data source will be pulled in @st.cache(ttl=60*5) def load_data():...
true
0e1b5392999fcb9649742a14ad678c1c077c62af
jesicag/Book-Classification
/newproject/TextClassification/MainFunction/main.py
UTF-8
5,114
3.203125
3
[]
no_license
#################################### Import Data ###################################### import pandas as pd import numpy as np import pickle from sklearn.model_selection import train_test_split from sklearn.naive_bayes import MultinomialNB from nltk.corpus import stopwords from sklearn.feature_extraction.text import Co...
true
a97412dc5ed2f8c87484a06a5168895f0ba8343f
saisrihari/Programs
/python_class/last/database.py
UTF-8
791
2.953125
3
[]
no_license
# import sqlite3 # connection=sqlite3.connect('python_bvc') # connection.close() import sqlite3 connection=sqlite3.connect('python_bvc') # connection.execute('''CREATE TABLE Batch2(Id int PRIMARY KEY,FirstName text not null,LastName text not null,address varchar2(50))''') # connection.execute(''' INSERT INTO Batc...
true
56989b84f2c6e3b91637c723ab938fa78575e140
vitosoliveira/Python
/Orientada Objeto/teste_controle.py
UTF-8
1,033
3.234375
3
[]
no_license
import controle1 ElevadorEsquerda = controle1.Elevador(10, [0, 1, 3, 5, 6]) ElevadorDireita = controle1.Elevador(10, [-2, -1, 0, 1, 2, 3, 4, 5]) Elevador1 = controle1.Elevador(10, [-4, -2, 0, 2, 4, 6, 8, 10, 12]) Elevador2 = controle1.Elevador(10,[-3, -1, 0, 1, 3, 5, 7, 9, 11, 13, 15]) elevador3 = controle1.Elevador...
true
45498165e2ba782ce645808bf9f3f54bb597690a
will-camb/Nero
/legacy/Visualise.py
UTF-8
767
3.140625
3
[ "MIT" ]
permissive
import pandas as pd import seaborn as sns # see notebook for full set of code - this is a test # Load the data data = pd.read_csv('https://raw.githubusercontent.com/FBosler/AdvancedPlotting/master/combined_set.csv') # this assigns labels per year data['Mean Log GDP per capita'] = data.groupby('Year')['Log GDP per ...
true
1d949e61f7e65f988afff9f24757888a7385d239
Mapaseka/censusreporter
/censusreporter/api/scripts/load_field_by_geo.py
UTF-8
4,463
2.703125
3
[]
no_license
import os import sys import unicodecsv as csv from api.models import get_model_from_fields, Base, Province from api.utils import get_session, _engine def open_census_csv(filepath): ''' Reads a SuperCROSS or SuperWEB csv file. First call returns column names and values. Example: (['Like colour?', 'Co...
true
c85bad5dfaf55ff8394e3ddcdabca09ca7d9dd45
hunterluok/Security
/pythoncode/queue.py
UTF-8
750
3.296875
3
[]
no_license
from pythoncode.node import SingleNode class Queue: def __init__(self): self.head = None self.tail = None self.count = 0 def push(self, value): new_node = SingleNode(value) if self.head is None: self.tail = new_node self.head = self.tail ...
true
3ba8d8e04f3c69c20ca365c19ed8edd44b27d5cf
pyarun/Nexus9kScript_Mockup
/nexusscripts/today_test_anothercategory_system_gopal.py
UTF-8
567
2.515625
3
[]
no_license
"""Script Cataloging Information :Product Info:Nexus::9000::9516::NX-OS Release 6.2 :Category:NewCategory :Box Type:On-Box :Title:Today Test Script with New Category by Gopal :Short Description:This script to monitor System resources and modified. :Long Description:This Script to monitor System resources and modified l...
true
311e889de6a8eaf5ac16ab9694356adc766ef859
Chrisaor/django-document
/app/relations/many_to_many/models/intermediate.py
UTF-8
1,556
2.609375
3
[]
no_license
from django.db import models from django.db.models.functions import datetime from django.utils import timezone # Extra fields on many-to-many relationships __all__ = ( 'Post', 'User', 'PostLike', ) class Post(models.Model): title = models.CharField(max_length=50) like_users = models.ManyToManyFie...
true
5138f32cc573d868102a0725d65df38f6d2a9c4e
nooraelina/school-work
/Ohjelmoinnin-perusteet/tk_dialog.py
UTF-8
985
3.703125
4
[]
no_license
import tkinter as tk import tkinter.messagebox as msg # Answer button pressed def answer(): # Error message box with OK button # 1st param is a title, 2nd param is a text msg.showerror("Answer", "Sorry, no answer available") def callback(): # Yes No box # If the user clicks Yes, askyesno returns T...
true
ac7e54790b003e4fbb48965a40451adba801e941
ovvladimir/voice_control
/mic.py
UTF-8
621
2.609375
3
[ "BSD-3-Clause" ]
permissive
import sounddevice as sd import numpy as np from threading import Thread from settings import * class Microphone: def __init__(self): self.stream = sd.InputStream(channels=2, callback=self.audio_callback) self.duration = 0 def start(self): Thread(target=self.update_frame, args=()).sta...
true
023cb89aab97ed616db725f80511121af53d2925
leonaiverson/ygg
/benchmark/scripts/plot.py
UTF-8
3,968
2.953125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import json import seaborn as sns import re import sys import os import pandas as pd from matplotlib import pyplot as plt DEFAULT_STYLE = { 'secondary': 'style' } class ExperimentPlotter(object): def __init__(self, data, x='base', style=DEFAULT_STYLE): self._raw_d = data self._x_dimension = x...
true
320873483f9d9f97931ab8fcbbf051f0b94ad3ca
fernandorssa/CeV_Python_Exercises
/Desafio 70.py
UTF-8
643
4.03125
4
[]
no_license
cont = soma = aux = 0 while True: nome = str(input('Digite o nome do produto: ')).strip() valor = float(input('Digite o valor do produto: R$ ')) if aux == 0: barato = valor nomeBarato = nome aux += 1 soma += valor if valor > 1000: cont += 1 if valor < barato: ...
true
3385b15970493950a6cd06f2ff4fb51ed9a4c3c5
Navneeth-7/Python-Programs
/demo2_web.py
UTF-8
800
3.34375
3
[]
no_license
''' Create a python script called googlesearch that provides a command line utility to perform google search. It gives you the top links (search results) of whatever you want to search on google Input:- python demo2_web.py 'Edureka' ''' # Performing google search using Python code import sys class Gsearch_pyth...
true
42b05373523555e6194fe13a29d2a8d6decfd455
thinh18521442/demo23-6
/BackwardChaining.py
UTF-8
1,593
3.15625
3
[]
no_license
def DocFile(): f1 = open("Rules.txt", "r") f2 = open("Hypthesis.txt", "r") f3 = open("Goal.txt", "r") Program = f1.readlines() facts = f2.readlines() goals = f3.readlines() f1.close() f2.close() f3.close() return Program, facts, goals def CreateRules(Program, facts, goals): ...
true
9552b919778e9b72bd318e0e77821fbb00e2245a
Aasthaengg/IBMdataset
/Python_codes/p02717/s097224250.py
UTF-8
64
2.875
3
[]
no_license
xyz = input().split() print(xyz[2]+ " " + xyz[0] + " " + xyz[1])
true
8266e21824b0b5ebe0bfa72ca8dea4bd19d8a8d7
gholamifarshad98/stretchableMinMaxStereo
/Matcher.py
UTF-8
3,981
2.59375
3
[]
no_license
import cv2 import numpy as np from R2LKernel import R2LKernel from L2RKernel import L2RKernel from U2DKernel import U2DKernel from D2UKernel import D2UKernel class Matcher: def __init__(self, minNumOfRow, minNumOfColumn, leftImage, rightImage, disparity, stretchThreshold): self.leftImage = leftImage ...
true
388f4b196870cf89fcd9df97277d6952be18a1ed
dbconfession78/fitbit_to_sds
/helper_functions.py
UTF-8
2,924
3.09375
3
[]
no_license
from datetime import datetime """ helper_functions: contains output and error handling methods """ def cleanup_single(client, namespace_id, type_id): """Deletes streams and types related to a type id""" print("Deleting stream, '{}'".format(type_id)) supress_error(lambda: client.delete_stream(namespace_id,...
true
e16800990bb2e6ecf560590f98a5d2c5b3601770
skelsec/jackdaw
/jackdaw/utils/encoder.py
UTF-8
604
2.765625
3
[]
no_license
import json import enum import ipaddress import datetime class UniversalEncoder(json.JSONEncoder): """ Used to override the default json encoder to provide a direct serialization for formats that the default json encoder is incapable to serialize """ def default(self, obj): if isinstance(obj, datetime.datetime...
true
1f630f093ef60e94651883bf4f537e097f55fe5c
piersto/python_training_3
/model/contact.py
UTF-8
297
2.8125
3
[ "Apache-2.0" ]
permissive
class Contact: def __init__(self, firstname=None, lastname=None, middlename=None, birthday=None, birth_month=None): self.firstname = firstname self.lastname = lastname self.middlename = middlename self.birthday = birthday self.birth_month = birth_month
true
7e5c6b14035770b8af441d9207753f33f1e568e1
wilsonx2rt/propulsion-pre-work
/python/sandbox.py
UTF-8
13,713
3.265625
3
[]
no_license
# def is_prime(x): # if x < 2: # return False # else: # for n in range(2, x-1): # if x % n == 0: # return False # return True # print(is_prime(4)) # # # def factorial(x): # num = x # result = 1 # while num >= 1: # result *= num # nu...
true
839c7d625cbb3e374d54c0fee02c758bbea463b2
mfuasi/hyperskill_password_hacker
/Problems/Solar system/task.py
UTF-8
241
2.9375
3
[]
no_license
# create the planets.txt planets = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune'] file = open('planets.txt', 'w', encoding='utf-8') for planet in planets: file.write('{}\n'.format(planet)) file.close()
true
6b35c8233ad34abf0c5956b10bce7877cbdf85a1
LU-Jingyu/aid-month01-updated
/day05/exo01.py
UTF-8
584
3.390625
3
[]
no_license
""" day04作业 """ # long = int(input("请输入边长: ")) long = 4 for item in range(long): for i in range(long): # 判断是不是行首和行尾 if item==0 or item==long-1: if i==long-1: print("*") else: print("*", end="") else:#不是行首...
true
d50cca516912230777a4d1da11f2831de07cfb6a
KeveenT/HydraFrac-Acoplado
/workspace/porous_flow_2d/vug/show_fluxes.py
UTF-8
1,189
2.515625
3
[]
no_license
import sys, os import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import cm def show_fluxes(fileName, scatter=False, save=True): data = pd.read_csv(fileName) X1 = np.array(data["X1"]) Y1 = np.array(data["Y1"]) X2 = np.array(data["X2"]) Y2 = np.array(data["Y2"]) XC = [ sum(e)...
true
0523008ae90aac04a1f17b806a7cfec02d325166
sstupkiewicz/api-perftest
/lib/Test.py
UTF-8
1,615
2.984375
3
[]
no_license
import requests import threading import sys from datetime import datetime requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning) class Test(object): def __init__(self, url, client_id, burst, threads_n): self.url = url self.burst = burst self...
true
20ec60eeb210046452bf97c6f3bcdd9198297c74
OutOfCache/raetselbox
/main.py
UTF-8
1,084
2.96875
3
[]
no_license
# wenn Pfade genommen werden, dann kann man auch die einzelnen Klassen weglassen import json, raetsel as r import display import random scenes = [["arctic.json", "atlantis.json"], ["pyramid.json", "swamp.json"]] #temperature = float(input("Temperatur: ")) #humidity = float(input("Luftfeuchtigkeit: ")) # f...
true
787f9aa5295fdd32b57ed16eac3af039422e3416
johnpaulguzman/MINLP-Solve
/minlp/alpha_generator.py
UTF-8
29,480
2.59375
3
[]
no_license
import os import subprocess import config from time import time ################################################################################################ from threading import Thread import functools def timeout(timeout): def deco(func): @functools.wraps(func) def wrapper(*args, **kwargs):...
true
9e2bc84d1614661602d5565ecf92db2a73178e78
TavranCode/KerbalKockpit
/Python Controller/Utilities.py
UTF-8
3,782
3.046875
3
[ "Unlicense" ]
permissive
from math import sqrt from tkinter import * from tkinter import ttk # UTILITY Functions # determines if bit n is set in val x def is_set(val, pos): return val & 2 ** pos != 0 # takes a flight control input 0-255 and returns a value -1 to 1. # it also applies a linear dead band, adds a trim value and allows sc...
true
dcf65397e63490a17d9b2f32fd9c9cb91385f5fb
LouisonR/OPSD_dash
/data_process.py
UTF-8
1,975
2.921875
3
[]
no_license
from datetime import datetime as dt from dateutils import relativedelta import pandas as pd import numpy as np from fbprophet import Prophet def load_data(csv_filepath, start_date): """ Returns a dataframe. Parameters: csv_filepath: string start_date: datetime Returns: df: pd.Data...
true
77f4a01d988b3ac82340f5f5103d51d2afabdf87
mattiastofte/just-dont-die
/scripts/setup.py
UTF-8
859
2.796875
3
[ "MIT" ]
permissive
def install(libary): if libary == "pygame": print("[info] installing pygame 2.0.0 ...") try: os.system("pip3 install pygame==2.0.0") print("[info] correct version of pygame was successfully installed") except: print("[error] failed to install correct versi...
true
74bf8b4e41fd40cf8194d5dfc48928c3d83cde73
shaoweigege/hello-world-python3
/calculadora_py/aritmetica/exponencial.py
UTF-8
385
3.03125
3
[]
no_license
import sys sys.path.append('/home/danielle8farias/hello-world-python3/meus_modulos') from mensagem import ler_cabecalho from numeros import ler_num_float, ler_num_int from math import pow def exponenciar(): ler_cabecalho('exponenciação') base = ler_num_float('Digite o número da base: ') expo = ler_num_int...
true
88f5bf2f4a6ed466b727e8a593beaf8068322d7e
billdthompson/parse-wiki-pages
/main.py
UTF-8
2,847
2.609375
3
[]
no_license
# coding: utf-8 # Author: # ----------- # Copyright (C) 2017 Bill Thompson (biltho@mpi.nl) # # # Description: # ----------- # Parses a Wikimedia sql dump of the page table (e.g. avwiki-latest-page.sql.gz) for a given wiki. # Dumps hosted at e.g. "https://dumps.wikimedia.org/{0}wiki/latest/{0}wiki-latest-page.sql.gz"...
true
11d20191a6217ec9ed61653d22f58fb1d1f30564
Petlja/StemSimulacijeOS-files
/06_sila_trenja/trenje_velicina_sanduka2.py
UTF-8
374
2.734375
3
[]
no_license
import math from simanim import * def setup(m): PixelsPerUnit(60) ViewBox((0, 0), 10, 6) FramesPerSecond(30) UpdatesPerFrame(1) m.masa = InputFloat(1.5, (1, 3)) def update(m): Finish() def draw(m): sanduk_vel = (2 * m.masa) ** (1/3) sanduk = Image('box.png', (1, 1), sanduk_vel, san...
true
2e84726993643c152815de06f2723f0e84673768
harrisonlingren/CS435
/sockets/python/TCPClient.py
UTF-8
840
3.234375
3
[ "MIT" ]
permissive
#!/usr/bin/env python import socket import sys def main(argv): server = argv[0] port = argv[1] #create an INET, STREAMing socket s = socket.socket( socket.AF_INET, socket.SOCK_STREAM) # now connect server on the specified port s.connect((server, port)) message = raw_input('Input a mes...
true
e72fa10e328af20566e6b3302c777f8e319ccd5b
damian1421/python
/tables.py
UTF-8
161
3.515625
4
[]
no_license
numbers = range(1,11) for x in numbers: print ("Table of: ",x) for i in range(1,11): print (x," x ",i," = ",x * i) print ("------------------------------")
true
6b41539b24bfbe00c4a5916e50cd0cf019adb514
cseelye/sfauto
/volume_get_iqn.py
UTF-8
2,724
2.65625
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ This action will print the IQN of a volume """ from libsf.apputil import PythonApp from libsf.argutil import SFArgumentParser, GetFirstLine, SFArgFormatter from libsf.logutil import GetLogger, logargs from libsf.sfcluster import SFCluster from libsf.util import ValidateAndDefault, NameOrID, ...
true
f54f4ae69d4a888242a11067da9ad1196106c0e8
PlethoraChutney/Appia
/src/appia/parsers/user_settings.py
UTF-8
3,734
2.609375
3
[ "MIT" ]
permissive
import json import os import logging class AppiaSettings(object): def __init__(self, settings_path=None) -> None: if settings_path is None: settings_path = os.path.expanduser("~/.appia-settings.json") self.settings_path = settings_path try: with open(settings_path...
true
09b58297a175bd2446e3a2371ee3160f52eac25c
LeoWshington/Exercicios_CursoEmVideo_Python
/ex080.py
UTF-8
589
3.78125
4
[ "MIT" ]
permissive
lista = list() for c in range(0, 5): n = int(input('Digite um valor: ')) if c == 0 or n > lista[-1]: lista.append(n) print('Adicionado na ultima posição.') else: pos = 0 while pos < len(lista): if n <= lista[pos]: lista.insert(pos, n) ...
true
f041e2c1af85e6bce42822a3e1def799777fb88a
qq491577803/CNN-Lane-Detect
/HuaWeiOj/递归全排列.py
UTF-8
346
3.390625
3
[]
no_license
COUNT=0 def perm(n,begin,end): global COUNT if begin>=end: COUNT +=1 print(n) else: i=begin for num in range(begin,end): n[num],n[i]=n[i],n[num] perm(n,begin+1,end) n[num],n[i]=n[i],n[num] n=['a','a','c','d','e','f','g'] perm...
true