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 |
|---|---|---|---|---|---|---|---|---|---|---|
a6fada3b86c3ccbff0dd04621b3fe843580538c1 | jedzej/tietopythontraining-basic | /students/jakielczyk_miroslaw/lesson_03_functions/InputValidation.py | UTF-8 | 445 | 3.875 | 4 | [] | no_license | # Input Validation
while True:
try:
number = int(input("Enter the integer number "))
break
except ValueError:
print ("Entered number is not integer")
def collatz(number):
if number % 2 == 0:
print (number // 2)
return (number // 2)
elif number % 2 == 1:
... | true |
4bc312640467ef38a00776921d7abb66c95ec09a | Chaoran-sjsu/258-Deep-Learning | /Project 1/project-1.py | UTF-8 | 3,699 | 2.765625 | 3 | [] | no_license | import cv2
import numpy as np
import os
cap = cv2.VideoCapture('/home/lei/Desktop/258/IMG_213804654.mp4')
def empty(a):
pass
cv2.namedWindow("Parameters")
cv2.resizeWindow("Parameters",640,240)
cv2.createTrackbar("Threshold1","Parameters",150,255,empty)
cv2.createTrackbar("Threshold2","Parameters",255,255,em... | true |
a5de4d3639e20a28e85f9b1dd8af72ece260702d | bradosev03/Song-Identification-System- | /accuracy.py | UTF-8 | 1,897 | 3.21875 | 3 | [] | no_license | '''
@Author: Brandon Radosevich
@Date: September 26, 2016
@Description: Finds the accuracy of the predictions based on a given key.
'''
import argparse
'''
class: Accuracy
date: September 26, 2016
definition: This class finds the accuracy of the predictions with a given key.
'''
class SongAccuracy(object):
def __... | true |
903115b8a6e3efd8bf9515d51d66cc6236d275d5 | houxiaona/Web_Scraping_Py | /Storing data/database/databaseFunction.py | UTF-8 | 1,114 | 2.796875 | 3 | [] | no_license | from urllib.request import urlopen
from bs4 import BeautifulSoup
import datetime
import random
import pymysql
import re
import ssl
conn = pymysql.connect('localhost','root','PVR@ne2114','scraping')
cur = conn.cursor()
cur.execute('USE scraping')
random.seed(datetime.datetime.now())
ssl_context = ssl.SSLContext(ssl.P... | true |
1c7de7a99ace23b0b368adb38eca5c055d03ec44 | sbkg0002/apple-trailers-lambda | /lambda_function.py | UTF-8 | 1,507 | 2.59375 | 3 | [] | no_license | import xmltodict
import requests
import boto3
output_filename = '/tmp/newest_720p.html'
def loadRSS(url):
# creating HTTP response object from given url
resp = requests.get(url)
# # saving the xml file
# with open('newest_720p.xml', 'wb') as f:
# f.write(resp.content)
return xmltodict.p... | true |
d07efe9a67b641ff19e8f5cb3c9a98d15e2dedf7 | gabriellaec/desoft-analise-exercicios | /backup/user_233/ch159_2020_04_29_12_45_43_246565.py | UTF-8 | 79 | 2.796875 | 3 | [] | no_license | arquivo = open('estoque.json')
for x in arquivo: print(x)
arquivo.close() | true |
0f81831c72853b1174e64ff0519676b7ce506add | mehdi1361/tadbir | /data_entry/file_type.py | UTF-8 | 537 | 3.015625 | 3 | [] | no_license | import csv
from bank.models import FileType
def csv_reader(file_obj):
reader = csv.reader(file_obj)
lst_data = []
for row in reader:
row_data = row[0].strip()
if row_data not in lst_data:
lst_data.append(row_data)
print(lst_data)
for row in lst_data:
FileType.... | true |
feab8fc315d85ef866637912f2152b9903960c6c | BuildingDecarb/URAP_2020 | /Housing_Class1.py | UTF-8 | 51,288 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 27 05:36:53 2017
@author: shubaraghavan
"""
from Appliances_Class import *
from Inputs_Energy import *
import CAISO
from CAISO.mapping.py import *
import copy
# from AnnualHeatDemand import AnnualEngDemand
# import xlrd
# import xlsxwriter
import numpy as np
# import seab... | true |
6e016c33ceb14a6e37fad0cb2a9e78ba241e446d | naveens33/selenium_python | /misc/headless_execution.py | UTF-8 | 608 | 2.59375 | 3 | [] | no_license | from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.firefox import GeckoDriverManager
from datetime import datetime
'''
options = webdriver.FirefoxOptions()
options.headless = True
driver = webdriver.Chrome(GeckoDriverManager().install(),options=options)
'''
... | true |
ebc33b325cfc1aff84e5ea3cd314cb04062aca82 | abdul-hamid-achik/punto_de_venta-demo | /Gui/Punto de venta.py | UTF-8 | 1,508 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python3.4
from tkinter import *
pvv = Tk()
pvv.title("AbsNet Bot - Punto de venta")
pvv.geometry("800x600")
# Esto es para centrar la ventana
pvv.withdraw()
pvv.update_idletasks()
x = (pvv.winfo_screenwidth() - pvv.winfo_reqwidth()) / 4
y = (pvv.winfo_screenheight() - pvv.winfo_reqheight()) / 7
pvv.geom... | true |
794c1d4ab075a43986b2ebe19167aa853a46e43c | zzwei1/international_radar_data | /src/TAARSRAD19/prep_TAASRAD19.py | UTF-8 | 2,581 | 2.53125 | 3 | [
"MIT"
] | permissive | import glob
import pandas as pd
import numpy as np
import os
import sys
import matplotlib.pyplot as plt
import h5py
def dBZ_to_rainfall(dBZ, a=None, b=None):
"""Convert dBZ to rainfall intensity
Parameters
----------
dBZ : np.ndarray
a : float32, optional
b : float32, optional
Returns
... | true |
fa765e78793c8091e20577ee25ff9075b37fc2c0 | martymonero/ctf | /2018/rctf/misc/numbers-game/numbers-game.py | UTF-8 | 4,833 | 2.875 | 3 | [] | no_license | #WE NEED TO SOLVE THAT
#sha256(****+gyGL3f32N1uResZ4) == 4fa45bd058a5f5e2d4ead259212f0ecb8f721eeb411d7521a9b640e05d3675a6
#https://stackoverflow.com/questions/4719850/python-combinations-of-numbers-and-letters
#https://www.owasp.org/index.php/Password_special_characters
#https://puzzling.stackexchange.com/questions/546... | true |
8ceb770776ffd831d69eacf9ebd42fb49c05ed7f | cmontalvo251/Microcontrollers | /Circuit_Playground/CircuitPython/libraries/adafruit-circuitpython-bundle-7.x-mpy-20230406/examples/requests_api_github.py | UTF-8 | 3,430 | 2.859375 | 3 | [] | no_license | # SPDX-FileCopyrightText: 2022 DJDevon3 for Adafruit Industries
# SPDX-License-Identifier: MIT
# Coded for Circuit Python 8.0
"""DJDevon3 Adafruit Feather ESP32-S2 Github_API_Example"""
import gc
import time
import ssl
import json
import wifi
import socketpool
import adafruit_requests
# Github developer to... | true |
55f0637a4deabd1228f707ceb732f77adf3ef910 | sarahloh/p4-online-cookbook | /test_cookbook.py | UTF-8 | 11,319 | 2.96875 | 3 | [] | no_license | """
Test suite for Online Cookbook
"""
import unittest
import app
from bson.objectid import ObjectId
class TestCookbook(unittest.TestCase):
"""
Test suite for Online Cookbook
"""
def test_get_recipes(self):
"""
Test to ensure we can read recipes collection from the database
"... | true |
e26b997367fa0233fcf5c821a338f13fecabf49d | eliaswil/Cryptography | /caesar.py | UTF-8 | 1,005 | 3.578125 | 4 | [] | no_license | from typing import *
lower_case_alphabet = [chr(c) for c in range(ord('a'), ord('z')+1)]
upper_case_alphabet = [chr(c) for c in range(ord('A'), ord('Z')+1)]
def shift(message :str, shifts :int):
new_message = ''
for c in message:
# lower-case
if ord('a') <= ord(c) <= ord('z'):
new... | true |
f441053d60c70f124706e020b730573ee1084769 | RavicharanN/django-test-project | /source/scripts/git_repos.py | UTF-8 | 1,028 | 2.8125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
#username = input('enter github username - ')
url = "https://github.com/RavicharanN"
sauce = requests.get(url)
soup = BeautifulSoup(sauce.content,'html.parser') # lxml is a parser
#print(soup)
repoNo = int(soup.find('span',class_='Counter').text)
n1 = ... | true |
8af7b889db230ad9d952115a23768f8d93d1b608 | vmirisas/Python_Modules | /Math/lesson3/exercise5.py | UTF-8 | 129 | 3.40625 | 3 | [] | no_license | from math import fabs
for x in [-43, 0, 43]:
print(f"fabs({x}) = {fabs(x)}")
print(f"abs({x}) = {abs(x)}")
print("") | true |
0c6f6db7d3429607f5b68aa701ef53e34c7b7a0e | macintoshhelper/table-parser-opencv | /utils.py | UTF-8 | 2,918 | 2.890625 | 3 | [
"LicenseRef-scancode-proprietary-license",
"MIT"
] | permissive | import cv2 as cv
import pytesseract as tess
from PIL import Image
import subprocess as s
import os
"""
Apply morphology operations
"""
def isolate_lines(src, structuring_element):
cv.erode(src, structuring_element, src, (-1, -1)) # makes white spots smaller
cv.dilate(src, structuring_element, src, (-1, -1)) # makes ... | true |
7c1099d25cd9ad35301fdeda03bf9ff18c988fbb | kyonetca/DNA | /update/update_cmu.py | UTF-8 | 3,409 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
from spider import *
class CMUSpider(Spider):
dept_dict = {}
semester_list = ["S15", "F14", "M14"]
def __init__(self):
Spider.__init__(self)
self.school = "cmu"
def getDescription(self, url):
r = requests.get(url)
soup = BeautifulSoup(r.text);
... | true |
7fb5de2d57d450cc02429674fa1bb4783ee3025f | owenGnet/edu | /HarvardExtension/CSCI_E-88/HW3_MapReduce_Avro/src/p1_mapper.py | UTF-8 | 610 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import collections
single_map = collections.defaultdict(dict)
for line in sys.stdin:
timestamp, url, user_id = line.strip().split('\t')
if url in single_map and user_id in single_map[url]:
# this url already registered a hit for this uid, increment the cou... | true |
43694e2cc9f7f4771e6c4ff2727ed3c27e50b24f | Nermin-Ghith/ihme-modeling | /shared_code/central_comp/risk/burdenator/data_source.py | UTF-8 | 10,173 | 2.71875 | 3 | [] | no_license | import logging
from transmogrifier.common import exceptions as ex
from transmogrifier.common.files import draw_manager
from db_queries import get_population
from db_tools import ezfuncs
from dalynator.computation_element import ComputationElement
logger = logging.getLogger(__name__)
_draw_cols = ["draw_" + str(i) f... | true |
83bf9e62148f8ba2ff96fe257fc67eed0a442195 | Ford-z/LeetCode | /252 会议室.py | UTF-8 | 727 | 3.390625 | 3 | [] | no_license | #给定一个会议时间安排的数组,每个会议时间都会包括开始和结束的时间 [[s1,e1],[s2,e2],...] (si < ei),请你判断一个人是否能够参加这里面的全部会议。
#来源:力扣(LeetCode)
#链接:https://leetcode-cn.com/problems/meeting-rooms
#著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
class Solution:
def canAttendMeetings(self, intervals: List[List[int]]) -> bool:
time = sorted(intervals, key = la... | true |
6b7458333e02fe7956ab3e63eecef69459232702 | kwx4github/facebook-hackercup-problem-sets | /2015/qualifying_round/2.New_Year's_Resolution/solutions/sources/744.Matteo | UTF-8 | 1,561 | 3.4375 | 3 | [] | no_license | #!/usr/bin/python
import sys
class Problem(object):
def __init__(self,target,foods):
self.target = target
self.foods = foods
def solve(self):
sum_idx = range(len(self.foods))
if self.is_possible((0, 0, 0), sum_idx):
return "yes"
else:
return "no"
def is_possible(self,current_tuple,sum_idx):
con... | true |
cf29f35394ce891ccad6334427decf8d5a937d29 | rnqforce/tema11 | /lab2ii1.py | UTF-8 | 141 | 3.34375 | 3 | [] | no_license | p=1
for i in range(10):
a = int(input("a="))
p = p*i
k=0
while (p%10==0):
k=k+1
print ("numarul de zerouri =" , k)
| true |
41ed1d53bd0666b1563799b6d802a20df366fbd9 | ThibaultBus/trapon-prenom | /name_generator.py | UTF-8 | 204 | 3.421875 | 3 | [] | no_license | import random
class NameGenerator:
def __init__(self, file: str) -> None:
self.names = open(file).readlines()
def get_random_name(self) -> str:
return random.choice(self.names)
| true |
620540ed98740be1997dbadc8efd0a6f35e5aa33 | Ilgrim/cwmud | /cwmud/contrib/worldgen/terrain.py | UTF-8 | 8,339 | 2.984375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""Terrain types and management."""
# Part of Clockwork MUD Server (https://github.com/whutch/cwmud)
# :copyright: (c) 2008 - 2017 Will Hutcheson
# :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt)
from os.path import dirname, exists, join
from ...core.attributes import U... | true |
f7ff443945544c4dc9421e5d120c2ae3044e8956 | mneira10/IBIO4490 | /09-HOG/code/extraCredit/eval.py | UTF-8 | 2,087 | 2.859375 | 3 | [] | no_license | import numpy as np
def jaccard(anot, pred):
ax, ay, aw, ah = [int(x) for x in anot.split(' ')[1:]]
# print(pred)
px, py, pw, ph = pred
maxx = max(ax, px)
maxy = max(ay, py)
minx = min(ax+aw, px+pw)
miny = min(ay+ah, py+ph)
iw = minx-maxx+1
ih = miny-maxy+1
inter = iw*ih
... | true |
ba8c51bacf7b0656198099214566070e8414ce6e | VaibhavBiturwar/Image-processing | /demo.py | UTF-8 | 838 | 3.34375 | 3 | [] | no_license | import cv2
# returns a 3D array for colored image ->second parameter 1
# 2D array for grayscale image -. second parameter 0
# Numpy_array imread( File_location , 0-1)
# img = cv2.imread("C://Users//lenovo//Desktop//OpenCV//image.png", 1)
# print(img)
# print(type(img))
# TO GET THE SIZE OF THE IMAGE
# print(img.shap... | true |
f579b890c5e1c0738dee0aaaeb989e68541be985 | SilentByte/pothole-map | /lambdas/potholemap/db.py | UTF-8 | 3,474 | 2.75 | 3 | [
"MIT"
] | permissive | """
Pothole Map
Copyright (c) 2020 by SilentByte <https://www.silentbyte.com/>
"""
import pytz
import psycopg2
import geohash2
from typing import (
Callable,
List,
Optional,
Tuple,
)
from uuid import UUID
from datetime import datetime
def _utc_now() -> datetime:
return datetime.utcnow()... | true |
0866142180d08feba67feb38436182f5c16ce8e1 | N4karin/pdf-resize | /main.py | UTF-8 | 1,905 | 2.90625 | 3 | [] | no_license | import glob
import PyPDF2
# Parameters for output-files (in pixel)
mapPdfWidth = 150
mapPdfHeight = 100
previewPdfWidth = 550
previewPdfHeight = 125
# other global variables
pdfs = []
pdf_width = 0
pdf_height = 0
target_height = 0
previewType = ""
def readfiles():
# read pdfs in same directory... | true |
fea330e7e140ec351028d1e2b0e545044ecaa769 | skosch/YinYangFit | /engine/radial_filter.py | UTF-8 | 4,977 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import gputools
class RadialFilter:
def __init__(self, n_scales, n_orientations, exponent, padding_factor, box_height, box_width):
self.box_height = box_height
self.box_width = box_width
self.n_scales = n_scales
... | true |
b04d1b5ef162d79acaef5dc9c3babc03332b9d12 | falahsuta/Info-Extraction | /algofiles/algos.py | UTF-8 | 2,807 | 2.796875 | 3 | [] | no_license | import re
from os import listdir
from os.path import isfile, join
from boyermore import *
from kmpsearch import *
from filehandler import *
from matchingexact import *
from exactregex import *
from utility import *
# algos.py adalah file main untuk menghandle teks nya, berbagai algoritma yang modular akan di pakai dis... | true |
69b1ff0143f1e64296b84764b06c975ee5fecb58 | prabhavathye/python_prog | /draw_square_turtle.py | UTF-8 | 572 | 3.9375 | 4 | [] | no_license | import turtle
def draw_shapes():
window =turtle.Screen()
window.bgcolor("red")
#square
brad = turtle.Turtle()
brad.shape("circle")
brad.color("green")
brad.speed(5)
for i in range(0,4):
brad.forward(100)
brad.right(90)
#circle
angie = turtle.Turtle()
angie.shape("a... | true |
410d6ae379c8917ba5f9963cd092439e71172810 | pradeep122/LearnPython | /sandeep/Tutorial-2-Examples/total-cost-cart.py | UTF-8 | 153 | 3.796875 | 4 | [] | no_license | # Calculate the total cost of items in shopping cart
total = 0
for prices in [10, 20, 30]:
total += prices
print(f"Total cost of items is: {total}")
| true |
7b2b6ccf624fe1514e793fa988b65bdfcbf86af4 | USTLZh/student-projects | /sequent-ablation/DLWPT/3-12-helper.py | UTF-8 | 1,805 | 2.625 | 3 | [] | no_license | from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
import os
head=r'E:\thesis_task\thesis2\3Dircadb_download\3Dircadb1.9\livertumor1_ALLDATA\livertumor1_output_txt\ndl_2\NSGA-II'
def get_Violent_pareto(result):
a = result[:, [5, 6, 7]]
pareto = []
i = 0 # i是被考核的,j是考... | true |
6edc5faaed64a3a53991108f76dd0e13f641677c | kantal/WPC | /ISSUE-5/SOLUTION-2/buffon.py | UTF-8 | 1,390 | 4.28125 | 4 | [] | no_license | # ---buffon.py --- Sebastian Plamauer ---
# This program calculates Pi using the solution of Buffons needle problem.
import random
import math
#Output Info
print 'This program calculates Pi using the solution of Buffons needle problem. You will have to enter the length of the needle, the width of the stripes and the ... | true |
ccbd0b9e5be51b81cee77289bc9630b9fa693a69 | 7imon7ays/protein-matcher | /matcher/models.py | UTF-8 | 1,962 | 2.5625 | 3 | [
"MIT"
] | permissive | from django.contrib.auth.models import User
from django.db import models
class Search(models.Model):
"""State management for every search."""
ERROR = 'ERROR'
FOUND = 'FOUND'
NOT_FOUND = 'EMPTY'
READY = 'READY'
RUNNING = 'RUN'
SEARCH_STATES = [
(ERROR, 'Error',),
(FOUND, 'S... | true |
c1d210952972879a14157f72574e28843b4f33f4 | OnlinePseudonym/cs50 | /pset6/sentiments/analyzer.py | UTF-8 | 1,159 | 3.53125 | 4 | [] | no_license | import nltk
from nltk.tokenize import TweetTokenizer
class Analyzer():
"""Implements sentiment analysis."""
def __init__(self, positives, negatives):
"""Initialize Analyzer."""
self.positives = set()
self.negatives = set()
with open(positives, 'r') as file:
for lin... | true |
73f539deb7a176630fc8bf730a27170d1e5cfc77 | garrettkatz/poppy-muffin | /ergo_jr/dxl_motor_control.py | UTF-8 | 882 | 2.65625 | 3 | [
"MIT"
] | permissive | import time
# for pip install --user poppy-ergo-jr, from_json source is at:
# ~/.local/lib/python3.8/site-packages/pypot/robot/__init__.py
from pypot.robot import from_json
# custom configuration based on PoppyErgoJr config file
# for pip install --user poppy-ergo-jr, config file is at:
# ~/.local/lib/python3.8/site-... | true |
b1d7e6f8c827ebc44cf865ef83087bc02c374686 | aronnyberg/finance-scripts | /getting_data/scraping_IWN_data_summary_not_used.py | UTF-8 | 3,857 | 2.953125 | 3 | [] | no_license | import pandas as pd
from yahoo_fin import stock_info
import numpy as np
#download IWN portfolio constituents at https://www.ishares.com/us/products/239712/ishares-russell-2000-value-etf/1467271812596.ajax?fileType=csv&fileName=IWN_holdings&dataType=fund
iwn_names = pd.read_csv(r'C:\Users\nyber\Documents\IWN_holdings.c... | true |
f6c952420d65cd55c7a0489ba798783d1f30d93b | skullhood/sscalculator | /SSCalculator.py | UTF-8 | 869 | 3.28125 | 3 | [] | no_license |
def print_ss_comma(alist, last):
for e in alist:
print(e, end="")
if not last:
print(",", end=" ")
samples = ["0", "1", "2"]
ss_size = 3
s_space = []
gs_space = []
#prep lists
for x in range(ss_size):
s_space.append(samples[0])
gs_space.append(samples[-1])
#last sample number
lsnum ... | true |
713619704f16c067823bf3168e44b435e5b19360 | ATanggara/Statistical_Machine_Learning_2019 | /lab_exam/stripped_lab_exam_0_files/python/test_linear.py | UTF-8 | 1,697 | 3.4375 | 3 | [] | no_license | import numpy as np
import traceback
import sys
import linear
def test_linear(x, y, w_true):
################################################
#
# INPUTS:
# x: input data, shape d by n
# y: output targets, shape n by 1
# w_true: true weights, shape d by 1, or None
#
# OUTPUTS:
# w: linear regression w... | true |
4dcd9f6cb048ca5a6ed03835147617545550a3f3 | ManaBingsu/algo-study | /algorithm/week2/sjmjys954646_PS/boj17413.py | UTF-8 | 1,299 | 3.40625 | 3 | [] | no_license | #메모리 : 29856 KB 시간 : 112ms
t = input()
tlen = len(t)
index = 0
findWord = True
printlist = []
wordlist = []
while index <= tlen :
if(index == tlen):
wordlist.reverse()
printlist.append(''.join(wordlist))
wordlist.clear()
break
ch = t[index]
if(ch == "<"):
... | true |
863a08824a5affa7df4fe6dd99015cc556170942 | floppp/programming_challenges | /project_euler/001-050/26.py | UTF-8 | 366 | 2.703125 | 3 | [
"MIT"
] | permissive | from numpy import sqrt
N = 10
l_ciclo = 1
# for i in xrange(1, 10 + 1):
for i in range(2, N + 1):
cadena = str(1 / i).split('0.')[1]
if len(cadena) > 10:
# while j < len(cadena):
if cadena[:l_ciclo + inc] == cadena[l_ciclo + inc:2 * (l_ciclo + inc)]:
print(cadena)
print(c... | true |
af094bf162dfb2989ad52871ea85c98c980606c1 | alejaz92/simulacion | /TP2/TP2.2.py | UTF-8 | 14,679 | 3.84375 | 4 | [] | no_license |
# Generador Numpy
import numpy as np
def np_method(m):
num_list = []
for i in range(m):
res = np.random.randint(1, 10000)
num_list.append(round(res/10000, 2))
return(num_list)
## Distribucion Uniforme
### Importaciones y parametros
import numpy as np
import matplotlib.pyplot as plt
... | true |
706154ad54fa6d95884904a9d9cd65e6acd8acdc | fieldplay/DeepQMC | /deepqmc/wavefunction/spherical_harmonics.py | UTF-8 | 2,901 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | import torch
from torch import nn
def SphericalHarmonics(xyz,l,m):
'''Compute the Real Spherical Harmonics of the AO.
Args:
xyz : array (Nbatch,Nelec,Nrbf,Ndim) x,y,z, distance component of each point from each RBF center
l : array(Nrbf) l quantum number
m : array(Nrbf) m quantum numbe... | true |
e9f51677968aa803b2722788cfb2356965727f7a | yen936/Data_Algos_Exercises | /BinarySearchTree/TreePrint.py | UTF-8 | 3,496 | 2.84375 | 3 | [
"MIT"
] | permissive | # Derived from: https://github.com/joowani/binarytree/blob/master/binarytree/__init__.py
# The following license applies to the TreePrint.py file only.
# MIT License
# Copyright (c) 2016 Joohwan Oh
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated ... | true |
ca264f7a5a76ce6019a3965752604b54bee03aa8 | kaisawind/raspberrypi | /python/sound/sound.py | UTF-8 | 384 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import time
import RPi.GPIO as GPIO
# UX3-6 ON
sound_pin = 18 # 声音传感器
GPIO.setmode(GPIO.BOARD)
GPIO.setup(sound_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
try:
while True:
if(GPIO.input(sound_pin) == GPIO.LOW):
print("Sound Detected")
time.s... | true |
d42a402dd5542607e56ebb4976d20389daf821c6 | BackendBoys-ISS/issrepo | /App/server/repository/SectionEntity.py | UTF-8 | 2,383 | 2.59375 | 3 | [] | no_license | from sqlalchemy import create_engine
from sqlalchemy import Column, String, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.types import BigInteger
db_string = "postgres://postgres:admin@localhost:5432/ConfSys"
db = create_engine(db_st... | true |
c0e619105346611682849d8061ebdafa990e0943 | ranjit-se7en/MyPython | /leapyear.py | UTF-8 | 287 | 3.265625 | 3 | [] | no_license | def is_leap(year):
leap = False
if (1900 <= year <=100000):
if year % 4 ==0 and (year % 100 !=0) or (year % 400 ==0):
leap=True
# Write your logic here
else:
leap=False
else:
leap=False
return leap
year = int(input()) | true |
e95d81c62fcbe53a9ef1a47ed8d0f5632180211f | MarconiS/DeepTreeAttention | /src/CHM.py | UTF-8 | 2,574 | 2.90625 | 3 | [
"MIT"
] | permissive | #CHM height module. Given a x,y location and a pool of CHM images, find the matching location and extract the crown level CHM measurement
import glob
import numpy as np
from src import neon_paths
import rasterstats
import geopandas as gpd
import pandas as pd
def non_zero_99_quantile(x):
"""Get height quantile of ... | true |
9b9857e43ca8907533e021e73ffbdacabf8ccd18 | woniucao520/Python_studying | /9月学习/0912/ctcn_homework.py | UTF-8 | 4,085 | 2.90625 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import requests
from lxml import etree
import csv
import MySQLdb
import Queue
import threading
import time
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
# from util.crawler import Header, Proxy 代理 请求头 我放在另个文件夹
# from database.db import Database
#
# con = Database.getConnection() ... | true |
7a9954c5b03f5932e4cc64fcfdc0a699c8580766 | WSJI0/BOJ | /1000-9999/3036.py | UTF-8 | 248 | 3.578125 | 4 | [] | no_license | '''
3036번
링
'''
import sys
input=sys.stdin.readline
n=int(input())
a=list(map(int, input().split()))
def GCD(a, b):
return b if a%b==0 else GCD(b, a%b)
for i in range(1, n):
g=GCD(a[0], a[i])
print(str(a[0]//g)+"/"+str(a[i]//g)) | true |
8c59f1e646efb3dfa1ba86520dfc10f5c9a54685 | mrsterkel/assignment-1-practice-designing-models-SamtheScientist | /code/RPPS_system/Sensor_Suite.py | UTF-8 | 1,980 | 3.203125 | 3 | [] | no_license | import random
class SensorSuite:
'''This is a multi-purpose sensor suite that controls which sensor is considered the primary and secondary'''
def __init__(self, infrared, ladar):
'''Initializes the sensor suite'''
self.infrared = True #identifies whether this sensor is active
... | true |
cd9cf42316c6232cd4a54177597fd082c1a4954f | briansukalski/Prequel_Chat | /Prequel-Chat.py | UTF-8 | 20,656 | 3.5625 | 4 | [] | no_license | import random
import re
#Builds out prequel quote dictionary
quotes = {}
regexes = {}
def add_quote(character, episode, quote):
if quotes.get(character) == None:
quotes[character] = {}
quotes[character]["I"] = []
quotes[character]["II"] = []
quotes[character]["III"] = []
quo... | true |
1ec3b62d0dc2afff83da8d5e7e3e2067c24ad992 | zh0uquan/LeetcodePractice | /Leetcode213.py | UTF-8 | 414 | 2.703125 | 3 | [] | no_license | class Solution(object):
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) <= 1:
return sum(nums)
def rob(nums):
prev = now = 0
for n in nums:
now, prev = max(prev + n, now)
retur... | true |
002370457c331e2021fab7334f50d4ccf9a7556a | kensworth/adv-py | /find_lexographic_rank.py | UTF-8 | 385 | 2.703125 | 3 | [] | no_license | def find_lexographic_rank(rem, res):
if not rem:
perms.append(res)
print res
if res == string:
return len(perms) % 1000003
for i in xrange(len(rem)):
rank = find_lexographic_rank(rem[:i] + rem[i+1:], res+rem[i])
if rank:
return rank
string = 'face... | true |
bc71ce07a990a342c81bf1d4097d3f0ee9940e4b | zhzc1202/USTH_GetThisSemesterGrade | /CheckGrade.py | UTF-8 | 1,500 | 2.546875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from urllib import parse, request
import http.cookiejar
from bs4 import BeautifulSoup
class USTH:
def __init__(self):
# login
self.loginURL = 'http://60.219.165.24/loginAction.do'
# grades URL
'''self.gradesURL = 'http://60.219.165.24/gradeLnAllActio... | true |
3d0837291f366e6d3a031ba71f65bea616e5e96a | Judith-0309/Python | /exo24.py | UTF-8 | 365 | 3.890625 | 4 | [] | no_license | nbre_secret = 20
nombre = int(input("saisir un nombre :"))
while nombre < nbre_secret:
print("plus petit")
nombre = int(input("saisir un nombre : "))
while nombre > nbre_secret:
print("plus grand")
nombre = int(input("saisir un nombre :"))
if nombre == nbre_secret:
print("Bravo vous av... | true |
12e4faacab385631eb3a297191eac88fea5b744c | MarcelloLins/LeetcodePractice | /Medium/022_generate_parenthesis.py | UTF-8 | 1,964 | 3.984375 | 4 | [] | no_license | """
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
Example 1:
Input: n = 3
Output: ["((()))","(()())","(())()","()(())","()()()"]
Example 2:
Input: n = 1
Output: ["()"]
"""
import unittest
class Solution(object):
def _generate_backtrack(self, res... | true |
2010f4fef0e92d4f4414ec05c4bbac41125bbfa2 | kboth/REsco | /venv/lib/python3.7/site-packages/genometools/ncbi/geo/functions.py | UTF-8 | 4,255 | 2.546875 | 3 | [] | no_license | # Copyright (c) 2015, 2016 Florian Wagner
#
# This file is part of GenomeTools.
#
# GenomeTools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License, Version 3,
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it w... | true |
bd4aa1c626dba18e9194807cd9ce649df5ef2046 | AlexMGitHub/DS-A_Python | /tests/func/interview/robot/test_robot_path.py | UTF-8 | 2,366 | 3.28125 | 3 | [
"MIT"
] | permissive | """Test solution to robot path programming test.
###############################################################################
# test_robot_path.py
#
# Revision: 1.00
# Date: 7/22/2021
# Author: Alex
#
# Purpose: Functional testing of the solution to the robot programming
# exerc... | true |
64d2eb7e2fb8899a43c1e3761d9064b6f3b8ce5e | callummole/monitorwaypoints_analysis | /Processing/inspect_clusters.py | UTF-8 | 887 | 2.8125 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
res = pd.read_csv("linmix_by_block_2.csv")
res = res.query('clust_n == 0').copy()
mn = res['mean'].values
plt.hist(mn, bins = 15)
plt.show()
"""
Cluster inference:
We have distribution means for each driving mode, pp, and block.
To estimate the populatio... | true |
05e0321dc85b5dfb8cef7befe1945ad754c81173 | arodriguxn/api_genetics | /app/error_handlers.py | UTF-8 | 1,126 | 3.359375 | 3 | [] | no_license | from flask import jsonify
class InvalidData(Exception):
"""Implementación de una excepción Flask.
Devuelve el código HTTP de error y un mensaje informando de tal error.
Por defecto, el error es 400.
Parameters
----------
message: str
mensaje de error
status_code: int
códig... | true |
f09dca511619903009b1b45b990c9de22edf1657 | trailofbits/polytracker | /polytracker/scripts/list_diff.py | UTF-8 | 651 | 3.109375 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-commercial-license",
"AGPL-3.0-or-later"
] | permissive | import sys
import os
MAIN_LIST: str = sys.argv[1]
CXX_LIST: str = sys.argv[2]
assert os.path.exists(MAIN_LIST)
assert os.path.exists(CXX_LIST)
main_items = []
new_items = []
with open(MAIN_LIST, "r") as main_file:
items = main_file.readlines()
for item in items:
end_pos = item.find("=")
main_i... | true |
539c0d7a92182803159dffee65a47d6b2eec9c1c | boyshen/NLP_project | /chinese_chatbot/module/core/mysql_fuzzy_query.py | UTF-8 | 2,479 | 2.9375 | 3 | [] | no_license | from jieba import posseg as pseg
save_word = ['a', 'n', 'an', 'v', 'vn', 'b', 'm', 't', 'l', 'i', 'eng']
def extract_keyword(sentence):
words = list()
for word, flag in pseg.cut(sentence):
if flag in save_word or flag[:1] in save_word:
words.append(word)
keyword = ','.join(words)
... | true |
6e182bfccc0392e2984a207dd974350d5a7c9b9c | mrhota/cs373 | /examples/Composite.py | UTF-8 | 578 | 3.8125 | 4 | [] | no_license | #!/usr/bin/env python
# ------------
# Composite.py
# ------------
# http://en.wikipedia.org/wiki/Composite_pattern
class Nil (object) :
def length (self) :
return 0
class Cons (object) :
def __init__ (self, first, rest) :
self.__first = first
self.__rest = rest
def length (sel... | true |
a7016196bf92f660adcdc0b0204fec91ce96c711 | DobyLov/loggenerator | /log_generator/files_logs_handler.py | UTF-8 | 788 | 2.953125 | 3 | [
"MIT"
] | permissive | """
Gestionnaire de fichier de Logz
-- log persistance sur fichier avec l' argurment fname
-- Error log
-- Enrengstrer le s logs dans un fs
"""
from datetime import datetime
from log_generator.dateTime_handler import get_dateNow
from log_generator.files_handler import write_file
from log_generator.dateTime_handler im... | true |
a3430b497e147f049bacadf4c2f5721331641f40 | MaximeBaudette/PARTF | /TestAutomation/LV-PY/Python/lta_err.py | UTF-8 | 1,985 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 26 10:11:32 2017
@author: AR
"""
import traceback
from collections import OrderedDict
class Lta_Error(Exception):
""" Error objects are created around python Exceptions and unparsed into
LabVIEW XML error clusters including the error <err>, <b>Complete call chain... | true |
846749d7c052fadea89ddca8ccdb28113dc1e223 | Slavkata/MAC | /API/models/loan_history.py | UTF-8 | 1,948 | 2.796875 | 3 | [
"MIT"
] | permissive | from models.db_init import db
from datetime import datetime
from models.loan_item import LoanItem
class LoanHistory(db.Model):
__tablename__ = "loan_history"
id = db.Column(db.Integer, primary_key=True)
ticket_number = db.Column(db.ForeignKey('tickets.ticket_number'), nullable=False)
item_number = db.... | true |
c5d764e724775418032f4fd9336d506dafa2c1d1 | pymft/mft-sk | /S05/functions/assignment.py | UTF-8 | 473 | 3.65625 | 4 | [] | no_license | def fact(n):
out = 1
for i in range(1, n + 1):
out = out * i
return out
def combination(m, n):
res = fact(m) / (fact(m-n) * fact(n))
return int(res)
def pascal_row(n):
out = []
for i in range(n+1):
temp = combination(n, i)
out.append(temp)
return out
def p... | true |
6f42a38d03beed0412a77bd5870854638202c7a3 | StarLight123/helloworld | /dengcha.py | UTF-8 | 681 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
x1=1
d=3
sum=0
i=0
for i in range(5):
sum=sum+x1
x1=x1+d
i=i+1
print sum
print r'''"to be or not to be":that is the question.
Whether it 's nobler in the mind to suffer
djsahfdngakdhgl
'''
print u"中"
# %d整数,%f浮点数,%s字符串,%x十六进制整数 格式化规则 %作%的转义
print "hello %s ,are you %d years old!" %(u"厅",1... | true |
4b04d6a379e88411c9ba99106c246bf32d70b99d | Orenmc/Nueral-Nets | /NN-From-Screatch/FC/NN.py | UTF-8 | 14,398 | 2.75 | 3 | [] | no_license | import numpy as np
import pandas as pd
import utils
import matplotlib.pyplot as plt
train_acc = []
val_acc = []
train_loss = []
val_loss = []
class NeuralNetwork:
def __init__(self, model_name='last_model', hidden=None, epochs=50, lr=0.001, norm=False, L2=False):
# self.lambd = None
self.train_da... | true |
682e28eec9c186671907e1cc92d19e5dc6b696e1 | dEiC/SNWebdevNaloge | /Naloga9/Naloga9_2/Naloga9_2.py | UTF-8 | 802 | 4.5 | 4 | [] | no_license | #FizzBuzz program
# User enters a number between 1 and 100
# FizzBuzz program starts to count to that number (it prints them in the Terminal). In case the number is divisible with 3, it prints "fizz" instead of the number.
# If the number is divisible with 5, it prints "buzz". If it's divisible with both 3 and 5, it ... | true |
ce571b22bf2a31c36fbeb56dfd694ddd18377884 | ric0man/MyML_projects | /svm_handling_linearly_non-separable_data.py | UTF-8 | 1,363 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[10]:
from sklearn.datasets import make_circles
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
X,Y=make_circles(n_samples=500,noise=0.05)
plt.scatter(X[:,0],X[:,1],c=Y)
plt.show(block=True)
# In[11]:
def phi(X):
"""non line... | true |
c7948d9757e549778d185580caa2a8a2acbd5560 | saraygrjim/adhara_project | /backend1/back.py | UTF-8 | 8,378 | 3.046875 | 3 | [] | no_license | import json
import random
from web3 import Web3, HTTPProvider
from PyInquirer import prompt, print_json
##----------------------INITIALIZATION OF CONTRACT----------------------##
blockchain_address = 'http://127.0.0.1:9545'
web3 = Web3(HTTPProvider(blockchain_address))
web3.eth.defaultAccount = web3.eth.accounts[0]
... | true |
f74133b94f700b435382ee1dd67240aabdf2845c | GeekDream-x/LeecodeStory | /LeetCodeTopList/Top-1-TwoNumSum.py | UTF-8 | 1,464 | 3.625 | 4 | [] | no_license | '''
给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 的那 两个 整数,并返回它们的数组下标。
你可以假设每种输入只会对应一个答案。但是,数组中同一个元素不能使用两遍。
你可以按任意顺序返回答案。
示例 1:
输入:nums = [2,7,11,15], target = 9
输出:[0,1]
解释:因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。
示例 2:
输入:nums = [3,2,4], target = 6
输出:[1,2]
示例 3:
输入:nums = [3,3], target = 6
输出:[0,1]
提示:
2 ... | true |
cc73f6919b3d8379a75bb0e48b14fd2f1c1d6cc1 | cy2296/leetcode | /problems/RemoveDuplicatesFromSortedListII.py | UTF-8 | 969 | 3.203125 | 3 | [] | no_license | from entities.ListNode import *
class Solution:
def deleteDuplicates(self, head):
dummy = ListNode(0)
dummy.next = head
pre, cur = dummy, head
while cur:
while cur.next and cur.next.val == cur.val:
cur = cur.next
if pre.next == cur: # no du... | true |
1a13e6febe0249a75187d5f194ec4163972186d2 | janadr/FYS-STK4155 | /project3/code/class/projectfunctions.py | UTF-8 | 17,907 | 2.765625 | 3 | [] | no_license | import os
import numpy as np
from sklearn.utils import shuffle
from sklearn import linear_model
from sklearn.utils import resample
def generate_design_polynomial(x, degree=1):
"""
Creates a design matrix for a 1d polynomial of degree p
1 + x + x**2 + ...
"""
X = np.zeros((len(x), degree+1))
... | true |
24b0ba933a5a5a733c16e49afcfd2139e02cf298 | kjczarne/spocktest | /spocktest/extract.py | UTF-8 | 3,916 | 2.78125 | 3 | [
"MIT"
] | permissive | import inspect
import textwrap
import re
import os
from spocktest.model import Snippet, SnippetLinesCollection, SnippetsCollection
from spocktest.state import STATE
from spocktest.tools import load_file
from spocktest.defaults import ALLOWED_CODE_EXTS, ID_TEMPLATE_REGEX
from typing import List, Tuple
from collections i... | true |
76ce80bc20ba5da3d23dd7c8df0b5d28bef7acd1 | 10spen11/Evolutionary-Gaussians | /main.py | UTF-8 | 14,456 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive |
from cma import purecma as pcma
import gmmCma as gcma
import time
import numpy as np
import vectormath as vmath
import math
import tkinter
# Make sure to have the server side running in CoppeliaSim:
# in a child script of a CoppeliaSim scene, add following command
# to be executed just once, at simula... | true |
faa1c5897f208baef4adfcca4b2cd804ad8dd83a | syzhang092218-source/panda-grasp | /panda_grasp/utils/buffer.py | UTF-8 | 2,895 | 2.71875 | 3 | [
"MIT"
] | permissive | import torch
import os
import numpy as np
class SerializedBuffer:
def __init__(self, path, device):
tmp = torch.load(path)
self.buffer_size = self._n = tmp['state'].size(0)
self.device = device
self.states = tmp['state'].clone().to(self.device)
self.actions = tmp['action'... | true |
b32fb9c90f383d915db5f301055c56cf1a4ff294 | JingkaiTang/github-play | /man_and_case/leave_man.py | UTF-8 | 251 | 3.078125 | 3 | [] | no_license |
#! /usr/bin/env python
def have_thing_after_part(str_arg):
number_or_company(str_arg)
print('give_important_way_by_right_part')
def number_or_company(str_arg):
print(str_arg)
if __name__ == '__main__':
have_thing_after_part('eye')
| true |
323a3c44a7170b04d0e4b04f0d319381e7f1819e | CianLR/pyRSA | /RSA.py | UTF-8 | 2,781 | 3.203125 | 3 | [
"MIT"
] | permissive | from random import SystemRandom
class RSA:
def __init__(self, bits, RMiterations=64):
self.random = SystemRandom()
self.RMi = RMiterations
self.bits = bits
p, q = self.gen_primes()
self.n = p*q
totient = (p-1) * (q-1)
self.public_key = 65537
... | true |
a9f83136129cec895525c5399eae7c9a8e5eb1b9 | roystchiang/terrarium | /terrarium/geomap/models.py | UTF-8 | 1,792 | 2.796875 | 3 | [] | no_license | from django.db import models
from django.contrib.gis.db import models as geo_models
class Place(models.Model):
"""A summarization of each place in OSM
A summary of details excluding boundary polygons for a specific place given
by nomination.openstreeetmap.org
"""
display_name = models.CharField(ma... | true |
fb0e24f79cc9992ea87a4716419c3aa3b5f0ffc2 | niart/Heuristic-algorithm-for-decising-making-in-Wumpus-world-game | /world.py | UTF-8 | 8,629 | 3.328125 | 3 | [
"MIT"
] | permissive | # world.py
#
# A file that represents the Wumpus World, keeping track of the
# position of all the objects: pits, Wumpus, gold, and the agent, and
# moving them when necessary.
#
# Written by: Simon Parsons
# Last Modified: 25/08/20
import random
import config
import utils
from utils import Pose
from utils import Dire... | true |
e02c77677bfa9257a96c45f02a5b56a7fd5ac5b3 | tungvx/deploy | /Django-0.90/django/views/decorators/http.py | UTF-8 | 1,321 | 2.8125 | 3 | [
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | """
Decorators for views based on HTTP headers.
"""
from django.utils.decorators import decorator_from_middleware
from django.middleware.http import ConditionalGetMiddleware
from django.utils.httpwrappers import HttpResponseForbidden
conditional_page = decorator_from_middleware(ConditionalGetMiddleware)
def require_... | true |
5395df6f18cdac438e89d1957a17775afe5dd53b | rramachandra93/parking_detection | /imageprocessing.py | UTF-8 | 1,697 | 2.875 | 3 | [] | no_license | import cv2
from imutils import perspective
import numpy as np
import glob
class ImageProcess():
def __init__(self):
pass
def extract_features(self, img_resize):
global_lists = []
for image in img_resize:
hist = cv2.calcHist([image], [0], None, [256], [0, 256])
... | true |
fc62e642c21c17238dfbc59de3f61614c273a78b | xuyuchends1/python | /Python Data Science Handbook/chapter4/4.py | UTF-8 | 314 | 2.875 | 3 | [] | no_license | import matplotlib.pyplot as plt #导入图像库
import numpy as np
plt.rcParams['font.sans-serif'] = ['SimHei'] #用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False #用来正常显示负号
fig=plt.figure()
ax=plt.axes()
x=np.linspace(0,10,1000)
ax.plot(x,np.sin(x),fmt='--g')
fig.show()
| true |
5119edb3a93005b26ea6443a24a39626f3c8c22c | AndrewTMoore/Philippines-Consecutive-Disasters-and-Migration | /Intermunicipal Migration Extraction.py | UTF-8 | 2,916 | 3.359375 | 3 | [] | no_license | ###This code imports data for the 2010 Census of Population and Housing of the Philippines
###Each line of the imported file is a 60-digit number, with the meaning of each digit given in Census Results Metadata.docx
###A province from the census is selected and responses are recorded for respondents that had changed ... | true |
11d58bb4787b3ad4ebea22774db912580e57d088 | kNagadou/MuscleRecognition | /detect.py | UTF-8 | 4,785 | 2.9375 | 3 | [] | no_license | import cv2
import os
import sys
import CONST as C
import selectivesearch as ss
def detectObjectFromImage(image_path, cascade_file):
rect_image_paths = []
image = cv2.imread(image_path)
if image is None:
print("can not read {}".format(image_path))
elif C.PREFIX_EXTRACTED in image_path:
... | true |
ab9f4f257a63524041a1e5028def4eba0ed06e15 | daniel-hampton/computer_vision_scratch | /thresholding01.py | UTF-8 | 1,074 | 3.609375 | 4 | [] | no_license | """
Image Thresholding
Goal
In this tutorial, you will learn Simple thresholding, Adaptive thresholding, Otsu’s thresholding etc.
You will learn these functions : cv2.threshold, cv2.adaptiveThreshold etc.
"""
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread('gradient_square.png', 0)... | true |
d05db024e09ac306220dbb534c12fde2ed56b68c | daniel-reich/ubiquitous-fiesta | /9ED9zbHHhaPaBz2xi_23.py | UTF-8 | 99 | 2.6875 | 3 | [] | no_license |
def normal_sequence(n):
lst = [0, 1, 1, 2, 0, 2, 2, 1]
return lst[n % 8 - 1] if n % 8 else 1
| true |
2429e9f7502da2305ec4f2a33695b874b9d29c55 | freefish3050/qpush | /qpush/comet/websocket_connector.py | UTF-8 | 2,530 | 2.53125 | 3 | [
"MIT"
] | permissive |
import logging
import json
import threading
#import request_manager
import websocket_pool
class WebSocketConnector:
host = None
port = None
on_request_callback = None # callback(ok, data)
pool = None
#reqManager = None
def __init__(self, on_request_callback = None):
self.on... | true |
0b736a1b3ce5a850e761b9eff0d0316492b83d2f | mcmk21348/task06.04.2020 | /Task_3.py | UTF-8 | 600 | 4.03125 | 4 | [] | no_license | """
@Makers
Write a function is_odd that takes
in a number and returns True if it is odd, otherwise false.
BONUS CHALLENGE:
Write the function solution in 1 line of code without using if statements.
"""
def is_odd(number):
return number % 2
#DO NOT remove lines below here, this is designed to test your c... | true |
8742618e388eb91b33a063ac26882d9cec1ff2a9 | KaiMiyajima/nullpo | /discordbot.py | UTF-8 | 1,062 | 2.5625 | 3 | [
"MIT"
] | permissive | # coding:UTF-8
import discord
import os
import traceback
from discord.ext import tasks
from datetime import datetime, timedelta, timezone
# ↓はトークンの自動取得をしようとしてできなかった残骸
token = os.environ['DISCORD_BOT_TOKEN']
client = discord.Client()
@client.event
async def on_message(message):
# ユーザが"/date"と入力するのを検知
if me... | true |
b07d4df9c600c604ccf32a012a50742cfdddbaba | AlexWendel/metodos-numericos | /gauss-seidel.py | UTF-8 | 1,187 | 3.65625 | 4 | [] | no_license |
# Dados
A = input("Digite a matriz: Ex:[[1,2,3],[4,5,6]]\n")
A = eval(A)
VetSol = input("Digite o vetor solução inicial: Ex:[1,2,3]\n")
VetSol = eval(VetSol)
ErroMin = input("Digite o erro minímo: Ex: pow(10,-1) ou 0.00001\n")
ErroMin = eval(ErroMin)
linhas = len(A)
colunas = len(A[0])
rounding = 6
erro = 100000000
it... | true |
32ec5b44fc69ba721c021ed95c470fd4a52dd752 | cwelbeck/ReinforcementLearning | /tester.py | UTF-8 | 7,380 | 2.984375 | 3 | [] | no_license |
#---- TESTING CODE for simple 4x4 Gridworld with goal states in upper/left and lower/right corner ----
next_state = {}
next_state[(0, "l")] = 0
next_state[(0, "u")] = 0
next_state[(0, "r")] = 0
next_state[(0, "d")] = 0
next_state[(1, "l")] = 0
next_state[(1, "u")] = 1
next_state[(1, "r")] = 2
next_state[(1, "d")] = 5... | true |
35f752f2790f4652b5f6f01b50a2a01ce274eaa8 | ArKane-6418/Pong-Game | /Pong-Updated.py | UTF-8 | 6,927 | 3.046875 | 3 | [] | no_license | import pygame
import sys
import random
# Working with sprites
class Block(pygame.sprite.Sprite):
def __init__(self, path, pos_x, pos_y):
super().__init__()
self.image = pygame.image.load(path)
self.rect = self.image.get_rect(center=(pos_x, pos_y))
# Three classes will in... | true |
529834c34d7fb152ccefff36fb246a283640a019 | efazati/facar | /detection.py | UTF-8 | 1,533 | 2.8125 | 3 | [] | no_license | import os
import face_recognition
images_path = '/home/user/projects/facar/image_set/'
known_images_path = images_path + 'known/'
unknown_images_path = images_path + 'unknown/'
def encode_face(im):
print (im)
loaded_image = face_recognition.load_image_file(im)
face_encoding = face_recognition.face_encoding... | true |