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 |
|---|---|---|---|---|---|---|---|---|---|---|
cb6ae7f4da8f69f2792b97b7a9139daab2d970c9 | mindovermiles262/codecademy-python | /10 Introduction to Bitwise Operators/04_the_bin_function.py | UTF-8 | 395 | 3.796875 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 7 18:28:28 2017
@author: mindovermiles262
Codecademy Python
We've provided an example of the bin function in the editor. Go ahead and use
print and bin() to print out the binary representations of the numbers 2
through 5, each on its own line.
... | true |
fe23a1d1c2e9769197f8a5d0a58e55f88a759a25 | BinHan-Code/pyneta | /test2.py | UTF-8 | 91 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | print ("This is Han")
print ("This is Bin")
for x in range(10):
print (x)
print (x)
| true |
1c924ad5db2f90e575afcd98f0af686a4134837b | r3ap3rpy/ECTestRepo | /Chapter07/arbitrary_number_deco.py | UTF-8 | 413 | 3.25 | 3 | [] | no_license | def arbitrary(function):
#helloWorld(a,b,k=10,j=20)
def wrapper(*args, **kwargs):
print(f"Positional arguments: {','.join(args)}")
print(f"Keyword arguments: {kwargs}")
function(*args, **kwargs)
return wrapper
@arbitrary
def demodeco(*args, **kwargs):
print(f"Positional argument... | true |
36d103e0be62f03f341ac75d550cea66cc5060d9 | monkut/lorisattack | /lorisattack/staticsites/functions.py | UTF-8 | 1,052 | 2.890625 | 3 | [] | no_license | from typing import List
from pathlib import Path
from .models import StaticSite
def instantiate_staticsite(staticsite: StaticSite, directory: Path) -> List[dict]:
"""Generate staticsites to the target directory"""
instantiated_pages = []
for page in staticsite.pages():
instantiated_assets = [(abs... | true |
b9b9b3506a101b539b80758fad7610cabdc93d77 | Obaitan/hangman-game | /hangman.py | UTF-8 | 2,491 | 3.6875 | 4 | [] | no_license | #! python3
# hangman.py - A text-based adaptation of the hangman game.
import random
wordPool = [
'chemistry', 'aardvark', 'muse', 'water', 'love',
'perfect', 'substrate', 'content', 'banner', 'template',
'forlorn', 'solution', 'choice', 'compass', 'construct',
'abstract', 'compact', 'prejudi... | true |
079874ce8f9f3caccb857670d75969f6e3094075 | valohai/ml-docker | /tf-imageops/test.py | UTF-8 | 1,045 | 2.875 | 3 | [] | no_license | import tensorflow
import PIL
from PIL import Image, ImageFilter
import cv2
import sklearn
import skimage
import numpy
# Print library versions
for library in ("tensorflow", "PIL", "cv2", "sklearn", "skimage", "numpy"):
print(library, locals()[library].__version__)
# Test skimage
chelsea_array = skimage.data.che... | true |
78ff96121acfbbbfaffab3e52efc4d2b465dfadb | fmanana/JUB_Programming-in-Python | /Assignment_3/Problem_3.9_Printing_a_Triangle.py | UTF-8 | 293 | 3.53125 | 4 | [] | no_license | # JTSK-350111
# a3 p9.py
# Fezile Manana
# f.manana@jacobs-university.de
def print_rectangle(n, m, c):
for i in range(m):
for j in range(n):
print(c, end = "")
print("")
print("Enter two integers then a chracter:")
n = int(input())
m = int(input())
c = input()
print_rectangle(n, m, c... | true |
64c111274f44c47819f615442b88d72421c2e2dc | IBM-Security/ibmsecurity | /ibmsecurity/isvg/firmware.py | UTF-8 | 2,943 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import logging
import ibmsecurity.utilities.tools
logger = logging.getLogger(__name__)
def get(isvgAppliance, check_mode=False, force=False):
"""
Retrieve existing firmware.
"""
return isvgAppliance.invoke_get("Retrieving firmware",
"/firmware_settings")
def back... | true |
fe81a7e597a79b8bae78ac121b8580ee647eb6d3 | terrytwk/isAI | /backend/app.py | UTF-8 | 686 | 2.5625 | 3 | [] | no_license | from flask import Flask, Response, request
from image_validation import validateImage
from text_validation import validateText
app = Flask(__name__)
@app.route('/')
def getRoot():
return Response('GET /', mimetype='text/plain')
@app.route('/validate/image', methods=['POST'])
def postImage():
prob = validate... | true |
7fb5be79a5feb867446efa637aa374e45a3582bb | Veda-Ashok/charitable | /organizationsParser.py | UTF-8 | 1,196 | 2.859375 | 3 | [] | no_license | import xml.etree.ElementTree as DataTree
tree = DataTree.parse('organizations.xml')
root = tree.getroot()
print(root)
def getAttributeText(n, s):
checkattribute= n.find(s)
attributetext = 'Not Specified.' if checkattribute is None else checkattribute.text
return attributetext
def getAllElemen... | true |
c1fc7b2552edc5e60652ef5515e5a04184aa17f0 | patatetom/dupdnp | /dupdnp.py | UTF-8 | 3,933 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python3
# find /path/to/search/ -type f -not -empty -printf '%p\t%s\n' | ./dupdnp.py
from optparse import OptionParser
parser = OptionParser(usage='%prog [--all] [--md5|--sha1] [--h4k]')
parser.add_option('-a', '--all', help='print all files', action='store_true')
parser.add_option('-4', '--h4k', help='us... | true |
8e1fc9440d105bbf3ec054e585383cc961560e13 | zhaipro/misc | /cvutils.py | UTF-8 | 1,229 | 2.6875 | 3 | [
"MIT"
] | permissive | import os
import cv2
import numpy as np
from mutagen.mp3 import MP3
from mutagen.wave import WAVE
from PIL import Image, ImageDraw, ImageFont
def put_text(img, text, xy, fill=(255, 255, 255), size=20, font='SourceHanSansCN-Bold.otf'):
img = Image.fromarray(img)
draw = ImageDraw.Draw(img)
font = ImageFont... | true |
076175efd01593626a4b0b403ce255c2a86bc398 | mericaliyigit/superchat-backend-challenge | /an_app/superchat_apps/superchat_service.py | UTF-8 | 1,192 | 2.546875 | 3 | [] | no_license | import requests
class SuperchatPlugin:
bitcoin_url = 'https://api.coindesk.com/v1/bpi/currentprice.json'
cached_last_price = '0'
def get_current_price(self):
try:
response=requests.get(self.bitcoin_url)
data = response.json()
self.cached_last_price = data['bpi... | true |
4b5c19bcf67a1c73e429b5dff8ed259d7c193410 | freesan44/LeetCode | /LeetCode_1614.py | UTF-8 | 469 | 3.40625 | 3 | [] | no_license | class Solution:
def maxDepth(self, s: str) -> int:
# 栈的形式来记录
maxRet = 0
tempCount = 0
for i in s:
if i == "(":
tempCount += 1
elif i == ")":
if maxRet < tempCount:
maxRet = tempCount
tempCount... | true |
873ee1851461fc9c00bac2b1a06b3881cf425bfe | chemcoder-2020/LydingSTM-python-lib | /autocrop.py | UTF-8 | 3,208 | 2.796875 | 3 | [] | no_license | from imageio import imread, imsave
from skimage.measure import moments
from skimage.filters import threshold_otsu, gaussian
from skimage.color import rgb2gray
from skimage.morphology import remove_small_objects
import numpy as np
import matplotlib.pyplot as plt
import argparse
def _parseargs():
parser = argparse.... | true |
415ada04d674b40d2a4d8a2ab3f73102566708d0 | Marilyna/promua-test | /catalog/models.py | UTF-8 | 1,018 | 2.65625 | 3 | [] | no_license | from catalog import db
authorship = db.Table(
'authorship', db.Model.metadata,
db.Column('author_id', db.Integer, db.ForeignKey('authors.id')),
db.Column('book_id', db.Integer, db.ForeignKey('books.id')),
)
class Book(db.Model):
__tablename__ = 'books'
id = db.Column(db.Integer, primary_key=True... | true |
bc14cdb1d4e7b857c7a79e173f77f37398266bba | pedMatias/matias_hfo | /agents/plastic_dqn_v1/agent/replay_buffer.py | UTF-8 | 5,148 | 2.84375 | 3 | [
"MIT"
] | permissive | import numpy as np
import random
import os
from collections import deque
from typing import List
from copy import copy
import pickle
import tensorflow as tf
from agents.plastic_dqn_v1 import config
from agents.base.agent import Agent
from agents.plastic_dqn_v1.aux import print_transiction, mkdir
REPLAY_MEMORY_SIZE =... | true |
89f10dca19b4f63e53365c7de90161b9739816f2 | dhaminda-a/topologies_metrics_dynamic-offdiagonal-rewards | /6/50.py | UTF-8 | 71,744 | 2.78125 | 3 | [] | no_license | ##Ten local communities with an agent population of 50, 100 and 200 were created separately using the topology random_regular_graph (degree = 3).
##A global community was created by union_all of the generated ten local community graphs.
##Conformity is calculated to each local community first and then averaged to the m... | true |
4e9012ee3219898b9d8d1d11e42d20605872392e | LoneCannibal/codeforces | /combination.py | UTF-8 | 420 | 3.484375 | 3 | [] | no_license | # https://codeforces.com/problemset/problem/540/A
n=int(input())
firstline,secondline=input(),input()
current_combination=[int(i) for i in firstline]
correct_combination=[int(i) for i in secondline]
total_turns=0
for i in range(n):
turns=abs(current_combination[i]-correct_combination[i])
if(turns>=5):
t... | true |
e095b4e0516fc1d430f67864590c4c0f513c9db0 | richard-ql/pythonNotes | /pythonPractice/pickle/pickle_ex02.py | UTF-8 | 508 | 3.734375 | 4 | [] | no_license | # Pickle可以持久化Python的自定义数据类型,但是在反持久化的时候,必须能够读取到类的定义。
import pickle
class Person:
def __init__(self, n, a):
self.name = n
self.age = a
def show(self):
print(self.name + "_" + str(self.age))
aa = Person("张三", 20)
# aa.show()
f = open('ex02.pkl', 'wb')
pickle.dump(aa, f)
f.close()
# de... | true |
9c76e88549554fd6377e482cb3de15a90a37943a | parkkhee/studyAlgorithm | /BOJ/1110/1110.py | UTF-8 | 596 | 3.359375 | 3 | [] | no_license | x= int(input())
i=1
if(x>0 and x<99) or (x==0 or x==99):
if(x>9):
fir=x%10
sec=x//10
res=int(str(fir)+str((fir+sec)%10))
if(res!=x):
while(res!=x):
i+=1
fir2=res%10
sec2=res//10
res=int(str(fir2)+... | true |
e1a28c02fc1668e32c93e32aa50d2b5fe8122104 | tammasloughran/analysis | /eofs/tools/pcaplot.py | UTF-8 | 18,923 | 2.703125 | 3 | [] | no_license | """Plot EOFs, PCs and eigenvalue scree plots.
These functions are intended to plot EOFs, PCs and eigenvalues caluclated
from the eofs python package.
"""
import matplotlib.pyplot as plt
def eofscatter(eofs):
"""Creates an interractive 3D plot of the first 3 EOFs in state space.
Arguments:
eofs -- th... | true |
455184e7baa1edcead5aac007261bd80913d8bfe | wenyuwang/ComputerNetwork | /webserver.py | UTF-8 | 1,378 | 2.953125 | 3 | [] | no_license | # Import socket module
from socket import *
serverSocket = socket(AF_INET, SOCK_STREAM)
# Prepare a server socket, use port 6789
# Fill in start
serverSocket.bind(('',6789))
serverSocket.listen(1)
# Fill in end
while True:
# Establish the connection
print 'Ready to serve...'
connectionSocket, add... | true |
005f69a92df243b7944e73342e9d31df959e18ba | rohit19081995/machine_learning | /tfbasics.py | UTF-8 | 2,130 | 2.75 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('/tmp/data', one_hot=True)
nnodes_hl1 = 500
nnodes_hl2 = 500
nnodes_hl3 = 500
n_classes = 10
batch_size = 100
x = tf.placeholder('float', shape=[None, 784])
y = tf.placeholder('float')
def neural_n... | true |
30b09a12e7c6ebfbe4640f728670b63311bfc037 | johnmwalters/Project_Luther | /actor_movie_table.py | UTF-8 | 1,163 | 2.796875 | 3 | [] | no_license | '''
actor_movie_table
The following function generates a list of lists consisting of the first table found on a particular
actor's boxofficemojo page
The movie_attribute protion of the code loops through the html table, capturing everything until the
table list generated by beautifulsoup ends
all_movies is the list o... | true |
f5669d6a81968b9e23fcb2e039d4fd25b92a4352 | yohanshin/JointAnglePrediction_JOB | /_2_optimization/utils/optimization_utils_batch.py | UTF-8 | 6,630 | 2.609375 | 3 | [] | no_license | # -------------------------
#
# Functions for use in hyperopt orientation optimization including
# establishing search space and comparing new IMU data
#
# --------------------------
import numpy as np
import scipy.optimize as so
from scipy.spatial.transform import Rotation as R
import quaternion as Q
from tqdm impor... | true |
5f04d6bf865f42e1b2f175831045746e405bfdad | 77even/master_thesis | /helper.py | UTF-8 | 4,091 | 3.03125 | 3 | [] | no_license | from keras import backend
import matplotlib.pyplot as plt
import numpy as np
from custom_layers import WeightedArithmeticMean
def update_fadein(models, step, n_steps):
"""
This function sets the alpha for each model
Parameters:
models: the two models that need to be combined using weighted arithmetic mean, i.e. t... | true |
f407001c287c91e1f03df28ff1ad56b665b60b01 | ArturMroz/Project-Euler | /ProjectEuler/Problems 51 - 100/P099.py | UTF-8 | 623 | 3.6875 | 4 | [] | no_license | # Using base_exp.txt, a 22K text file containing one thousand lines
# with a base/exponent pair on each line, determine which line number has
# the greatest numerical value.
from math import log
maxnum = maxi = 0
i = 1
# solution: we can determine if a**b > c**d
# by checking instead if log(a**b) > log(c**d)
# whic... | true |
d77e9d15ace2897c732616a99e4cb7a36bda9766 | Aasthaengg/IBMdataset | /Python_codes/p03775/s430828085.py | UTF-8 | 162 | 2.953125 | 3 | [] | no_license | N = int(input())
M = 1
for i in range(1, int(N ** (1/2)) + 1):
if N % i == 0:
if M < i:
M = i
M = N // M
ndm = len(list(str(M)))
print(ndm) | true |
4af587763d9c80c3c7022508a49d31ebdf30b18e | GaviriaAmaya/holbertonschool-web_back_end | /0x07-Session_authentication/api/v1/auth/session_db_auth.py | UTF-8 | 2,150 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
''' Define SessionDBAuth class. '''
from api.v1.auth.session_exp_auth import SessionExpAuth
from models.user_session import UserSession
from datetime import datetime, timedelta
class SessionDBAuth(SessionExpAuth):
''' Extend behavior of SessionExpAuth for database session storage. '''
... | true |
b6434bd47d53e2243d3dc3d747db0b471fb12fd8 | alaanlimaa/jobs_challenges | /Topaz/usuario.py | UTF-8 | 612 | 3 | 3 | [
"MIT"
] | permissive | from excecoes import LimiteTtaskOrUmax, MenorQueZeroTtask
class Usuario:
ttask = 0
def __init__(self, ):
self.ttask = Usuario.ttask
@staticmethod
def verifica_limite_ttask():
if Usuario.ttask < 1 or Usuario.ttask > 10:
raise LimiteTtaskOrUmax('TTASK tem que ser maior ou i... | true |
3c0b2eb389709dc939abb8edae6f26c2c339b328 | ztyoung86/tyc-crawler-py | /utils.py | UTF-8 | 4,270 | 2.5625 | 3 | [] | no_license | import hashlib
import json
import os
from io import BytesIO
import aiohttp
from PIL import Image, ImageDraw, ImageFont
from bs4 import BeautifulSoup
from fontTools.ttLib import TTFont
URL_TEMPLATE = 'https://static.tianyancha.com/fonts-styles/fonts/%s/%s/tyc-num.woff'
IMAGE_DIR = 'images/'
if not os.path.exists(IMAG... | true |
7ffd5f1d9847cc25d7088f41bf34849f855c294c | Will-Bo/plex-renamer | /plex-renamer.py | UTF-8 | 1,901 | 3.609375 | 4 | [] | no_license | import os
def renameEpisodes(show):
for tup in show.episodeTuple():
print(tup)
##This can be messed up if the filename contains periods.
os.rename(os.getcwd()+"/"+tup[0],os.getcwd()+"/"+tup[1]+"."+tup[0].split(".")[1])
class OGTV:
def __init__(self, filelist):
self.filelis... | true |
d4a6af32bbea40c7fd882a7e967e9829e927b1ab | Dituohgasirre/python | /python-1025/python/5_class/5_extend.py | UTF-8 | 922 | 3.671875 | 4 | [] | no_license | #!/usr/bin/env python3
# class Student(object):
# class Student():
class Student:
def __init__(self, name="未知", age=15, sex="未知", **kwargs):
self.name = name
self.age = age
self.sex = sex
self.__dict__.update(kwargs)
def say(self):
return "姓名: %s, 性别: %s, 年龄: %s" % (s... | true |
5c89c4ee1a9200181dc5168e763db0bf75eca724 | ProAdmin007/ProjectEmbeddedSystems | /example_code/hc_sr04/OCR_calc.py | UTF-8 | 263 | 2.984375 | 3 | [] | no_license | def calc_OCR1A():
Fcpu = 16000000
prescaler = int(input("Prescaler value= "))
desired_freq = int(input("How many pulses a second? "))
return (Fcpu // prescaler) // desired_freq
OCR1A = calc_OCR1A()
print("OCR1A needs to be {} = {}".format(OCR1A, hex(OCR1A))) | true |
10d1145cc06d7213e50f70feea379dff8aa968c7 | sashaneo/tkinter | /1.py | UTF-8 | 1,438 | 3.640625 | 4 | [] | no_license | import builtins
import tkinter as tk
def calculate_discount_percentage(total):
discount = 0
if total >= 100:
discount = 20
elif total > 0 and total < 100:
discount = 10
return discount
def calculate_discount(total):
discount_percentage = calculate_discount_percentage(total)
di... | true |
c91fa793eaaf0fd3f563d34be77f1ff4359be204 | RuoAndo/nii-cyber-security-admin | /detection/CD1/std.py | UTF-8 | 897 | 2.59375 | 3 | [] | no_license | import numpy as np
import sys
argvs = sys.argv
argc = len(argvs)
f = open(argvs[3])
line = f.readline()
instid = []
instname = []
while line:
tmp = line.split("\t")
instid.append(tmp[0])
instname.append(tmp[1])
line = f.readline()
f.close()
f = open(argvs[1])
line = f.readline()
l = np.arr... | true |
46fc8e70ae095bf52a354236b4745d9a6736f7ff | KablamoOSS/PyStacks | /PyStacks/PyStacks/logger.py | UTF-8 | 1,020 | 2.734375 | 3 | [
"MIT"
] | permissive | import logging
class Logger:
log = None
@staticmethod
def create_logger():
logger = logging.getLogger('pystacks')
logger.setLevel(logging.DEBUG)
# create file handler which logs even debug messages
# fh = logging.FileHandler('pystacks.log')
# fh.setLevel(logging.... | true |
4e506605df953deb7faa1ebaf19aa0f7b8b15d91 | hhilalaydgn/Django-polls | /first/polls/models.py | UTF-8 | 1,375 | 2.78125 | 3 | [] | no_license | from django.db import models
import datetime
from django.db import models
from django.utils import timezone
#The name of each Field instance (e.g. question_text or pub_date) is the field’s name, in machine-friendly format.
#You’ll use this value in your Python code, and your database will use it as the column n... | true |
41e580059bcfb98ea16706ad3129af2e29e8a8d8 | nquangtrung/pyevo | /src/app.py | UTF-8 | 3,192 | 3.015625 | 3 | [] | no_license | import sys, pygame
from track import Track
from car import Car
from nn_driver import NNDriver
from model import Model
import time
import numpy as np
red = (255, 0, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
darkBlue = (0, 0, 128)
white = (255, 255, 255)
black = (0, 0, 0)
pink = (255, 200, 200)
pygame.init()
size = w... | true |
9c080578b4014c182d2a84eb18b8b7bf541e7f09 | librar127/PythonDS | /DEInterview/Python/replace_with_previous_char.py | UTF-8 | 301 | 3.40625 | 3 | [] | no_license | def replaceWithPrevious(arr):
for index in range(1, len(arr)):
if arr[index] is None:
arr[index] = arr[index-1]
return arr
arr = [1,None,1,2,None]
arr = [None, 2, None, None, 3]
arr = [1,None,2,3,None,None,5,None]
print(replaceWithPrevious(arr)) | true |
43320dbbdb4c840ab2cd1b19b88c22ca31f0a845 | JiangHuYiXiao/Web-Autotest-Python | /第六章-pytest框架/pytest_装饰器06/test_skipif.py | UTF-8 | 1,096 | 2.671875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# @Author : 江湖一笑
# @Time : 2020/5/6 8:54
# @Software : Web-Autotest-Python
# @Python_verison : 3.7
# 示例1:
from time import sleep
from selenium import webdriver
import pytest,sys
driver = webdriver.Chrome()
python_version = pytest.mark.skipif(sys.version_info>(3,6),reason=... | true |
f1d404c05d495fc309359eb47e164611048de2fc | mehulmshah/spotify-playlist-creator | /testScripts/usingSpotipy.py | UTF-8 | 1,065 | 2.96875 | 3 | [] | no_license | import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
def getMoods():
mood = input('Pick one or more characteristics separated by spaces (danceability, energy, speechiness, valence): ')
mood_list = mood.split(' ')
return ['target_' + mood for mood in mood_list]
def getGenres():
genre = in... | true |
ae55613ac8ee05e11a2767c93b476a0aff3277b7 | bkmz2000/maze | /path.py | UTF-8 | 1,188 | 3.28125 | 3 | [] | no_license | from lab import Maze
from random import choice
from tkinter import Tk, Canvas
class Path:
def __init__(self, maze, f, t):
self.maze = maze
self.f = f
self.t = t
self.path = ''
self.vis = []
self.findFrom(f[0], f[1])
def __str__(self):
return self.pat... | true |
95006eb97f3e57a0e8f63ba26935e73d9446c466 | XtinaSchelin/adventofcode | /2016/day12.py | UTF-8 | 1,134 | 2.953125 | 3 | [
"MIT"
] | permissive | import sys
examples = """cpy 41 a
inc a
inc a
dec a
jnz a 2
dec a"""
def do_day(test=False, day="a"):
if test:
inputs = examples.split("\n")
else:
inputs = open("d12.txt", "r").read().split("\n")
# Populate the register, apparently.
register = {}
for x in inputs:
pieces = x.split(" ")
if len(pieces) == 2... | true |
e235e85ae01bc8fce4fb95b1341848afa9fee851 | czamarth/MPCTest | /test_mortgage_calculator.py | UTF-8 | 3,301 | 2.84375 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
TIMEOUT = 5
FFBINARYPATH = r'C:\Program Files\Mozilla F... | true |
6abae2e24dd86ae82eea9096fd33dff9757c3bff | Panlq/Algorithm | /剑指offer/链表类/反转链表.py | UTF-8 | 886 | 3.875 | 4 | [] | no_license | """
剑指offer: P113
Q:输入一个链表的头结点,反转该链表并输出反转后链表的头结点
思路:
使用三个指针,分别指向当前遍历到的结点、它的前一个结点以及后一个结点。
在遍历的时候,做当前结点的尾结点和前一个结点的替换,当变换到最后一个节点的时候
当前节点指向的就是尾节点,也就是翻转后的头节点
"""
# -*- coding:utf-8 -*-
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# 返回ListNode
def Rever... | true |
b34e1e87d6518c1418bb9369ea7b261320149f8e | KC2004/Cracking_the_Code | /fill.py | UTF-8 | 1,924 | 4.40625 | 4 | [] | no_license | """
Program to simulate paint fill feature.
Changes the old color of a given point and surrounding old color points to new color.
"""
def is_pixel_in_matrix(matrix, point):
if 0 <= point[0] < len(matrix) and 0 <= point[1] < len(matrix[0]):
return True
else:
return False
def surrounding_pixels... | true |
677702d1b0464ca05fc03be1e82e4ddca3a2f670 | unclebenX/PSC | /AimsunModule.py | UTF-8 | 4,658 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 04 14:58:57 2016
@author: Benjamin
"""
import sys, socket, json
from threading import Thread
from PyANGBasic import *
from PyANGKernel import *
from PyANGConsole import *
from PyMesoPlugin import *
class ListeningThread(Thread):
socket = None
aim... | true |
4ff63882d5f58e9d2b9fec3cba5b49827b99a305 | coocos/leetcode | /leetcode/1305_all_elements_in_two_binary_search_trees.py | UTF-8 | 2,392 | 3.828125 | 4 | [
"MIT"
] | permissive | import unittest
from typing import List
from .common import TreeNode
class Solution:
"""
This solution first traverses both binary search trees in order and
returns their values in two ordered lists. Then the two ordered
lists are merged value by value and this final combined list is returned.
N... | true |
36a5ff19995bd595ea1d21b43c48a8e11cc9284d | Aasthaengg/IBMdataset | /Python_codes/p02413/s553359496.py | UTF-8 | 356 | 2.640625 | 3 | [] | no_license | f = open(0)
R, C = map(int, f.readline().split())
ans = [0]*(C+1)
res = []
for line in f.readlines():
*D, = map(int, line.split())
for i, v in enumerate(D):
ans[i] += v
s = sum(D)
ans[-1] += s
res.append(line.strip())
res.append(" %d\n" % s)
res.append(" ".join(map(str, ans)))
res.append... | true |
4c950e11da1424be70c34ce063af44867af7bfe5 | MuhengYan/debatestance | /countTweetSpark.py | UTF-8 | 2,470 | 2.515625 | 3 | [] | no_license | import json
import os
import logging
from pyspark import SparkConf, SparkContext
SPARK_APP_NAME = 'countTweet'
SPARK_MASTER = 'local[200]'
SPARK_EXECUTOR_MEMORY = '5g'
logging.basicConfig(level=logging.INFO)
_log = logging.getLogger('get_topic')
if __name__ == "__main__":
logging.basicConfig(format='%(asctime)s... | true |
184dd94c62d405adac956aaaac7e50d340bf530b | MichaeltheWise/TrieAndOptimalBST | /OptimalBST.py | UTF-8 | 7,083 | 3.5625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat May 15 2021
@author: Michael Lin
"""
import collections
import functools
# Decorator
def store(func):
cache = {}
@functools.wraps(func)
def wrapper(*args):
if args not in cache:
cache[args] = func(*args)
return cache[args]
retur... | true |
8c9ffa7e371e23a309684fffe50534d10d918174 | kjb4494/baekjoon | /python3/06.함수/1065.py | UTF-8 | 397 | 3.609375 | 4 | [] | no_license | def is_hansu(n):
str_n = str(n)
n_len = len(str_n)
if n_len < 3:
return True
difference = set()
for i in range(1, n_len):
difference.add(int(str_n[i]) - int(str_n[i-1]))
return len(difference) == 1
if __name__ == '__main__':
N = int(input())
result = 0
for X in rang... | true |
86224a1cf6f6145ec74daa70a79ff88f8af62eb8 | gabloa/cb_and_cc | /cc/mnist_teacher.py | UTF-8 | 1,776 | 3 | 3 | [] | no_license | # Trains a 'teacher' (cumbersome) model on MNIST
# TensorFlow and tf.keras
import tensorflow as tf
from tensorflow import keras
seed = 0
epochs = 200
model_path = "../tf_models/mnist_teacher_epochs{}".format(epochs)
class hinton(tf.keras.Model):
def __init__(self, temperature=1.0):
super(hinton, self)._... | true |
ac2d83d1abefc33167e058b084a000ee184167c8 | DLuCJ/miscellaneous | /pals/xorgalor.py | UTF-8 | 3,121 | 3.15625 | 3 | [] | no_license | digits = [i for i in range(256)]
matchlist = [' ', 'e', 't', 'a', 'o', 'i', 'n', 's', 'h', 'r', 'd', 'l', 'u',
'E', 'T', 'A', 'O', 'I', 'N', 'S', 'H', 'R', 'D', 'L', 'U']
def fixed_xor(b1, b2):
return bytes([a ^ b for (a, b) in zip(b1, b2)])
def get_sbxor_cipher(b):
max_xor = 0
max_val = 0... | true |
e47cfdff936fb632c5e0f23202c3df9ebf00d506 | AlanTellezS/pucpuc-bot | /common_embed.py | UTF-8 | 1,241 | 2.6875 | 3 | [] | no_license | import discord
error_thumbnail = ""
def generic_embed(title, description, image, thumbnail):
embed = discord.Embed(
title = title,
description = description,
colour = discord.Colour.dark_blue()
)
embed.set_image(url = image)
embed.set_thumbnail(url = thumbnail)
return embed... | true |
00a3f1f88f5f0668325a889a020d0b90aa48190b | frozen007/algo-study | /Challenge/lcof/lcof-12.py | UTF-8 | 1,001 | 3.53125 | 4 | [] | no_license | """
剑指 Offer(第 2 版)
https://leetcode-cn.com/problemset/lcof/
剑指 Offer 12. 矩阵中的路径
https://leetcode-cn.com/problems/ju-zhen-zhong-de-lu-jing-lcof/
"""
class Solution(object):
def exist(self, board, word):
"""
:type board: List[List[str]]
:type word: str
:rtype: bool
"""
... | true |
f1b1a20d9b56b3d9ee9dbb2dc136e3b71f1b1aed | evbeda/games4 | /love_letter/player.py | UTF-8 | 1,988 | 3.46875 | 3 | [] | no_license | from .cards.countess import Countess
from .cards.king import King
from .cards.prince import Prince
class Player(object):
def __init__(self, game=None):
self.name = None
self.hearts = 0
self.score = 0
self.cards = []
self.is_active = True
self.discarded = []
... | true |
53121b905634b6f296ff7ba9477c73768b8ea2fd | KM3NeT/km3pipe | /src/km3pipe/utils/tres.py | UTF-8 | 2,825 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# Filename: tres.py
"""
A tool to calculate and extract Cherenkov hit time residuals from reconstruced
events in offline ROOT files (currently only the JMuon chain).
Usage:
tres [options] FILENAME
tres (-h | --help)
tres --version
Options:
-o OUTFILE Output file.
--... | true |
a7fd4b088cb10e5f30d6866851c0ced6af9ae866 | ibrahim85/dac_network_research | /data_generation_helper/generate_corpus.py | UTF-8 | 662 | 2.59375 | 3 | [] | no_license | import os
import csv
dirname = '../dac-network/paper_abstract_years/'
years = range(2002,2016)
filename = 'paper_abstract_years_{}.csv'
tc=0
ac=0
with open('corpus.txt','w') as outfile, open('titlelist.txt','w') as listfile:
for year in years:
infile = open(os.path.join(dirname, filename.format(year)), 'rb')
... | true |
bb6a4a7edf6094fdd8ada32e57995a283c56d400 | akcauser/Python | /PythonListMethods/append().py | UTF-8 | 978 | 4.25 | 4 | [
"MIT"
] | permissive |
#Created by Ertuğrul Gazi AKÇA at 15.01.2019
#TR/EN
#Listeye bir eleman eklemek için kullanılır
#This method use add an item to list or tuple
#Boş bir liste tanımlayalım
#list define
liste = []
#Eklediğimiz eleman listenin en sonuna eklenir
#The item that we added, adding as last item of list
liste.append("ders1"... | true |
100317c66cc93b6b7b10bdb41c5e298b0dac5493 | JayCompiler/SeqP | /seqPython/Exp2tracheal.py | UTF-8 | 5,687 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 24 14:06:56 2018
@author: Yzi
"""
import ReadData
import Sequence
import Similarity
import time
import markov
## 尝试多个规范化数据整合方式
## 返回列表的第2个 元素,即相似度 全部markov 概率模型
def getSim(Lis):
return Lis[1]
if __name__=="__main__":
rd=ReadData.ReadData()
#top 参数 36
... | true |
bae8f7cafa10b4f6efafa9f01f4315a725cdb38e | arsenaultk9/PythonAi | /Numpy neural network/backward.py | UTF-8 | 2,253 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 11 13:18:32 2019
@author: KEARS4
"""
import numpy as np
import activation_functions as af
#Backward propagation
def single_layer_backward_propagation(dA_curr, W_curr, b_curr, Z_curr, A_prev, activation="relu"):
# number of examples
m = A_prev.shape[1]
#... | true |
a4a691d391d0d6948edd601c72d398d2b4f1d5ff | Ayan9074/WhistAndRockPaperScissors | /help.py | UTF-8 | 2,544 | 3.28125 | 3 | [] | no_license | import tkinter as tk
import os
def back():
root.destroy()
dir_path = os.path.dirname(os.path.realpath(__file__))
file_path = os.path.join(dir_path,'runfile.py')
os.system(f'py {file_path}')
def maingame():
root.destroy()
dir_path = os.path.dirname(os.path.realpath(__file__))
file_path = o... | true |
7f23088abb2528886260817dbce6ec3a3297943c | Raymond0620/Interview | /算法笔试/途宿/test.py | UTF-8 | 448 | 3.46875 | 3 | [] | no_license | '''
@Descripttion: ASCII排序
@Author: daxiong
@Date: 2019-09-06 21:20:36
@LastEditors: daxiong
@LastEditTime: 2019-09-06 21:25:55
'''
s = input().strip()
visited = [False for _ in range(len(s))]
strC = list()
for i in range(len(s)):
if s[i].isalpha():
strC.append(s[i])
visited[i] = True
s = list(s)
... | true |
67ae1f949494086c9e8e5bcf3824b8853de4f833 | patientplatypus/pythonServer | /python/barebone-serverless-flask-api-zeit-now/routes/routes.py | UTF-8 | 3,689 | 2.5625 | 3 | [] | no_license |
from flask import send_from_directory, request
from index import app
from werkzeug.utils import secure_filename
import os
import sqlite3
ALLOWED_EXTENSIONS = set(['sqlite', 'jpg', 'txt'])
# default to catch any route not already predefined
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def catch... | true |
160235f205ac7148ea53a6353bfb7cd0dbaf740e | madeibao/PythonAlgorithm | /PartB/py树的子结构值.py | UTF-8 | 1,932 | 3.703125 | 4 | [] | no_license | '''
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
public boolean isSubStructure(TreeNode A, TreeNode B) {
// 如果A或B都走完了还没找到,那应该就是找不到了
if(A == nul... | true |
5517aa03e53de1ce47cd2e9f1b4656777a51dbda | WNoxchi/Kaggle | /planet/dehaze_py/dehaze_test.py | UTF-8 | 600 | 2.890625 | 3 | [] | no_license | # WNixalo | 20181104
####################
import argparse
from time import time
import dehaze
def go(n=10, multi=False):
t = time()
for i in range(n):
dehaze.dehaze('image/foggyHouse.jpg', output=f'{(0,i)[multi]:3d}.jpg')
print(f'Time for {n} dehazes: {time() - t:.3f}')
def main():
parser = a... | true |
2bb10e451b6911c97b7945d64c1d930da50ff48e | raymondmar61/pythonraymondmarbooks | /pythonpicklemodule.py | UTF-8 | 5,914 | 3.703125 | 4 | [] | no_license | import pickle
#Using Pickle to write to and read from a file in Python -Part 3-
grades = {"andy": ["A", "A", "B"], "laura": ["B", "B", "A"], "sam": ["A", "B", "C"]}
print(grades) #print {'andy': ['A', 'A', 'B'], 'laura': ['B', 'B', 'A'], 'sam': ['A', 'B', 'C']}
print(grades["andy"]) #print ['A', 'A', 'B']
print(grades... | true |
5f0d325548d914e1e7eafb8fa0b97e3d0044f1b1 | bhomaidan1990/reinforcement-learning-an-introduction-4 | /Chapter 05/blackjack.py | UTF-8 | 14,439 | 2.953125 | 3 | [] | no_license | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import tqdm
import seaborn as sns
from mpl_toolkits.mplot3d import Axes3D
np.random.seed(69420)
HIT = 1
STAND = 0
class BlackJack:
def __init__(self):
self.base = 12
self.dealer_actions = np.zeros(22, dtype=np.int)
for ... | true |
4f46249cc9e1d7232d570c8c43fd2b68296673ae | yzjbryant/YZJ_MIX_Code | /Deep_Learning_Test/2.py | UTF-8 | 2,735 | 3.328125 | 3 | [] | no_license | #电影评论分类:二分类问题
from keras.datasets import imdb
#加载数据集
(train_data,train_labels),(test_data,test_labels)=imdb.load_data(num_words=10000)
#准备数据,将整数序列编码为二进制矩阵
import numpy as np
def vectorize_sequences(sequences,dimension=10000):
results=np.zeros(len(sequences),dimension) #创建一个形状为(len(sequences),dimensio... | true |
a89b20e123c279c73de963955eb57fbfebb0a17b | Bwendel26/PB_INFNET_Python_redes_SO | /tp5/funcs.py | UTF-8 | 831 | 2.96875 | 3 | [] | no_license | import psutil
def percentual_cpu():
"""
This func uses the psutil lib to get and
return the cpu used percent.
:return: float percentual_usado
"""
percentual_usado = psutil.cpu_percent(interval=0)
return "CPU: " + str(percentual_usado) + "%"
def percentual_memoria():
"""
This funcs... | true |
2f46ba8bd21e800999d0928561023184a5885f2c | sawamotokai/price-alerts | /pricing/common/utils.py | UTF-8 | 488 | 3.03125 | 3 | [] | no_license | import re
from passlib.hash import pbkdf2_sha512
class Utils:
@staticmethod
def email_is_valid(email:str)->bool:
pattern = re.compile(r'^[\w-]+@([\w-]+\.)+[\w-]+$')
return True if pattern.match(email) else False
@staticmethod
def hash_password(password:str)->str:
return pbkdf2... | true |
42b5b1b22394e58ebf74ff751c40997fd761eeeb | py1-10-2017/ryan_yamamoto_py1-10-2017 | /OOP/mathdojo.py | UTF-8 | 728 | 3.5 | 4 | [] | no_license | class MathDojo(object):
def __init__(self):
self.result = 0
def add(self, *args):
for x in args:
if type(x) == list or type(x) == tuple:
for y in x:
self.result += y
else:
self.result += x
return self
def sub... | true |
548fa986408d16fa8b49f0698b1fd34ba2e10af6 | alsilvah/ie-titanic-utils-a | /tests/test_ie_utils.py | UTF-8 | 564 | 3.21875 | 3 | [] | no_license | import pytest
from ie_utils import tokenize
@pytest.mark.parametrize("sentence, expected_tokens",[
("This is a sentence",["This","is","a","sentence"]),
("Another sentence",["Another","sentence"]),
])
def test_tokenize_expected_list(sentence, expected_tokens):
tokens= tokenize(sentence)
assert tokens =... | true |
de64114fbb1ee841638d58bdc41297d19b1670fd | letterve/hello-World | /untitled.py | UTF-8 | 217 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
count = 0
while (count<5):
print "Hello World"
count = count + 1
def main(args):
return 0
if __name__ == '__main__':
import sys
sys.exit(main(sys.argv))
| true |
e02dc124257d448bcfab64ac4f3ab4e00f0e1747 | YueHsien/AiAlgorithm | /python/test.py | UTF-8 | 214 | 2.78125 | 3 | [] | no_license | import random
import itertools
import math
import copy
x1=-0.0009654754229735385
x2=0.001198861676939389
Z=math.pow(x1,2)+(2*math.pow(x2,2))-(0.3*(math.cos(3*math.pi*x1)))-(0.4*math.cos(4*math.pi*x2))+0.7
print(Z) | true |
f61b5f394b34e16988fdc83bdca35b490262ac0d | JayGitH/jgcloudd | /services/jgserverservice.py | UTF-8 | 1,118 | 2.515625 | 3 | [] | no_license | import entity.Entity
class CJGServer:
TableName = 'jguser'
def __init__(self, *args, **kwargs):
self.jgserverEntity = entity.Entity.Entity(CJGServer.TableName)
def add(self,jgname, jghost, jgport):
jgserver = {}
jgserver['jgname'] = jgname
jgserver['jghost'] = jghost
... | true |
470089bd4475683ce30eb3dd9447c892ded9a161 | choiseoungho/ssafy | /Day1/다양한 크롤링 기법/problem1.py | UTF-8 | 756 | 2.984375 | 3 | [] | no_license | from elice_utils import EliceUtils
import urllib.request
from bs4 import BeautifulSoup
elice_utils = EliceUtils()
def main():
print("최신 뉴스 기사 href 수집")
# href 수집할 사이트 주소 입력
url = "https://news.nate.com/recent?mid=n0100"
req = urllib.request.Request(url)
sourcecode = urllib.request.urlop... | true |
913e493cc054d51a1916c361afd9ffee691c113e | kivicode/Navigation | /venv/lib/python3.6/site-packages/cv2_rolling_ball/background_subtractor.py | UTF-8 | 19,406 | 3.28125 | 3 | [] | no_license | import cv2
import numpy as np
"""
Fully Ported to Python from ImageJ's Background Subtractor.
Only works for 8-bit greyscale images currently.
Based on the concept of the rolling ball algorithm described
in Stanley Sternberg's article,
"Biomedical Image Processing", IEEE Computer, January 1983.
Imagine that the 2D gra... | true |
9ffb9c82cadc700006bb2a394089426a6a5a3b8c | ltakuno/arquivos | /python/URI/Basico/uri2006.py | UTF-8 | 145 | 3.078125 | 3 | [] | no_license | # 2006 - Identificando o chá
n = int(input())
v = list(map(int, input().split()))
total = len(list(filter(lambda m : m == n, v)))
print(total)
| true |
ef48aab46b40aa90c12bc7589664c85b9197c150 | leomatheuss/aulapy | /URI_atividades/2702.py | UTF-8 | 186 | 2.90625 | 3 | [] | no_license | lista1 = list(map(int,input().split(' ')))
lista2 = list(map(int,input().split(' ')))
i = 0
for n in range(3):
j = lista2[n] - lista1[n]
if j > 0:
i = i + j
print(i) | true |
98a3db7994b229eca89a466c66186b82ac9bced9 | uhreungdu/my-pc-2dgp | /drills/drill-03/character_moves.py | UTF-8 | 1,033 | 3.34375 | 3 | [] | no_license |
from pico2d import *
import math
open_canvas()
grass = load_image('grass.png')
character = load_image('character.png')
x = 0
y = 90
th = 0
while(True):
while(x < 800):
clear_canvas_now()
grass.draw_now(400,30)
character.draw_now(x,90)
x = x+2
while(y<600):
clear_canv... | true |
5eda25838fcdc0a61b3f9a5028a19c68524d98db | YoruCathy/RL_basic | /layer/SAC_new.py | UTF-8 | 3,118 | 2.859375 | 3 | [] | no_license |
import gym
import torch
import random
import torch.nn as nn
import collections
import numpy as np
import torch.nn.functional as F
import torch.optim as optim
import matplotlib.pyplot as plt
from torch.distributions import Normal
# Value Net
class ValueNet(nn.Module):
def __init__(self, state_dim, edge=3e-3):
... | true |
130073652de9daf286be0695981861844c375656 | hyunwoo-song/TOT | /송현우/03_02.py | UTF-8 | 601 | 3.5 | 4 | [] | no_license | # 파일명 변경 금지
def alphabet_mode(word):
# 아래에 코드를 작성하시오.
# word는 소문자로만 구성 되어있습니다.
# word에서 가장 많이 발생한 알파벳 하나를 반환합니다.
a = word
result = ''
max_count = 0
for i in a:
k = a.count(i)
if max_count < k:
max_count = k
result = i
return result
# 아래의 코드는 수... | true |
3fa49cac219a3da4c5b32c20807b5b3667797623 | werfree/Python | /Catch Me.py | UTF-8 | 581 | 3.390625 | 3 | [] | no_license | from tkinter import *
from random import*
import sys
w=Tk()
w.title("Catch Me")
gameover=False
def jump(event):
b1.place(relx=random(),rely=random())
return
def p(w):
global gameover
if gameover==False:
print("You are FASTER")
gameover=True
sys.exit()
w.destroy()
while True:
... | true |
f9634bb6e9cf72a26cba4c95b973a12bb78bb61c | dbrown-astro/tlemcee | /algorithm/gauss.py | UTF-8 | 7,657 | 3 | 3 | [] | no_license | """
Gauss method of preliminary orbit determination
"""
import numpy as np
from algorithm.utils import (
Constants,
positionVector,
directionCosineVector,
improveOrbit,
orbitalElementsAlgorithm
)
def gaussAlgorithm(arc, mu=Constants.mu, f=Constants.f, r_body=Constants.R_e,
tole... | true |
392a32d0cbee81205b72ade2342247d17b075678 | syizhao/Multi-task-NMTransliteration | /mnmt/trainer/utils.py | UTF-8 | 2,373 | 2.625 | 3 | [
"MIT"
] | permissive | from mnmt.inputter import DataContainer
import numpy as np
import random
import torch
import torch.nn as nn
def set_reproducibility(seed=1234):
"""
Args:
seed: number of seed
"""
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
def build_vocabs(data_con... | true |
2e83ac84ae2407c1c3b869fc7fe7c7a4e614fb8e | homan20/homan20 | /hw7_1/lucky_ticket.py | UTF-8 | 895 | 3.84375 | 4 | [] | no_license | """
Написать функцию, которая будет проверять счастливый билетик или нет.
Билет счастливый, если сумма одной половины цифр равняется сумме второй.
"""
ticket_num = list(map(int, input()))
def is_lucky(ticket_num):
a = ticket_num
if len(a) % 2 == 1:
print("No Luck")
return ticket_num
... | true |
b3fab50b230537248f8f5a2db5faafb409b64a53 | vale25/FakeNewsDetection | /K-means_model/K-means_custering_conLabels.py | UTF-8 | 4,189 | 2.6875 | 3 | [] | no_license | from __future__ import print_function
import numpy as np
import pandas as pd
import nltk
nltk.download('stopwords')
nltk.download('punkt')
import re
from Variables import *
mydata = pd.read_json(trainset_senza_duplicati, lines=True)
df = pd.DataFrame(mydata)
labels = df.label.tolist()
true_k = np.unique(labels).shape[... | true |
a6dba7ee7f20ca07f4542ad04946762542fe6f13 | mitubaEX/one_day_one_ABC | /ABC/001-050/048/C/main.py | UTF-8 | 160 | 2.78125 | 3 | [] | no_license | n, x = map(int, input().split())
lis = list(map(int, input().split()))
for i in range(n):
if i == 0:
if lis[i] + lis[i + 1] > x:
lis[]
| true |
a02d7e69e470a518f78cb6172dd9188cf0bf3bf6 | dmaguire/SixNationsPool | /snpool | UTF-8 | 19,285 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import random
import json
import sys
players = []
matches = []
def addPlayer (forename, surname, email, paid = False):
player = {
'id' : len(players) + 1,
'forename': forename,
'surname' : surname,
'email' : email,
... | true |
908f6a16e49ccfab17d1f358da75715de5ce2782 | flsbnus/Face-Mask-Detector | /face_landmark2.py | UTF-8 | 753 | 2.671875 | 3 | [] | no_license | #얼굴 랜드마크 추출
import face_recognition
from PIL import Image, ImageDraw
face_image_path='data/without_mask/110.jpg'
face_image_np=face_recognition.load_image_file(face_image_path)
face_locations=face_recognition.face_locations(face_image_np)
face_landmarks=face_recognition.face_landmarks(face_image_np,face_locations)
... | true |
f40ac9adea0aef410a8ac2d66bb0389a8ff82502 | jifengbu000/document | /errors.py | UTF-8 | 260 | 2.8125 | 3 | [] | no_license |
__all__ = ["ValidationError"]
class ValidationError(Exception):
def __init__(self, message="", **kwargs):
self.message = message
def __str__(self):
return self.message
def __repr__(self):
return '%s(%s,)' % (self.__class__.__name__, self.message)
| true |
d4b7010e75a8e0502066c6687ea72b552427542d | MJones810/code_from_jasmin | /new_mean/mp_play.py | UTF-8 | 1,552 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python2.7
import multiprocessing
import time
import random
import sys
#
# Functions used by test code
#
def calculate(func, args):
result = func(*args)
return result
def calculatestar(args):
return calculate(*args)
def mul(a, b):
time.sleep(0.5*random.random())
return a * b
def ... | true |
80b6ae8f63b61b56ea6fc50fa727f0e0e8c18815 | vtemian/university_projects | /practic_stage/hmw6/machine.py | UTF-8 | 1,170 | 3.78125 | 4 | [
"Apache-2.0"
] | permissive | import json
class Machine(object):
def __init__(self, coffee_cost, money):
self.coffee_cost = coffee_cost
self.money = money
def can_give_change(self, coffees):
return False if self.total < coffees * self.coffee_cost else True
@property
def total(self):
return sum([self.money[bill] * int(bil... | true |
e779ee2b5211f985c618af801abfb1a5fc0d7ff1 | IshMehta/DSViz | /build/lib/DSViz/LinkedListV.py | UTF-8 | 4,000 | 3.046875 | 3 | [
"MIT"
] | permissive | from DSViz.NoneError import NoneError
import tkinter as tk
from tkinter.constants import BOTTOM, HORIZONTAL, RAISED
from PIL import ImageTk, Image
from importlib import resources
import io
class LinkedListV:
list = []
def __init__(self, DLL = False, CLL = False):
self.DLL = DLL
self.CLL = CL... | true |
5c43a958a71428ba79d48c6a59c08a6ccfe7c2b6 | nadia-el/azure-functions-durable-python | /samples/python_durable_bindings/DurableActivity/__init__.py | UTF-8 | 133 | 3.265625 | 3 | [
"MIT"
] | permissive | import logging
def main(name: str) -> str:
logging.warn(f"Activity Triggered: {name}")
return f'Hello Activity: {name}!' | true |
6dc9ca02a58fd53b76b47b7a9fd9855de8690029 | ummetduran/Image-Classification-with-Deep-Learning | /main.py | UTF-8 | 2,313 | 2.859375 | 3 | [] | no_license | import keras
from keras.datasets import cifar10
(x_train,y_train),(x_test,y_test) = cifar10.load_data()
print(type(x_train))
print(x_train.shape)
datanum=1000
import matplotlib.pyplot as plt
#plt.imshow(x_train[datanum])
print("Label:",y_train[datanum])
from keras.utils import to_categorical
y_train_ohe... | true |