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 |
|---|---|---|---|---|---|---|---|---|---|---|
138baaa033f08ced86fa5181d398c451a92f10f0 | gngoncalves/cursoemvideo_python_pt2 | /desafio90.py | UTF-8 | 314 | 3.78125 | 4 | [] | no_license | aluno = {}
aluno['Nome'] = str(input('Nome: ')).strip()
aluno['Média'] = float(input(f'Média de {aluno["Nome"]}: '))
if aluno['Média'] >= 7:
aluno['Situação'] = '\033[32mAprovado\033[m'
else:
aluno['Situação'] = '\033[31mReprovado\033[m'
for k, v in aluno.items():
print(f'{k} é igual a {v}.')
| true |
1556d1e11dce202e79cf112e2d2f553bec31d67a | HaidarAli1/Python_Practice | /list_overlap.py | UTF-8 | 341 | 3.265625 | 3 | [] | no_license | import random
list_1 = []
list_2 = []
common_list = []
for i in range(0, 10):
x = random.randint(1, 20)
y = random.randint(1, 20)
list_1.append(x)
list_2.append(y)
for index in list_1:
if index in list_2:
if index not in common_list:
common_list.append(index)
... | true |
efdabe1fd02259356d233524cc3ee459f240d65c | TzStrikerYT/holbertonschool-higher_level_programming | /0x11-python-network_1/1-hbtn_header.py | UTF-8 | 266 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python3
""" Displays de headers """
if __name__ == "__main__":
import urllib.request
from sys import argv
with urllib.request.urlopen(argv[1]) as response:
header = response.info()
print("{}". format(header.get("X-request-Id")))
| true |
63a15ab4d9ab5225979e5c1c2329b882a820b84e | creechD/DealershipSimulation | /GameEntity.py | UTF-8 | 613 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat May 28 12:06:11 2016
@author: DavidCreech
"""
from Dealership import *
from stateMachine import *
import pygame
from pygame.locals import *
class GameEntity(object):
def __init__(self, dealership, name, image):
self.dealership = dealership
self.name = na... | true |
2d51d0d661901e0fdee2cf022db93d2f592305dd | iceberg1015/PyQt5 | /SIACLE- Sistema para administrar clientes - PARTE 1/DB_SIACLE/crearDB.py | UTF-8 | 1,397 | 3.25 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Nombre: crearDB.py
# Autor: Miguel Andres Garcia Niño
# Creado: 27 de Octubre 2018
# Modificado: 27 de Octubre 2018
# Copyright: (c) 2018 by Miguel Andres Garcia Niño, 2018
# License: ... | true |
64e9e3fab54f35299f19308ab68f77a2ccc6973c | Anap123/python-repo | /roteiro1/geometricas.py | UTF-8 | 432 | 3.65625 | 4 | [] | no_license | tipo = input()
if(tipo!="Q") and (tipo!="R") and (tipo!="C"):
print("Nenhuma figura selecionada")
else:
val = (float(input()))
if(tipo=="Q"):
print("%.2f"%(val*val))
print("%.2f"%(val*4))
elif(tipo=="R"):
val2 = (float(input()))
print("%.2f"%(val*2+val2*2))
print... | true |
94dd857892cdae6b44bdd0cffa83cbd660fd047b | guaguakai/ctf | /2015/hw3/cha_and_resp/cha_and_resp_decrypt.py | UTF-8 | 1,807 | 2.515625 | 3 | [] | no_license | import signal
import sys
import os
import time
import base64
import random
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
from pwn import *
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s: s[:-ord(s[-1])]
class MyAES:
def __init__(self, key):
self.key... | true |
c2c4312e2432977825f36bd2f9b6e097cacdd252 | yxw19870806/PyCrawler | /project/cnu/cnu.py | UTF-8 | 5,982 | 2.609375 | 3 | [] | no_license | # -*- coding:UTF-8 -*-
"""
CNU图片爬虫
http://www.cnu.cc/
@author: hikaru
email: hikaru870806@hotmail.com
如有问题或建议请联系
"""
import os
import traceback
from common import *
# 获取作品页面
def get_album_page(album_id):
album_url = "http://www.cnu.cc/works/%s" % album_id
album_response = net.http_request(album_url, method="... | true |
702e7fe3f5fd73514caf0d9470e73a077312ac8d | Esri/military-tools-geoprocessing-toolbox | /tools/militarytools/esri/toolboxes/scripts/RadialLineOfSightAndRange.py | UTF-8 | 11,455 | 2.609375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | # coding: utf-8
'''
------------------------------------------------------------------------------
Copyright 2016-2017 Esri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.or... | true |
da5906581fa047545fe0e8d102c4ac16e1d953cf | arthurdamm/algorithms-practice | /leet/0978_longest_turbulent_subarray/0978_longest_turbulent_subarray.py | UTF-8 | 720 | 3.4375 | 3 | [] | no_license | # LeetCode 978. Longest Turbulent Subarray
# https://leetcode.com/problems/longest-turbulent-subarray/
# O(n) time O(1) space
class Solution:
def maxTurbulenceSize(self, arr: List[int]) -> int:
start, _max = 0, 1
if len(arr) > 1:
if arr[0] == arr[1]:
start = 1
... | true |
fe10842ad79ffeb73bb9a4fc7c1d328faf88205b | Aasthaengg/IBMdataset | /Python_codes/p03386/s971013794.py | UTF-8 | 304 | 3.09375 | 3 | [] | no_license | def main():
A, B, K = map(int, input().split())
ans = []
for v in range(A, min([A+K, B+1])):
ans.append(v)
for v in range(max([A, B-K+1]), B+1):
if v not in ans:
ans.append(v)
print("\n".join([str(v) for v in ans]))
if __name__ == '__main__':
main()
| true |
0cd5a20894c6fe37614207687f02d502ecc2289d | 11XGX/COMP1531 | /labs/lab06/routes.py | UTF-8 | 829 | 2.6875 | 3 | [] | no_license | from flask import Flask, redirect, render_template, request, url_for
from server import app
from math import *
userInput = ""
@app.route("/", methods=["GET", "POST"]) # Flask
def index():
global userInput
buttons = [["1", "2", "3", "C"], ["4", "5", "6", "+"], ["7", "8", "9", "-"], ["0", "*",... | true |
8dc8bc95238468bcd2417a11712d512ded7ec9fd | KingStorm/wikiEmbedding | /extract.py | UTF-8 | 1,166 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
python version: 2.7
extract text from xml dump file
tranfer complex Chinese into Simplified Chinese
'''
import logging
import sys
from hanziconv import HanziConv
#HanziConv.toSimplified(element.text)
from gensim.corpora import WikiCorpus
# start extracting
def main(wikiXmlPath, outputPat... | true |
904ed59c1f830e9b7ed9974d7c67955e880c01af | toanh/toanh.github.io | /PyAngelo/samples_sync/FlappyBirds.py | UTF-8 | 2,009 | 3.140625 | 3 | [
"MIT"
] | permissive | # Flappy Birds by Mr Del Vecchio
from random import *
background = Sprite("https://i.imgur.com/HAPgqEz.png", x = 0, y=0)
player_up = Sprite("https://i.imgur.com/6eQatQy.png", x = 250 -64, y = 200 - 48)
player = Sprite("https://i.imgur.com/OBWOs0G.png", x = 250 -64, y = 200 - 48)
pipe_ground = Sprite(Rectangle(400, 2... | true |
9c8fb9106a43aaadab70ac2e0ebe506b2de9eafa | tonyarroyave/BitsoTicker | /price_15min.py | UTF-8 | 927 | 2.84375 | 3 | [] | no_license | '''
Obtener los valores cada 15 min y postearlos
'''
import time
import bitso
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import ticker_bitso as tick
import spreadsheet_api as ss
# Inicializamos la API de Bitso
bitso = bitso.Api()
# use creds to create a client to interact with ... | true |
ff7d826e84ff77c334c25d0d9e17fa68b1ef091a | nishthasharma1/how-to-python | /ex31.2.py | UTF-8 | 2,227 | 4.25 | 4 | [] | no_license | print ("There are two boxes in front of you:\n Yellow and Red. \n Which one do you choose?")
box = input("> ")
if box == "Yellow":
print("Oh wow, this box is filled with tiny scorpians ready to crawl over you.")
print("What do you do now?")
print("Option 1: Eat the scorpiions.")
print("Option 2: Run aw... | true |
a7101705851a37612d4034a71db1a275fdc0486b | sagarapatel/Python-Number-Projects | /coin_flip.py | UTF-8 | 730 | 4.1875 | 4 | [] | no_license | #!/usr/bin/env python3
# Program simulates coin flip and gives output of heads or tail
# Github: https://github.com/sagarapatel/Python-Number-Projects/blob/master/coin_flip.py
# IDE: PyCharm
# Version: Python 3.8 compatible
from numpy import random
h = 0
t = 0
while True:
x = input("Would you like to flip coin 'y... | true |
3cfff6554450b653af9ab16b6452245caff2130a | ClaudioChagas/Introducao-a-Ciencia-da-Computacao-com-Python | /somadasmatrizes.py | UTF-8 | 412 | 3.25 | 3 | [] | no_license | def soma_matrizes(m1, m2):
matriz_soma = []
quant_linhas = len(m1)
quant_colunas = len(m1[0])
for i in range(quant_linhas):
matriz_soma.append([])
for j in range(quant_colunas):
soma = m1[i][j] + m2[i][j]
matriz_soma[i].append(soma)
return matri... | true |
f6b4fef31cb781cd5c804b11a69722de5406a83f | lele0912331037/my_python | /廖雪峰py/sushu.py | UTF-8 | 816 | 3.890625 | 4 | [] | no_license |
def ziranshu():
n=1
while True:
n+=1
yield n
if n > 10:
break
print('111', list(ziranshu()))
print('222', next(ziranshu()))
#求素数方法1
def prime(s):
for n in range(2,s):
if s % n==0:
return False
return True
print(list(filter(prime,range(2,101))))
... | true |
68c88b718a7e85fcc2a6d0819862b63cf84c7927 | Steve-42/computationalphysics_N2013301020086 | /final/zeemann.py | UTF-8 | 1,303 | 3.140625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plb
db = 0.1
b = np.arange(0, 10, db)
E2 = 3. / 4. + b / 2.
E_2 = 3. / 4. - b / 2.
E11 = - 1. / 4. + np.sqrt(3. / 4. + 1. / 4. * (1 + b)**2)
E12 = - 1. / 4. - np.sqrt(3. / 4. + 1. / 4. * (1 + b)**2)
E_11 = - 1. / 4. + np.sqrt(3. / 4. + 1. / 4. * (1 - b)**2)
E_12 = - 1. / ... | true |
82986c6eb9ba5b9aa0625c055bac831d154b8dd3 | clarkbains/1405_Practice_Problems | /Sample_Code/Problem_4.py | UTF-8 | 675 | 4.25 | 4 | [
"Unlicense"
] | permissive | while True:
print ("Please Select an option. Q to Quit")
print ("[1] - Add a course")
print ("[2] - Drop a course")
choice = input ("> ")
if choice == 'q' or choice == 'Q':
break
choice = int(choice)
if choice == 1:
print ("Enter Course Name: ")
course_name = input(">... | true |
50b8c053cdfa3535f7a9cce7ec1d45be928860ae | alliefitter/boto3_type_annotations | /boto3_type_annotations_with_docs/boto3_type_annotations/mq/paginator.py | UTF-8 | 3,075 | 3.046875 | 3 | [
"MIT"
] | permissive | from typing import Dict
from botocore.paginate import Paginator
class ListBrokers(Paginator):
def paginate(self, PaginationConfig: Dict = None) -> Dict:
"""
Creates an iterator that will paginate through responses from :py:meth:`MQ.Client.list_brokers`.
See also: `AWS API Documentation <ht... | true |
cde4081de07cfeeaada721a1210ae356eb41970d | rbtchc/tw_eReceipt | /parser.py | UTF-8 | 1,606 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
import sys
"""
Taiwan eletronic receipt format
CSV row format: Type,Paylod
--
Type: (1) M: metadata (2) D: detail
--
(1) Metadata format: M,status,serial,date,store VAT number,store name,card name,card serial,total amount
- M: indicates it's meta... | true |
95150504b615bb540eeea67c30a6651c829e3709 | maximdumont/PyPubSub | /Subscriber.py | UTF-8 | 448 | 3.390625 | 3 | [] | no_license | class Subscriber(object):
DEFAULT_SUBSCRIBER_NAME_VALUE = "No Value"
def __init__(self, subscriberName=DEFAULT_SUBSCRIBER_NAME_VALUE):
self.subscriberName = subscriberName
@property
def name(self):
return self.subscriberName
@name.setter
def name(self, value):
self.sub... | true |
df85d6960aa7c601ee6a0aecb462e2146687715d | liberty-askew/MainProjects | /MonteCarlo/ArrivalTimes/buildQ.py | UTF-8 | 2,973 | 2.859375 | 3 | [] | no_license | from scipy import stats
def rndTime():
return stats.expon(scale=5).rvs()
def servTime():
return stats.expon(scale=2).rvs()
def firstQ(runTime):
t = 0
cust = []
count = 0
while True:
count = count + 1
arrI = rndTime()
servI = servTime()
arrT = ... | true |
7ef1496dbb3c608f71622280a059f1f3467a5434 | zhhkof/python_tools | /sqilteDataCompare/uitest2.py | UTF-8 | 1,966 | 3.078125 | 3 | [] | no_license | # -*-coding = utf-8-*-
import tkinter as tk
from tkinter import filedialog,StringVar
class Application:
def __init__(self, root):
self.root = root
self.create_frame_top()
def create_frame_top(self):
self.frm_bottom = tk.LabelFrame(self.root)
self.frm_bottom.grid(row=1, colum... | true |
b7c03dd057822ce1c4dbd965a2014fefd23933fa | Yabby1997/2020-Spring-CNU-Image-Processing-Lecture | /week8_homework/my_bilateral.py | UTF-8 | 2,909 | 3.09375 | 3 | [] | no_license | import numpy as np
import cv2
import my_padding as my_p
def my_get_Gaussian2D_mask(msize, sigma=1):
y, x = np.mgrid[-(msize // 2):(msize // 2) + 1, -(msize // 2):(msize // 2) + 1]
#2차 gaussian mask 생성
gaus2D = 1 / (2 * np.pi * sigma**2) * np.exp(-(( x**2 + y**2 )/(2 * sigma**2)))
#mask의 총 합... | true |
e9a983d1b0987c7fbcfe97d888e771a43231a78e | mendelt/assignment | /server/main.py | UTF-8 | 1,880 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | import tornado.ioloop
import tornado.web
import json
PORT = 8888
class EmailsHandler(tornado.web.RequestHandler):
def get(self):
self.write({id: email.serialize() for (id, email) in store.all().items()})
def post(self):
new_id = store.store(Email.parse(json.loads(self.request.body)))
... | true |
cf81860be53db6d140cb488948dce05108dd2a29 | BUEC500C1/api-design-nadimelhelou | /api.py | UTF-8 | 2,518 | 3.390625 | 3 | [] | no_license | # Nadim El Helou - EC 500 C1 - HW2 Weather API
# References:
# Airports dataset: https://github.com/datasets/airport-codes
# Creating an API: https://programminghistorian.org/en/lessons/creating-apis-with-python-and-flask#installing-python-and-flask
# Weather API documentation: https://openweathermap.org/api
... | true |
12fd2bc412ec822c40778d461ab1cd02d6c5200c | ikemerrixs/Au2018-Py210B | /students/rachel_s/session09/old_mailroom.py | UTF-8 | 4,212 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python3
import csv
import os
import datetime
import sys
from collections import defaultdict
# Import donor data
def data_import(filename):
donor_info = defaultdict(list)
csv_list = []
with open(filename) as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
csv_list ... | true |
a9ca2c1d801e58d999f6395cc7f9f4df8c39bc4e | DANIELA19017L/copito | /karol.py | UTF-8 | 266 | 3.359375 | 3 | [] | no_license | numero = [ 10,-5,0 ,3 ,-56 ,2 ,2.3 ,7.58 ,87, 10 ]
""" 0 1 2 3 4 5 6 7 8 9 """
print(numero[2])
if numero[2] > 0:
print ("es mayor a 0")
if numero [2] < 0:
print("es menor a 0 ")
else :
print("es igual a 0 ")
| true |
6699681f1ad74a8e118e65fc4ec16c2b471bdfd4 | equaliser-app/equaliser-web | /website/models.py | UTF-8 | 3,155 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
class User:
def __init__(self, username, forename, surname, email, photo_url, phone,
token):
self.username = username
self.forename = forename
self.surname = surname
self.email = email
self.photo_url = photo_url
self.phone =... | true |
f81d38ebde72cd1e23f57084e2bbfa12b311d819 | zhaowz/Ctr | /Python/features.py | UTF-8 | 4,702 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 27 12:01:47 2018
@author: hardyhe
"""
import pandas as pd
import datetime
import time
path = '../Data/'
def timestamp_datetime(value):
format = '%Y-%m-%d %H:%M:%S'
value = time.localtime(value)
dt = time.strftime(format, value)
re... | true |
b5f9ade9c65ba4e996ba3a533228e3f6b0bf6293 | agneya-1402/Virtual-Assistant | /weather.py | UTF-8 | 708 | 3.046875 | 3 | [] | no_license | import pyttsx3
import requests
def weather():
a = pyttsx3.init()
# a.say("The current temperature in mumbai is "+ str(weather.temp()))
# a.say(str(weather.climate()))
api = "https://api.openweathermap.org/data/2.5/weather?q=Mumbai&appid=64587937fbf72cd46ee211b3523abb0a"
# city="Mumbai"
... | true |
e15c1233378bdcf80292f1737bdd4919a3468b80 | wwnis7/256 | /Jungwoo-Kang/57prob/36.py | UTF-8 | 701 | 4 | 4 | [] | no_license | # Enter a number: 100
# Enter a number: 200
# Enter a number: 1000
# Enter a number: 300
# Enter a number: done
# Numbers: 100, 200, 1000, 300
# The average is 400.
# The minimum is 100.
# The maximum is 1000.
# The standard deviation is 400.25.
# import numpy as np
number=''
list=[]
while number != 'done'... | true |
9971ca92b6ff85a30f4070193c56031ad4f17830 | logandrews/markov_word_gen | /markov.py | UTF-8 | 889 | 3.53125 | 4 | [
"ISC",
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/python
import random
class MarkovTable(object):
def __init__(self):
self.count = 0
self.dictionary = {}
def increment(self, key):
self.dictionary[key] = self.dictionary.setdefault(key, 0) + 1
self.count = self.count + 1
def get(self):
r = random.randint... | true |
265259442ad8ad7347b948371d297c74d3aded7c | susong987/rascil | /rascil/workflows/rsexecute/image/image_rsexecute.py | UTF-8 | 2,928 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive |
__all__ = ['image_rsexecute_map_workflow', 'sum_images_rsexecute']
import logging
from rascil.processing_components.image import copy_image
from rascil.workflows.rsexecute.execution_support.rsexecute import rsexecute
from rascil.processing_components.image import image_scatter_facets, image_gather_facets
log = logg... | true |
484033c027da080c36f941060c5ad0be44084017 | HiroakiMikami/procon-workspace | /src/atcoder/abc110/a.py | UTF-8 | 120 | 2.890625 | 3 | [] | no_license | A, B, C = [ int(x) for x in input().split() ]
ans = max(A, B, C) * 10 + (A + B + C - max(A, B, C))
print(ans)
print()
| true |
76d47b0d8808d9ffb44a47a494f9d049418acac3 | loredana-stirbu/Introducere_Afisare_cAlcule | /af_cl_pr5.py | UTF-8 | 251 | 3.375 | 3 | [] | no_license | print("Ion şi Vasile joacă următorul joc: Ion spune un număr iar Vasile trebuie să găsească cinci numere consecutive, crescătoare, numărul din mijloc fiind cel ales de Ion. ")
n = int(input("dati un numar: "))
print(n-2 , n-1 ,n, n+1 , n+2) | true |
278ddc5246e83c66db39e90ee1698e83067f7297 | kalmar19/csf | /hw2.py | UTF-8 | 2,675 | 3.828125 | 4 | [] | no_license | # Name: Mary Kallem
# Evergreen Login: kalmar19
# Computer Science Foundations
# Programming as a Way of Life
# Homework 2
# You may do your work by editing this file, or by typing code at the
# command line and copying it into the appropriate part of this file when
# you are done. When you are done, running ... | true |
854c852a3bf6dde17c10213ca314a8875c945de2 | JYIP010/youzusummer2020 | /imagetotexttests/pythoncode/opencv/MainV2.py | UTF-8 | 6,629 | 3.078125 | 3 | [] | no_license | # V2: Manual gibberish detector using illegal symbols.
# Merge contours that are close together
# Not accurate in detecting whether a contour is an image or text
import cv2
import numpy as np
import pytesseract
from PIL import Image, ImageOps
from langdetect import detect
def get_image(image_path):
"""Get a num... | true |
280684766c2a11a31ddbf3d51d53821a6ae78e23 | jkDina/computer_vision | /les4/004-classification.py | UTF-8 | 7,919 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Реализация логистической регрессии в TensorFlow
# In[ ]:
import numpy as np
import tensorflow as tf
# In[ ]:
get_ipython().run_line_magic('matplotlib', 'inline')
from matplotlib import pyplot as plt
# ## Генерируем данные для задачи регрессии
# In[ ]:
NUM_FEATURES ... | true |
dc09fc992e006a2d000fcf7526eaf1a7fbf93057 | Yanl05/FullStack | /socket_two_client.py | UTF-8 | 367 | 2.640625 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
"""
# @Time : 2019/9/2
# @Author : yanlei
# @FileName: socket_two_client.py
"""
import socket
sk = socket.socket()
sk.connect(('127.0.0.1', 8080))
while True:
sk.send(bytes(input('>>>'), encoding='utf-8'))
ret = sk.recv(1024).decode('utf-8')
if ret == 'bye':
sk.send(b'... | true |
2c3f6f78161743c97cd8cdc041543e45ea5d6972 | nenad/TPpy | /tppy/__main__.py | UTF-8 | 1,323 | 2.5625 | 3 | [] | no_license | import importlib
import sys
import os
from configuration import config
def main(args=None):
if args is None:
args = sys.argv[1:]
currentDir = os.path.dirname(__file__)
config.loadProjectConfig()
if len(args) == 0:
print "You must specify module"
elif len(args) == 1:
modu... | true |
5d1735622b82b6ae73490edc09a74059d644c082 | 3mtee/exercism-python | /grains/grains.py | UTF-8 | 209 | 3.5625 | 4 | [
"Apache-2.0"
] | permissive | def square(number):
if number <= 0 or number > 64:
raise ValueError("Number should be between 1 and 64")
return 2 ** (number - 1)
def total():
return sum(square(n) for n in range(1, 65))
| true |
b238f7a10267095f1001b192bfeb1e5c9ba22076 | nickliu02/Pacman | /board.py | UTF-8 | 2,081 | 3.171875 | 3 | [] | no_license | from pygame import *
import glob
def row_into_col(lst):
"""
Takes in a 2D list and changes it so that the rows become columns and columns become rows
"""
return [[lst[j][i] for j in range(len(lst))] for i in range(len(lst[0]))]
class Board:
def __init__(self, board):
self.board = board
... | true |
9aefb746c4c8da83ddaaebbfa2af5ddea7b345e6 | tomguluson92/RAISR | /train.py | UTF-8 | 2,842 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import argparse, os
import numpy as np
from scipy import sparse, misc
from model.hashTable import hashTable
from tqdm import tqdm
def is_image_file(filename):
return any(filename.endswith(extension) for extension in ['.png', '.jpg', 'bmp'])
def mod_crop(im, modulo):
sz = im.shape
... | true |
44552df04c43ff2664b33538487e1b2931e0766c | seweber/bandstructure | /bandstructure/lattice/kagomelattice.py | UTF-8 | 510 | 2.6875 | 3 | [
"MIT"
] | permissive | import numpy as np
from .lattice import Lattice
class KagomeLattice(Lattice):
def initialize(self):
l1 = np.array([np.sqrt(3), 1])/2
l2 = np.array([np.sqrt(3), -1])/2
b1 = np.array([0, 0])
b2 = np.array([np.sqrt(3), 1])/4
b3 = np.array([np.sqrt(3), -1])/4
a = np.l... | true |
7713e6b5b2ac9b647c7ac89d62aabee1e0e17cda | natibutu/deeplearning-math.github.io | /2020/project2/8.Semiconductor - Ganghua Fan/MATH6380P Project2_code/feature_pca.py | UTF-8 | 2,382 | 2.53125 | 3 | [] | no_license | from kymatio.keras import Scattering2D
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Flatten, Dense
from sklearn.preprocessing import StandardScaler
import numpy as np
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
fro... | true |
1cbbab93e1fdfcd5c90867e58937b4fb6e0becd4 | TheRandomTroll/Introduction-to-ScriptLanguages-Homeworks | /Peter Nikolov/Homework-MazeSolver/maze.py | UTF-8 | 3,554 | 3.96875 | 4 | [] | no_license | """
Petur Nikolov
IX B class No. 23
"""
def find_maze_exits(maze, starting_position):
all_paths = []
def find_exits(maze, current_pos, current_path=''):
if maze[current_pos['row']][current_pos['column']]:
if 0 < current_pos['row'] < len(maze) - 1 and \
0 < current_pos[... | true |
19a712313d7836a94a983c005ca3d9e24bed119f | rlowrance/test7 | /seven/accumulators.py | UTF-8 | 7,177 | 2.640625 | 3 | [] | no_license | '''define accumulators
Copyright 2017 Roy E. Lowrance, roy.lowrance@gmail.com
You may not use this file except in compliance with a license.
'''
import abc
import numbers
import numpy as np
import pandas as pd
import pdb
import pprint
# from . import feature_makers
from . import feature_makers
from . import read_csv
... | true |
8ca0b1761e054dda472f98bd93e6f3917a1f99f7 | xiaozhiqi2016/monitor_web | /monitorclient/plugins/linux/memory.py | UTF-8 | 2,850 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
#coding:utf-8
# import commands
import subprocess
def monitor(frist_invoke=1):
monitor_dic = {
'SwapUsage': 'percentage',
'MemUsage' : 'percentage',
}
shell_command ="grep 'MemTotal\|MemFree\|Buffers\|^Cached\|SwapTotal\|SwapFree' /proc/meminfo"
try... | true |
2d69ddc9386bffaff91ba6fbe04b09bc1e9c4651 | TrueMichato/DnDBeyond_Parser | /dndbeyond_crawler.py | UTF-8 | 10,761 | 2.640625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver import Chrome
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
import pandas as pd
import pygsheets
from pygsheets.client import Client
import... | true |
6707143d9f2f7aaae5513947811b39d4a26c6edd | aajarven/gradu-yde | /plotscripts/background/pca.py | UTF-8 | 2,998 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import math
import pylab
import random
from sklearn.decomposition import PCA
def aesthetics(ax, xmin, xmax, ymin, ymax, xlabel, ylabel, title,
xLabelOffset=0.0, yLabelOffset=0.0):
ax.set_xlabel(xlabel)
ax.set... | true |
acdd789b15f5691afadd8031b875297566a492c0 | itaishopen/Intro-to-python | /ex11/ex11_backtrack.py | UTF-8 | 1,891 | 3.484375 | 3 | [] | no_license |
import math
def general_backtracking(list_of_items, dict_items_to_vals, index,
set_of_assignments, legal_assignment_func,
*args):
"""
a general back tracking helper
:param list_of_items: A list of the items that we would like to assign.
:param dict_items_to_vals... | true |
1f8d01e57fe11a7558d04751ac2de32081038814 | kabouzeid/Singular-Development-Environment | /Test/testGBEXPORTFOLDER/classes/RunTaskOptions.py | UTF-8 | 5,237 | 3.421875 | 3 | [] | no_license | class RunTaskOptions(object):
"""
This class handles the options given when calling runTasks.py.
It is a collection of the following data:
- Maximum CPU Time available for each computation
- Maximum Memory available for each computation
- Maximum amount of computations that should be run in para... | true |
8b3369a51e0841ce86a93fe7b7bb383e2222c830 | dnstech/tf-dnstech | /hough/hough.py | UTF-8 | 5,827 | 3.046875 | 3 | [
"MIT"
] | permissive | # MIT License
#
# Copyright (c) 2021 DNS Technology
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merg... | true |
9e522e3752575e2ffe4298a9158295f0a35fccfe | chandan2495/Codechef | /fxortable.py | UTF-8 | 418 | 2.640625 | 3 | [] | no_license | from pandas import *
t=int(input())
while t>0:
inp=raw_input().split()
n,m,p,x=[int(z) for z in inp]
a=[[0 for z in range(m)] for y in range(n)]
inp=raw_input()
a[0]=[int(z) for z in inp]
for i in range(n-1):
for j in range(m):
temp=a[i][j]^x
temp0=a[i][(j+p)%m]^0
temp1=a[i][(j+p)%m]^1
a[i+1][(j... | true |
9c5dd5a8bcdfc4a1e2b913104a714fba7ba8ae11 | fagan2888/SURFRAD-Data-Modeling | /main.py | UTF-8 | 2,449 | 2.78125 | 3 | [] | no_license | from file_retrieval import retrieve_files
from generate_dictionary import form_dict
import os
from plotting import plot_graph
import sys
print('Checking for required dependencies...\n')
fileContents = os.listdir(os.getcwd())
fileContents = set(fileContents)
checkNames = {'data-name-dictionary.json', 'station-name-di... | true |
6e443cb204cee43dd44943c4c09c47e0a93d8566 | NUS-ALSET/lambda-verifiers | /python/test_runner.py | UTF-8 | 2,337 | 3.125 | 3 | [
"MIT"
] | permissive | from __future__ import print_function
import os
import sys
import unittest
import json
# Might need to do a try catch on this one.
# import * is only allowed from the root module level.
#from usercode import *
importWasSucessful = True
importErrorMsg = ""
try:
from usercode import *
except Exception, e:
imp... | true |
9fd767abc3c6d6e877c7dcbb7ab0f8cc4858787b | AdamZhouSE/pythonHomework | /Code/CodeRecords/2704/60608/280564.py | UTF-8 | 223 | 2.921875 | 3 | [] | no_license |
def func4():
arr, val, res = eval(input()), 0, []
for i in range(0, len(arr)):
if res.count(arr[i][1]) > 0:
val = i
else:
res.append(arr[i][1])
print(arr[val])
func4()
| true |
f79862fe21896d8ed9b323f7b79b6f0b8a03ede3 | mdeeds/genie | /py/goodStrategy.py | UTF-8 | 541 | 3.015625 | 3 | [
"MIT"
] | permissive | import random
import numpy as np
from oneDie import OneDie
class GoodStrategy:
game = None
def __init__(self, g):
self.game = g
def getMove(self, state):
move = np.zeros(self.game.getMoveSize())
# if (state[OneDie.kScoreIndex] >= 5 or state[OneDie.kTotalScore] > 25):
# ... | true |
0001c447f25ebf5040627f4079fb7b828b9f2190 | mandocaesar/mongodbpythonexample | /2_insert_one_data.py | UTF-8 | 462 | 2.953125 | 3 | [] | no_license | import pymongo
from person import Person
#create a client's connection to database
client = pymongo.MongoClient("mongodb://localhost/mydb")
#create db instance
mydb = client["mydb"]
#create collections instance
mycollection = mydb["person"]
#instantiate person class to an object then insert it to collection
person... | true |
bd76f90b27aa0162be4b2ac0474f045b9504637e | ogrergo/translation_memory_evaluation | /operators/remove_diacritics.py | UTF-8 | 603 | 2.859375 | 3 | [] | no_license | from operators.operator import Operator
import re
import unicodedata
def _remove_diacritics(txt):
"""This method removes all diacritic marks from the given string"""
norm_txt = unicodedata.normalize('NFD', txt)
shaved = ''.join(c for c in norm_txt if not unicodedata.combining(c))
return unicodedata.nor... | true |
0e80334f0c9400cf4a70e446c5cc011c5f75df49 | phongluudn1997/fluent_python | /decorator_basic.py | UTF-8 | 598 | 3.890625 | 4 | [] | no_license | import time
def decorator_function(func):
def wrapper(*args, **kwargs):
print(f'wrapper run before {func.__name__} run')
func(*args, **kwargs)
return wrapper
def time_traking(func):
'''Practice with time tracking'''
def wrapper(*args, **kwargs):
then = time.time()
res... | true |
74e80a0922c718304a94dcf7a70b20772a4d307c | olivetree123/coco-py | /route.py | UTF-8 | 1,552 | 3.125 | 3 | [] | no_license | from typing import List
class RulePart(object):
def __init__(self, val):
self.val = val
self.param_name = None
if self.is_param():
self.param_name = self.val[1:-1]
def is_param(self):
if self.val[0] == "{" and self.val[-1] == "}":
return True
re... | true |
36c59bebeb4fd478622d869f56abef4d4e467edb | gschen/sctu-ds-2020 | /1906490890-曾红/day0315/作业01.py | UTF-8 | 985 | 4.03125 | 4 | [] | no_license | # 回合制人物Pk游戏
# 创建一个角色类(类),包含属性有:角色名称、角色血量、攻击力、暴击率、闪避率。
# 创建一个游戏类,属性包含参加游戏的双方(对象),方法有playGame,参加游戏的双方互相攻击,可能产生暴击-----攻击力*2,可能闪避----闪避当前对方的攻击,直到一方血量<0,游戏结束。该方法打印每一轮游戏的情况,以及最终的获胜情况。
# 备注:如果暴击率是0.2可以用以下语句判断是否造成暴击
# if random.random() <= 0.2:
# pass
import random
class Player():
def __init__(self,name,blood,attack,bj,d... | true |
e10c8128404b479c77a479f9c49c181c7a07f404 | JialinLiOSU/bikeability_ConvNet | /GIS_algorithm/geom/linesegment.py | UTF-8 | 2,272 | 2.984375 | 3 | [
"MIT"
] | permissive | from .point import *
from .sideplr import *
## Two statuses of the left endpoint
ENDPOINT = 0 ## original left endpoint
INTERIOR = 1 ## interior in the segment
class Segment:
"""
A class for line segments.
"""
def __init__(self, e, p0, p1, c=None):
"""
Constructor of Segment class.... | true |
63e670c9fac7155ddd1c97e89f712f933edfa518 | daniel-reich/ubiquitous-fiesta | /MSjfXQ4gvMzeezFgB_19.py | UTF-8 | 117 | 2.703125 | 3 | [] | no_license |
def fifty_thirty_twenty(ati):
budget = { 'Needs': ati*0.5, 'Wants': ati*0.3, 'Savings': ati*0.2}
return budget
| true |
c89027eaa8aea1327eb164512f6af1287b399ff3 | zo-bar/rosalind | /src/com/zobar/rosalind/ALPH.py | UTF-8 | 12,100 | 2.84375 | 3 | [] | no_license | '''
Created on Aug 10, 2015
@author: zoya
'''
LETTERS = ['A', 'C', 'G', 'T', '-']
EXT_LETTERS = ['B', 'D', 'E', 'F', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X']
As = ['B', 'D', 'E', 'F', 'N', 'O', 'P', 'Q', 'R', 'S']
Cs = ['B', 'H', 'I', 'J', 'N', 'O', 'P', 'U', 'V', 'W']
Gs = ... | true |
72022df83c7852f0ec82c7b552e88461f9c16b6d | jluocc/jluo2018 | /python/python/老师笔记/python/day17/day17/exercise/human.py | UTF-8 | 1,307 | 4.34375 | 4 | [] | no_license | # 练习 :
# 定义一个"人" 类
# class Human:
# def set_info(self, name, age, adress='不详')
# '''此方法用来给人对象添加"姓名", "年龄"和"家庭住址"属性'''
# ... # 此处自己实现
# def show_info(self):
# '''显示此人的信息'''
# ... # 此处自己实现
# 调用方法如下:
# s1 = Human()
# s1.set_info('小张', 20, '深圳市... | true |
c68f1718aaab5f591f735c42c4934c76b5a86614 | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/difference-of-squares/a6f0297bf40448d7a4f5de98c175ea4a.py | UTF-8 | 225 | 3.625 | 4 | [] | no_license | #/usr/bin/env python
def square_of_sum(nnum):
return ( sum( range(nnum+1) ) )**2
def sum_of_squares(nnum):
return sum([x**2 for x in range(nnum+1)])
def difference(nnum):
return square_of_sum(nnum) - sum_of_squares(nnum)
| true |
4b12aef1d3dfc7d6554261f34751f3258ff349e5 | Alexander-susanin/python | /28.11.2020/p1.py | UTF-8 | 525 | 3.625 | 4 | [] | no_license | #Убирает все символы, не включая границы
list1 = 'efrhrhe/*frefhjg/*tgtruteur*/egye'
words = ('/*', '*/')
print(list1[:list1.find(words[0]) + len(words[0])] + list1[list1.rfind(words[1]):])
#Убирает все символы, включая границы
list = 'This is a string /*here is a text to remove*/, and here is a text not to rem... | true |
4863a5a11d29eb66e120b2ff3df114159f2206c0 | UW-CIA/Extensive_Evaluations | /ContinAuth/notebooks/VAEFCN_VAE_chapter-5-5-siamese-cnn-NO_WASTE-Copy1 [fcn all models] _4layer.py | UTF-8 | 88,817 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Siamese CNN & vae
#
# *Created by Holger Buech, Q1/2019*
#
# **Description**
#
# Reimplemenation of an approach to Continuous Authentication described by [1]. It leverages a Siamese CNN to generate Deep Features, which are then used as input for an OCSVM authentication c... | true |
eea0da6df760664e9757f00d1427c13b395be43f | karthik1017/mca | /python/python_practice_programs/freq.py | UTF-8 | 66 | 2.65625 | 3 | [] | no_license | str1 = 'karthik'
for i in str1:
if i in str1:
print(i) | true |
e6f226ad8a2c6c7f98e324e3c8cecf502b703674 | securITymania/time-based-blind-sql-injection | /time_based_blind_sql_injection.py | UTF-8 | 22,513 | 3.0625 | 3 | [] | no_license | # Title: Time Based Blind SQL Injection Tool
# Author: Alessio Gilardi
# The tool takes in input an URL, a method, a list of possibly vulnerable fields with the respctive values.
# Once found, the tool ask the user to select a database and a table to dump, after it prints the results.
# Usage: time_based_blind_sql_in... | true |
08fcac3f56a1965fa9afdd2f2f1aaecab922baf4 | huiqianqian/nlp | /plotFilteredCounts.py | UTF-8 | 1,571 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
#
# Quentin Ribac, May 2018
# configuration
# Those two files are lists (one number per line) of the numbers of filtered topics and news headlines, block per block of the collection.
# They must be of same length.
# The FILTERED_COUNTS_FILE would have been generated aft... | true |
1c4a63fd412fee5cd8fa943524449edf234b0723 | ericocsrodrigues/Python_Exercicios | /Mundo 01/ex013.py | UTF-8 | 343 | 4.3125 | 4 | [] | no_license | """
Exercício Python 13: Faça um algoritmo que leia o salário de um funcionário e mostre seu novo salário, com 15% de aumento.
"""
sal = float(input('Qual é o salário de um funcionário? R$'))
print(f'O funcionário que recebia \033[1;31mR${sal:.2f}\033[m com o aumento de 15% vai passar a receber \033[4;34mR${sal * 1.15... | true |
5592d049c11ca9258d202bdc52e949da9f9979ac | Arnoldosmium/pystreamer | /streamer/util.py | UTF-8 | 1,165 | 2.859375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
streamer.util
---
The module contains some common tools used by the package.
This should be treated as an internal module and it's subjected to breaking changes.
"""
from typing import Iterable, Iterator, Union, TypeVar
import io
T = TypeVar('T')
def to_iterator(stream_or_object: Union... | true |
cc95a5dd3a83fb27a71b9a5ce2039c60e3a67b7f | gitxyb/xuyabiao | /python/kaifa/lianxi/sql_1/sqlmy_.py | UTF-8 | 821 | 2.921875 | 3 | [] | no_license | #coding:utf8
import MySQLdb
conn = MySQLdb.connect()
conn.select_db('auth')
corsor = conn.cursor()
sqli = "insert into user values (%s,%s)"
sqls = "select * from user"
def regist():
username = raw_input('请输入用户:')
passwd1 = raw_input('请输入密码:')
passwd2 = raw_input('请重新输入密码:')
return (username,passwd2)
def login()... | true |
9ad9040452928af3facc241417ba8a641a979993 | AakSin/CS-Practical-FIle | /Reference/Lab Reference/PC 2/List Worksheet/q10.py | UTF-8 | 79 | 3.0625 | 3 | [] | no_license | a=[2,4,5,7,9,10]
s=[]
for i in a:
if i%2==0:
s.append(i)
print(s)
| true |
4802de346246e2bd3080f8727d12b51c9c5ec458 | Huijuan2015/leetcode_Python_2019 | /50. Pow(x, n).py | UTF-8 | 832 | 3.546875 | 4 | [] | no_license | Time/Space: log(n)
class Solution(object):
def myPow(self, x, n):
"""
:type x: float
:type n: int
:rtype: float
"""
if n == 0:
return 1
if n < 0:
return 1.0/self.myPow(x,-n)
half = self.myPow(x, n//2) #// 向下取整
if n%2 ==... | true |
8464e3cc34ab2feed7053a6527ee892e3889bce7 | kid7960/ContinuousAssessmentN2Practice | /news_weather.py | UTF-8 | 2,451 | 3.59375 | 4 | [] | no_license | """
This file holds all the functions related to getting the weather and news information
"""
import json
import requests
from notification import news_event, weather_event
def get_api_keys() -> tuple:
"""
This function gets the news api key from the config file.
"""
with open('config.js... | true |
c0ec3ce44a19343a40e530d0ec6cf778b6d23883 | roei7bason/Roei_Proj | /Server.py | UTF-8 | 766 | 2.734375 | 3 | [] | no_license | import socket
import thread
server_socket=socket.socket()
def main():
server_socket.bind(("127.0.0.1",8888))
f = open('pic.png','wb')
server_socket.listen(5)
while True:
(client_socket, client_address) = server_socket.accept()
l = client_socket.recv(1024)
while (l):
... | true |
7a32a1989ce316d251b388a4fedbed09f71c5623 | ariannedee/intro-to-python | /Problems/Solutions/problem_4_dice_roll.py | UTF-8 | 264 | 4.5625 | 5 | [] | no_license | """
Randomly returns two numbers between 1 and 6
"""
import random
# Generate two random integer between 1 and 6 (inclusive)
die_1 = random.randint(1, 6)
die_2 = random.randint(1, 6)
# Tell the user what the result was
print(f'You rolled a {die_1} and {die_2}')
| true |
2799b5a911311f5e1336f9575264fd62d72fcf05 | msmujahidin/python_sensor_chart | /Website/Hunidity/views.py | UTF-8 | 1,013 | 2.546875 | 3 | [] | no_license | try:
from flask import (Blueprint,
render_template,
redirect, url_for, session)
from flask import Flask, request, session, send_file
import random
import json
from time import time
from random import random
from flask import Flask, render_templ... | true |
1eac1b6fd78eb5af4115ab2abd139bc117bdec59 | priya-chaurasia/Python-3-GUI-using-Tkinter | /Geometry Management/02.Grid_method.py | UTF-8 | 267 | 3.59375 | 4 | [] | no_license | import tkinter as tk
colours={'red','orange','yellow','green','blue','white'}
c=0
for x in colours:
tk.Label(text=x,relief=tk.RIDGE,width=20).grid(row=c,column=0)
tk.Entry(bg=x,relief=tk.SUNKEN,width=10).grid(row=c,column=1)
c=c+1
tk.mainloop()
| true |
2d963aff2c97d6e85ec3241bdf2b1746cf980adc | anhtran304/govhack2020 | /hello/twitterlearning.py | UTF-8 | 5,171 | 2.875 | 3 | [] | no_license | from sklearn.pipeline import Pipeline
from sklearn.metrics import confusion_matrix
from sklearn.metrics import accuracy_score
from sklearn.naive_bayes import GaussianNB
from sklearn.naive_bayes import MultinomialNB
# from sklearn.naive_bayes import BernoulliNB
# from sklearn.svm import SVC
from sklearn.model_selection ... | true |
b7a68f952020d2918a1d25ffa99474dd229582af | bleamer/practice | /Python/Graph/BoggleSolverTrie.py | UTF-8 | 3,147 | 3.9375 | 4 | [] | no_license | #!/usr/bin/python
''' This program implements boggle solver using Trie '''
''' The code is implements the solution suggested at
http://stackoverflow.com/questions/746082/how-to-find-list-of-possible-words-from-a-letter-matrix-boggle-solver/746102#746102 '''
NUM_ALPHABETS = 26
# Trie node definition
class TrieNode:... | true |
2aa91b35e3b485b00ad4f8d97a6f924f951bd4e4 | dzz007/music-theory-calculator | /music_theory.py | UTF-8 | 4,036 | 3.1875 | 3 | [] | no_license | # by dzz007, 2020/10/22
# this program can calculate the harmonic of a given pitch in a given scale
# the scale is defined by how many sharps or flats in the signature.
# for example (under major mode):
# 3 b
# Ab
# would return the harmonic function of A-flat in the major that has signature of 3 flats in it
scale... | true |
5e6506190f5e2664eb9852dcc5502109a4c15b39 | tutysara/Daksh_Survey_2013 | /barchart_top_issues.py | UTF-8 | 1,019 | 3.234375 | 3 | [] | no_license | '''Usage: barchart_top_issues.py <rating.csv file> <topn>
By Saravana <tutysara@gmail.com>'''
import csv
import sys
from pylab import *
fileName = sys.argv[1]
topn = int(sys.argv[2])
def getRatings(fileName, topn):
issues = []
ratings = []
f = open(fileName)
reader = csv.reader(f)
reader.next() ... | true |
0c741b63929bb4af42f186cc4a5983f594c8b294 | HippocampusGirl/calamities | /calamities/keyboard.py | UTF-8 | 2,019 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
"""
import curses
import curses.ascii
import enum
import queue
import os
class Key(enum.Enum):
Break = "break"
Return = "return"
Up = "up"
Down = "down"
... | true |
0260f944c5eabadfd8edf0e64865dc6d119df432 | sanacor/Algorithm | /Best Time to Buy and Sell Stock II /Best Time to Buy and Sell Stock II.py | UTF-8 | 487 | 3.453125 | 3 | [] | no_license | class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
profit = 0
for idx, price in enumerate(prices):
if idx == 0:
continue
if prices[idx] > prices[idx-1]:
profit = pr... | true |
bbf809f34c7856907e8be543092ee3c6191604fd | b0ggyb33/mrgameandwatch | /MrGameAndWatch.py | UTF-8 | 1,092 | 2.828125 | 3 | [] | no_license | __author__ = 'b0ggyb33'
import pygame
import renderer
import World
pebbleSize = (144,168)
pythonSize = (272,208)
class MrGameAndWatch(object):
def __init__(self):
self.fps=30
pygame.init()
self.world = World.World()
self.renderer = renderer.Renderer(self.world,*pythonSize)
... | true |
d5f78667bc224cdd0514ddec4bcdc1ec914d0c98 | daniel-jacobs98/bbh-chirp-mass-estimator | /model training/nn_utils.py | UTF-8 | 3,149 | 2.890625 | 3 | [] | no_license | import numpy as np
import h5py
import os
import utils
#Iterates through set of files in a data folder (must all be .hdf files) and loads their signals,
#downsampling to 2048Hz
#Returns a dict with keys [H1, L1, V1]
def load_signals(data_directory):
strains = []
files = (f for f in os.listdir(data_directory) if... | true |
cb5a802b22b3eaad73a90ca1967ad4461d350da8 | wangxuyongkang/chengxuyuanhh | /Code/爬虫/06day/bs4_used.py | UTF-8 | 3,998 | 3.015625 | 3 | [] | no_license | #Beautifulsoup4?
# 是python的一个xml和html的解析器,目的是从xml或
# html中提取数据
#安装 pip3 install beautifulsoup4
# beautifulsoup4 要比xpath解析数据要慢,因为beautifulsoup4载入的是
# 整个html文档
"""
findall() 查找所有节点
find() 查找单个
支持css选择器
获取标签的属性 p['class'] => p.attrs['class']
获取标签的文本 p.get_text() => p.string
"""
#腾讯招聘为例
# 首页url地址
#https://hr.tencent.c... | true |
8d23a71630eb714030a0702ab82e758923c1978a | aishwat/missionPeace | /tree/traversals.py | UTF-8 | 797 | 3.78125 | 4 | [] | no_license | class Node:
def __init__(self, key, l=None, r=None):
self.key = key
self.l = l
self.r = r
def __repr__(self):
return "(" + str(self.key) + " " + str(self.l) + " " + str(self.r) + ")"
def preorder(root):
if root != None:
print(root.key, end=" ")
preorder(roo... | true |
446cda96cbb91b38611bcaa7bb9e1157034ebe7c | mayankchutani/ipinfo | /witch.py | UTF-8 | 824 | 2.609375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import re
def fetch_html(url):
print(url)
res = requests.get(url)
if res.status_code == 200:
return res.content.decode('utf-8')
else:
return '<html></html>'
def parse(body):
t = body.split('doreq();')[0].strip()
t = t.split('WITCH... | true |
83e41343321050f5e245f895bb14e325a30e0054 | anirudhRowjee/12th-school | /dhke.py | UTF-8 | 600 | 2.765625 | 3 | [] | no_license | # diffe hellman key exchange
# public domain
g = 5
n = 3
# protected data
class Alice():
def __init__(self):
global g
global n
self.privatekey = 2
self.
def show_public_key(self):
print(self.publickey)
def get_shared_secret(self, bob_publickey):
class B... | true |
ed7da8b0cc7c50895d388e4b01413650a6e6dffa | jcluq/PyCProcessing | /PyC Processing/S02_Mouse_click/S02_Mouse_click.pyde | UTF-8 | 3,541 | 4.0625 | 4 | [] | no_license | def setup():
size(800, 800)
background(255,0,0)
def draw():
'''#### Mouse Click
#############################################################################################################################
### Processing puede saber cuando se hace click y cuando se suelta el boton del mouse,es... | true |