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 |
|---|---|---|---|---|---|---|---|---|---|---|
3df9d76b0ebbaaf5ca5891d691c8b4a48c4306c7 | KristobalJunta/aoc | /2018/d07/p2.py | UTF-8 | 1,411 | 3 | 3 | [] | no_license | import operator
import re
class Worker:
finish = 0
task = ''
def __repr__(self):
return str([self.task, self.finish])
a = ord('A') - 1
num_workers = 2
workers = []
duration = 0
for _ in range(num_workers):
workers.append(Worker())
with open('input.txt') as infile:
lines = infile.readl... | true |
6e5e472c32cd18f9936cdfff1d0aa9395bce19b1 | mafei0728/python | /130.time模块/1.常用方法.py | UTF-8 | 668 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf8 -*-
# author:mafei0728
import time
#时间戳
#时间戳就是浮点数,1970到现在的秒
print(time.time())
#时间对象
t1 = time.localtime()
t2 = time.gmtime()
print(t1)
print(t1.tm_mday)
#时间对象到字符串时间
print('时间对象到字符串时间')
print(time.strftime("%F %X",time.localtime()))
print(time.asctime(time.localtime()))
#时间戳到... | true |
6fa426545a15e92797869951b8c856c62059988e | jawaff/CollegeCS | /CS111_CS213/Crapz/craps.py | UTF-8 | 2,121 | 4.09375 | 4 | [
"Apache-2.0"
] | permissive | """
Program: craps.py
Author(s): Jacob Waffle
Katy Phipps
Casey Blamires
Game of craps class (called Player)
The player is who plays the game, with simple methods such as getting the number
of rolls so far, and playing a simple game
1. Significant constants
None
2. The inputs are
The... | true |
712764fdc52f4e0bcab8dbab805b3621d470f598 | HanXM715/recognize-eye-fatigue | /Recognize-Eye-Fatigue.py | UTF-8 | 4,348 | 2.734375 | 3 | [] | no_license | import numpy as np
import cv2
import dlib
from scipy.spatial import distance
import os
from imutils import face_utils
import matplotlib.pyplot as plt
import winsound
def eye_aspect_ratio(eye):# 计算EAR
A = distance.euclidean(eye[1], eye[5])
B = distance.euclidean(eye[2], eye[4])
C = distance.euclidean(ey... | true |
6091446ebe0c6680a485594840e01b287f43e539 | RZachLamberty/FantasyFootball | /LeagueStats/TeamScoring.py | UTF-8 | 5,457 | 2.734375 | 3 | [] | no_license | ###############################################################################
# #
# TeamScoring.py #
# 10/25/2013 #
... | true |
de67031403565c853764a809efd51e327ab2fcd4 | xethorn/sukimu | /sukimu/schema.py | UTF-8 | 15,140 | 3.125 | 3 | [
"MIT"
] | permissive | """
Schemas
=======
Schemas defines the structure of the fields of your table. The schema handles
fields validations, and ensure index unicity. There are 5 main concepts around
the schemas:
**Indexes**
An index defines which key (or set of keys) should be unique within your table.
The schema will perform checks on t... | true |
cc7c8f44bf5e6483878523f478f6c47050eaa095 | Rydra/jumper-py | /src/interfaces.py | UTF-8 | 836 | 2.5625 | 3 | [] | no_license | from typing import Dict, Optional, Protocol
from grid import Grid
from node import Node
from properties import AgentCharacteristics, SearchOptions
class Heuristic(Protocol):
def __call__(self, nodeA: Node, nodeB: Node) -> float:
...
class CostEvaluator(Protocol):
def __call__(
self,
... | true |
35876d698025d697253fdc3e304ba34625fd0ad2 | Hugens25/School-Projects | /Python/countprimes.py | UTF-8 | 228 | 3.359375 | 3 | [] | no_license | #!/usr/bin/python3
nums = 100
primeCount = 0
for i in range(nums):
if isprime(i):
primeCount += 1
def isprime(num):
for a in range(sqrt(num)):
if num % a == 0:
return False
return True
| true |
776fd92c79779953a2bec19782ad4ff5ce3daae9 | Aasthaengg/IBMdataset | /Python_codes/p03254/s239234496.py | UTF-8 | 204 | 2.84375 | 3 | [] | no_license | N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
count = 0
for i in a:
if x < i:
break
x -= i
count += 1
else:
if x:
count -= 1
print(count) | true |
3fe450747ff1063628de91ae6fc11f85e40e1d14 | yournameherex337/lpthw | /ex3.py | UTF-8 | 1,321 | 4.375 | 4 | [] | no_license | # Learning about math operators, addition (+) subtraction (-) division (/) multiplication (*) modulus (%) greater than (>) less than (<) and so forth
# Prints out a string
print 'I will now count my chickens:'
# Print out string and an addition/division equation
print 'Hens', 25.0 + 30.0 / 6.0
# Print out a string an... | true |
d252539c85ea39a4232b1197d45a1e4f2d7caf77 | Prdcc/manim-Student-Shapers | /RealFunctions/InverseX.py | UTF-8 | 2,436 | 2.859375 | 3 | [
"MIT"
] | permissive | from manimlib.imports import *
import numpy as np
class Asymptotes(GraphScene):
CONFIG = {
"x_min" : -5.5,
"x_max" : 5.5,
"y_min" : -11,
"y_max" : 11,
"graph_origin" : ORIGIN ,
"function_color" : BLUE ,
"axes_color" : GREEN,
"center_point" : 0
} ... | true |
9fab3a0ff9c891d36ce03d54d7d0f21efc30d3cf | RealVNF/baseline-algorithms | /src/auxiliary/link.py | UTF-8 | 1,039 | 3.453125 | 3 | [] | no_license | import copy
class Link:
def __init__(self, a: str, b: str, **kwargs):
self.edge = (a, b)
self.attributes = {}
for key, value in kwargs.items():
self.attributes[key] = copy.deepcopy(value)
def __eq__(self, other):
if isinstance(other, Link):
return (self.... | true |
e81701ca053859f089b84cde1e0273410f6c2cb6 | Chyi341152/chyi-book | /generators/Non-Generator-Generator.py | UTF-8 | 975 | 3.1875 | 3 | [
"MIT"
] | permissive | import time
def timeit(func):
def timed(*args, **kwargs):
ts = time.time()
result = func(*args, **kwargs)
te = time.time()
if 'log_time' in kwargs:
name = kwargs.get('log-name', func.__name__.upper())
kwargs['log-time'][name] = int((te-ts) * 1000)
el... | true |
613bd698d2a4a0cf4a905a62c0cb61b198588a71 | justinrsmith/card-box | /backend/app/app/crud.py | UTF-8 | 521 | 2.515625 | 3 | [] | no_license | from sqlalchemy.orm import Session
from . import models, schemas
def get_card(db: Session, card_id: int):
return db.query(models.Card).filter(models.Card.id == card_id).first()
def get_cards(db: Session, skip: int = 0, limit: int = 100):
return db.query(models.Card).offset(skip).limit(limit).all()
def cr... | true |
6bfdc396179a9b61604819af40c23489b86ad203 | hit-zcc/IPOTools | /base/Queue.py | UTF-8 | 608 | 3.3125 | 3 | [] | no_license | import time
import threading
import queue
import random
q = queue.Queue
class Queue:
@classmethod
def putMessage(self, index, value):
q.put((index, index))
@classmethod
def getMessage(self):
while True:
if not q.empty():
print(q.get())
else:
... | true |
985dc8edd04c205612d5a9c6500ac35df397bb16 | DanielBrito/ufc | /Monitoria - Fundamentos de Programação/Lista 5 - Ítalo/exe19.py | UTF-8 | 263 | 4.375 | 4 | [] | no_license | # Lista 4 (Ítalo) - Questao 19
vet = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
cont = 0
num = int(input("Digite um numero: "))
for n in vet:
if n>num:
cont+=1
print(vet)
print("Existe(m) ", cont , " elemento(s) maior(es) que ", num) | true |
b44b67c2bad522b402b1c9ab100729a24848ed86 | LinuxLibrary/Python | /Py-4/py4sa-LA/programs/05-Decorators.py | UTF-8 | 922 | 3.21875 | 3 | [] | no_license | #!/usr/bin/python
# Author : Arjun Shrinivas
# Date : 03.05.2017
# Purpose : Usage of wrappers in Python
import time
import urllib2
def download_webpage():
url = 'http://linux-library.blogspot.in'
response = urllib2.urlopen(url, timeout = 60)
return response.read()
def elapsed_time():
t0 = time.time()
webpage = ... | true |
c709b2b708152d79ee5bde8df33675680563448b | rafaelperazzo/programacao-web | /moodledata/vpl_data/130/usersdata/199/44527/submittedfiles/al8.py | UTF-8 | 58 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
n= int(input('Digite o Valor: '))
| true |
8c7628962bb555bbea77bff6f74e7f81f5593cbd | kmdiogo/ScreepPack | /ScreepPack.py | UTF-8 | 6,331 | 2.609375 | 3 | [] | no_license | import os
import re
import json
import sys
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def generate_mappings(dir, separator, ignore_files):
listFiles = []
... | true |
1eb0d8d30898747f0698e42b5c37b045d624ab5a | giadac/WhoDoesMyHair | /app/whodoesmyhair.py | UTF-8 | 5,152 | 2.59375 | 3 | [] | no_license | info="""Flask view mapping for the WhoDoesMyHair app
"""
__author__ = "giadac"
__date__ = "20140911" # made
from flask import render_template
from flask import request
from app import app
import numpy as np
from nltk import FreqDist
import pdb
import operator
from app import load_db
import WilsonScoreInterv... | true |
9dcf51a28bc75da14c647d0a9aab06e66458b62a | MarkErickson02/Network_Stats | /Bandwidth_Monitor.py | UTF-8 | 1,923 | 2.875 | 3 | [] | no_license | # import matplotlib.animation as animation
# import matplotlib.pyplot as plt
# from matplotlib import style
import psutil
import socket
import time
# style.use("fivethirtyeight")
# fig = plt.figure()
# ax1 = fig.add_subplot(1, 1, 1)
# def animate(interval, total_network, time):
# ax1.clear()
# ax1.plot(total_netw... | true |
b9175e36f5245b3a14f7f16e73059e08aa8bf355 | ayushlalshrestha/python-basics | /from_courses/python3Advanced_draps_tv/Tutorial4 - Regular Expressions/simple_regex.py | UTF-8 | 652 | 2.765625 | 3 | [] | no_license |
import re
str = "chart count() device_name"
pattern = r'\w+'
keywords = re.findall(pattern, str)
list_of_queries = [
"chart count() by device_name, chart count device_name",
"device_name = \"Ayush\" ",
"time chart count(log_ts) by something device_name",
"chart count() device_name"
]
# pattern = r'(... | true |
da4e5f6e49ded6f17b6f65dbff1d0be57f1bec9e | obligate/python3-king | /it-king/day11_rabbitmq/03_持久化+公平分发_producer.py | UTF-8 | 2,034 | 3.25 | 3 | [] | no_license | # Author: Peter
# 1. 先启动消息生产者,然后再分别启动3个消费者,通过生产者多发送几条消息,你会发现,这几条消息会被依次分配到各个消费者身上
# 2. 队列持久化,不是消息持久化,需要在生产者和消费者队列声明的时候都需要加上, durable=True
# channel.queue_declare(queue='hello', durable=True)
# 3. 消息持久化,在生产者消息发布的时候加上delivery_mode = 2
# channel.basic_publish(exchange='',
# routing_key="task_que... | true |
16399e365517c05c19b3aec845d6945e926578d9 | PanarinM/php_academy_homeworks | /Rest_and_Forms/utils.py | UTF-8 | 344 | 2.625 | 3 | [] | no_license | import random
import string
import uuid
import os
def random_word(length):
return ''.join(random.choice(string.lowercase) for i in range(length))
def get_file_path(instance, filename):
ext = filename.split('.')[-1]
filename = "%s.%s" % (uuid.uuid4(), ext)
return os.path.join(instance.__class__.__nam... | true |
9493d20e915d51fedcc0b88a4e871fb6b264b99a | cr8ivecodesmith/basic-programming-with-python | /lpthw/ex6.py | UTF-8 | 757 | 4.84375 | 5 | [] | no_license | # Exercise 6: Strings and Text
x = 'There are %d types of people.' % 10
binary = 'binary'
do_not = "don't"
y = 'Those who know %s and those who %s' % (binary, do_not)
print(x)
print(y)
print('I said: %r.' % x)
print("I also said: '%s'." % y)
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
print... | true |
0265896a3383fe5d362b1b4a223d217ac75162e9 | jainnandini004/tathastu_week_of_code | /Day4/program1.py | UTF-8 | 209 | 3.890625 | 4 | [] | no_license | n=(int(i) for i in input("Enter elements in tuple").split())
z=tuple(n)
print(z)
m=int(input("Enter the number whose occurence you want to find "))
print("Occurence of m is ",z.count(m)," times in the tuple")
| true |
176313e0e2582fe6b233f8da58a0ce03cd697932 | lzxyzq/Cracking_the_Coding_Interview | /Cracking_the_Code_Interview/Leetcode/6.Binary_Tree/BST/235.Lowest_Common_Ancestor_of_a_Binary_Search_Tree.py | UTF-8 | 2,863 | 4.34375 | 4 | [] | no_license | # Algorithm
# 1.Start traversing the tree from the root node.
# 2.If both the nodes p and q are in the right subtree, then continue the search with right subtree starting step 1.
# 3.If both the nodes p and q are in the left subtree, then continue the search with left subtree starting step 1.
# 4.If both step 2 and ste... | true |
272f69e8ac568818d47bc25c4141e902e7dc77dd | rafaelblira/python-progressivo | /lista_nota.py | UTF-8 | 236 | 3.796875 | 4 | [
"MIT"
] | permissive | n = int(input("Numero de materias: "))
notas = []
soma=0
for count in range(n):
nota=float(input("Nota da materia %2d: " % (count+1)))
notas += [nota]
soma += nota
print("Notas: ",notas)
print("Media: %.2f" % (soma/n)) | true |
45ae6f68a2974a8c2c510a88aa8cf1c7fc07f5e1 | AlexanderTerp/stardew-valley-assistant | /GUI Edition/main.py | UTF-8 | 1,912 | 3.4375 | 3 | [
"MIT"
] | permissive | import window as w
import functions as f
import tkinter as tk
f.import_crops(f.data)
def add_checkbox(Frame, row, label, gained_gold, long_gold=None):
""" Given a seed and it's associated gold income, adds a checkbox to
Frame (middle_frame). """
if (long_gold != None):
right_label = "{:5.2f} ({:6.... | true |
6dc4dbb05f3350012f65202b98938f8e0eddb28f | hasandgursoy/Python_Zero_To_Hero | /7-Fonksiyonlar2/lamdaMethods.py | UTF-8 | 644 | 4.5 | 4 | [] | no_license | # LAMBDA FONKSİYONU : lambda
# Bazen, bir fonksiyonu isim vermeden direk kullanmak isteyebiliriz.
# lambda fonksiyonu (lambda expression) tek satır fonksiyonu olarak da bilinir.
# örn.
metin = "Selam Sana Kartal Gözü"
print(metin.split())
# Şimdi bir labda fonksiyonu ile split() fonksiyonu kullanalım
metni_parcala ... | true |
5d5a63dd1ed6532fbeceb52baaa02cbba589b6c0 | gabriellaec/desoft-analise-exercicios | /backup/user_116/ch35_2020_03_23_13_34_58_997858.py | UTF-8 | 139 | 3.203125 | 3 | [] | no_license | b=0
a=int(input("numero qualquer "))
resultado=int("0")
while a!=b:
resultado +=a
a=int(input("numero qualquer "))
print(resultado) | true |
38b042c4a611059ce813b9890374c50a2081de50 | saadhasanuit/Lab-04 | /question 1 (HW).py | UTF-8 | 659 | 3.921875 | 4 | [] | no_license | print("Muhammad Saad Hasan 18B-117-CS Section:-A")
print("9-NOV-2018")
print("LAB-04")
print("PROGRAMMING EXERCISE")
print("Question 1")
# Solving Quadratic Equation
value_1 = eval(input("Please enter the value of a:"))
value_2 = eval(input("Please enter the value of b:"))
value_3 = eval(input("Please enter the... | true |
d2052852de183565738dd7303ee71d6016856ebe | bhavya0529/Statistical-packages | /simpleliner.py | UTF-8 | 910 | 2.90625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
import pylab as pl
import numpy as np
from sklearn import linear_model
from sklearn.metrics import r2_score
df = pd.read_csv("FuelConsumption.csv")
df.head()
msk = np.random.rand(len(df)) < 0.8
train = cdf[msk]
test = cdf[~msk]
regr = linear_m... | true |
bd676ba81daf6655095795cd48a3b8377e4fd273 | lxtxl/aws_cli | /quicksight_write_2/resource_tag.py | UTF-8 | 1,135 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python
# -*- codding: utf-8 -*-
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from common.execute_command import write_two_parameter
# url : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/quicksight/tag-resource.html
if __name__ == '__m... | true |
0c8a1ea4a1422e406d0b1042484788d4445985a4 | Aasthaengg/IBMdataset | /Python_codes/p03262/s096406101.py | UTF-8 | 443 | 2.78125 | 3 | [] | no_license | from math import gcd
n, x = map(int, input().split())
m = [x]+list(map(int, input().split()))
m.sort()
if n==1:
print(m[1]-m[0])
else:
res = gcd(m[1]-m[0], m[2]-m[1])
for i in range(1, n-1):
a = m[i+1]-m[i]
b = m[i+2]-m[i+1]
if res >= gcd(a,b):
if res%gcd(a,b)==0:
res = gcd(a,b)
... | true |
9ae598a5db36aed4cb25ece5683caf2109bedfbe | johhnnydev/hackerrank-solutions | /mini_max_sum.py | UTF-8 | 714 | 3.453125 | 3 | [] | no_license | #!/bin/python3
import os
import sys
#
# Complete the miniMaxSum function below.
#
def miniMaxSum(arr):
sums = []
# get the sum without the first number
sums.append(arr[1]+arr[2]+arr[3]+arr[4])
# get the sum without the second number
sums.append(arr[0]+arr[2]+arr[3]+arr[4])
# get the sum withou... | true |
0cd7fa3dd399297d260f73b617dd26c80415807a | kytos/of_core | /utils.py | UTF-8 | 5,868 | 2.625 | 3 | [
"MIT"
] | permissive | """of_core utility functions and classes."""
import struct
from collections import OrderedDict
from pyof.foundation.exceptions import PackException, UnpackException
from pyof.v0x01.common.header import Type as OFPTYPE
from kytos.core import KytosEvent
def of_slicer(remaining_data):
"""Slice a raw `bytes` insta... | true |
1a9c3085d57a433261ea24404b56278be285d1c5 | TimothyHeath/EulerPython | /PanSteps.py | UTF-8 | 1,998 | 3.65625 | 4 | [] | no_license | #Euler Project 178 - Timothy Heath
BASE = 10
LENGTH = 40
#Find the number of base BASE pandigital numbers with at most LENGTH digits
import copy
def extend(old_paths):
#find number of different path types one longer than old_paths
new_paths = copy.deepcopy(old_paths)
#mid_paths turn to bot_paths and top_paths turn ... | true |
d67627dd68e45c4c5a0c66e2736ad359d9274cdd | Duenwege2312/CTI110 | /P3T1_AreasOfRectangles_EthanDuenweg.py | UTF-8 | 922 | 4.8125 | 5 | [] | no_license | # Rectangle Area Calculator
# 2/25/20
# CTI-110 P3T1- Areas of Rectangles
# Ethan Duenweg
# First we need to get the rectangle dimensions from the user
print("Rectangle Area Calculator")
h1 = int(input("What's the height of the rectangle 1?"))
w1 = int(input("Whats the width of rectangle 1?"))
h2 = int(inp... | true |
eb7c93b9d8b6a2bc3c099fc7cb1db5a38afc488b | jackteversham/Evolutionary-Ping-Pong | /utils.py | UTF-8 | 4,440 | 2.8125 | 3 | [] | no_license | from functools import reduce
import numpy as np
BALL_VALUE = 250 # arbitrary non-zero val in uint8 range. Higher numbers are lighter (grayscale) colours
PADDLE_VALUE = 150
def extract_intertial_feat(frame, prev_frame):
curr_pos = []
prev_pos = []
paddle_y_curr = []
paddle_y_prev = []
def get_cen... | true |
1e8f515e07474c2a8637e5c6d0b22f9881cf856c | uililo/fine-grained-ZSL | /attribute_extractor.py | UTF-8 | 2,183 | 2.78125 | 3 | [] | no_license | import torch.nn as nn
import torch
class AttributeNet(nn.Module):
def __init__(self, pretrained_model, attribute_dim, embedding_dim):
super().__init__()
self.pretrained = pretrained_model
self.emb_dim = embedding_dim
self.attr_dim = attribute_dim
self.fc = nn.Linear(2048, ... | true |
14b84759d769f7f3ebddef1d361621224145357e | goareum93/K-digital-training | /01_Python/11_set/set.py | UTF-8 | 772 | 3.78125 | 4 | [] | no_license | # set
# s1 = set()
# print(type(s1))
# s1 = {3, 5, 7, 1, 3, 4}
# print(s1)
#
# # s2 ={[10, 20, 40]}
# s2 = {(10, 20, 40)}
# print(s2)
#
# # 인덱스 사용 불가
# # s1[0]
#
# # 데이터 추가 .add()
# s2.add(90)
# print(s2)
#
# s1.add(-9)
# print(s1)
#
# # 데이터삭제 .remove()
# s1.remove(-9)
# print(s1)
# #s1.remove(8) # 값이 에러 발생
# print(s... | true |
fefc0bb95cb50255402b11a7b8da67b1ab9cfc84 | vinayaknatarajan/Pacman-Search-Algorithms | /Informed Search/pacmanAgents.py | UTF-8 | 7,537 | 2.75 | 3 | [] | no_license | # pacmanAgents.py
# ---------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley... | true |
f31521e881fb030d2303f284b948cf583f800255 | fagan2888/gradient_descent | /functions.py | UTF-8 | 2,002 | 3.078125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
def rosenbrock(x):
f = 100*(x[1] - x[0]**2)**2 + (1 - x[0])**2
return f
def rosenbrock_jac(x):
fx = 400*x[0]**3 - 400*x[0]*x[1] + 2*x[0] - 2
fy = 200*(x[1] - x[0]**2)
return np.arr... | true |
6303b9548ed0126b4eb6818652cade343bb4918b | ongaaron96/kattis-solutions | /python3/1_3-pet.py | UTF-8 | 204 | 3.578125 | 4 | [] | no_license | max_points = -1
winner_num = -1
for i in range(5):
points = sum(map(int, input().split()))
if points > max_points:
max_points = points
winner_num = i + 1
print(f"{winner_num} {max_points}")
| true |
2be553db22d6293044d152e953b946f653ec7997 | limonovandrey/codacademy_answer | /Python syntax/10_13.py | UTF-8 | 102 | 2.625 | 3 | [] | no_license | count_to = 1234567890 + 9876543210 # Set count_to equal to the sum of two big numbers
print count_to
| true |
bf53ef10ee505fc07b9832daf96f7c72b26b08b9 | Panther010/python_algos | /Stack_Queue/Queue_using_Stack.py | UTF-8 | 420 | 3.625 | 4 | [] | no_license | # Python script to implement queue using stack
class Queue2Stacks(object):
def __init__(self):
# two stack
self.in_stack = []
self.out_stack = []
def enqueue(self, value):
self.in_stack.append()
def dequeue(self):
if not self.out_stack:
while self.in_st... | true |
4f398f6b047a99df4aec30b3cca9f1c258ab80f6 | ezanardi/pyqha | /examples/example1/example1.py | UTF-8 | 571 | 2.984375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#encoding: UTF-8
"""
This is a simple example of fitting the total energy E as a function of the volume
with the Murnaghan EOS.
"""
if __name__ == "__main__":
from pyqha import fitEtotV, plot_EV
fin = "./EtotV.dat" # file with the total energy data E(V)
V, E, a, chi2 = fitEt... | true |
eb52328ba0543a82806eb521dbab19de238776f9 | justinsvegliato/safe-metareasoning | /printers/task_process_printer.py | UTF-8 | 2,190 | 3.65625 | 4 | [] | no_license | def print_states(task_process):
print("States:")
for index, state in enumerate(task_process.states()):
print(f" State {index}: {state}")
def print_actions(task_process):
print("Actions:")
for index, action in enumerate(task_process.actions()):
print(f" Action {index}: {action}")
... | true |
e73f2969180e71cf0aec1c2fd7304124429d1bc3 | xiuyanw/python | /pm_ssh1.py | UTF-8 | 383 | 2.8125 | 3 | [] | no_license | import paramiko
ssh=paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname='192.168.1.112',username='root',password="123456")
a=ssh.exec_command('ls /abc')
print(len(a)) #a是由类文件对象组成的元组,分别是输入,输出,错误
out=a[1].read()
error=a[2].read()
print(out.decode('utf8'))
print(error.decod... | true |
4594e3dee1136fab12c006c89542beade96563ce | BravoMao/WebSpider | /ZhihuSpider/visualisation.py | UTF-8 | 2,800 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#encoding:utf-8
from matplotlib import pyplot as plt
import numpy as np
def plotPie4Gender(dics):
plt.figure(figsize=(6,9))
labels = getLables(dics)
sizes = getSizes(dics)
colors = ['red','yellowgreen','lightskyblue']
explode = (0.05,0,0)
patches,l_text,p_text = plt.pie... | true |
d340c4b5afe52e35c763eb493e9b22c4baa2e8b5 | quantbruce/leetcode_test | /数据结构相关/树/560. 和为K的子数组.py | UTF-8 | 1,193 | 3.765625 | 4 | [] | no_license | 560. 和为K的子数组
给定一个整数数组和一个整数 k,你需要找到该数组中和为 k 的连续的子数组的个数。
示例 1 :
输入:nums = [1,1,1], k = 2
输出: 2 , [1,1] 与 [1,1] 为两种不同的情况。
说明 :
数组的长度为 [1, 20,000]。
数组中元素的范围是 [-1000, 1000] ,且整数 k 的范围是 [-1e7, 1e7]。
################方法1 最优法:前缀和(利用字典)
"""
执行用时 :
56 ms
, 在所有 Python3 提交中击败了
96.16%
的用户
内存消耗 :
16.2 MB
, 在所有 Python3 提交中击败了
11.1... | true |
d71861fc9610cb6eca8c2274938c75c526b74196 | chqlee/GraphGallery | /graphgallery/transforms/adj_transform/add_selfloops.py | UTF-8 | 2,368 | 3.109375 | 3 | [
"MIT"
] | permissive | import numpy as np
import scipy.sparse as sp
from graphgallery.transforms import Transform
from graphgallery.utils.type_check import is_list_like
from graphgallery.utils.shape import repeat
from graphgallery.utils.decorators import MultiInputs
class AddSelfLoops(Transform):
"""Add self loops for adjacency matrix.... | true |
7a7aa8d7368bbb71c2d6e1156d97de5150f37679 | xudd/xudd | /xudd/demos/simple_robotscanner.py | UTF-8 | 6,114 | 3.21875 | 3 | [
"Apache-2.0"
] | permissive | """Robot Scanner XUDD test demo... simplified.
This is like xudd/demos/robotscanner.py but simplified considerably...
there's only one room, and any print statements happen inline rather
than being passed to the overseer.
If you want to see a much more complex demo, see robotscanner.py.
Also see the docstring of that... | true |
e96bfe1a2030db3e332113f6dfcd493ed971c547 | andreiapostol/JavaDeobfuscation | /read.py | UTF-8 | 588 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
import os
import sys
from graph_pb2 import Graph
from graph_pb2 import FeatureNode
def main(path):
with open(path, "rb") as f:
g = Graph()
g.ParseFromString(f.read())
token_count = len(list(filter(lambda n:n.type in
(FeatureNode.TOKEN,
... | true |
3724a774645a35d094f8ae25ad669322d06aab23 | Shaunwei/Leetcode-python-1 | /Tree/MaximumDepthOfBinaryTree/maxDepth1.py | UTF-8 | 923 | 3.625 | 4 | [] | no_license | #!/usr/bin/python
"""
Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along
the longest path from the root node down to the
farthest leaf node.
"""
from sys import path as path1; from os import path as path2
path1.append(path2.dirname(path2.dirname... | true |
ecc5986ee65bda6a48299d3b1dbdcadbe991e7a6 | akorunska/x.teams | /module-1/pitcoin/pitcoin/storage_handlers/chain.py | UTF-8 | 1,651 | 2.625 | 3 | [] | no_license | from pitcoin.block import Block
from pitcoin.transaction import Deserializer, Transaction
from pitcoin.transaction.tx_validator import check_tx_validity
import pickle
from pathlib import Path
from pitcoin import PROJECT_ROOT
class BlocksStorage:
def __init__(self, filepath=PROJECT_ROOT+'/storage/.blocks.txt'):
... | true |
e8ee340954c8468d4d43f57c418f178a60413b10 | letscodedjango/py-selenium | /pyselenium/amazon_products.py | UTF-8 | 3,247 | 2.828125 | 3 | [] | no_license | from selenium import webdriver
import time
from time import sleep
driver = webdriver.Chrome(executable_path="/Users/gaurnitai/Desktop/PySelenium/drivers/chromedriver")
driver.get("https://www.amazon.in")
driver.maximize_window()
page_title = driver.title
print(page_title)
search_box = driver.find_element_by_id("... | true |
9d66c8a88fe76a22a8347702252456beafa9c4b2 | rezanm2/iscript | /week 3/s1101951-Reza-Naser-SE-Week3/Territoriale wateren.py | UTF-8 | 1,151 | 3.859375 | 4 | [] | no_license | import math
def berekenVoetpunt():
x1=float(input('Invoer x1: '))
y1= float(input('Invoer y1: '))
x2=float(input('Invoer x2: '))
y2=float(input('Invoer y2: '))
x3=float(input('Invoer x3: '))
y3=float(input('Invoer y3: '))
#een array coordinaten met de punten
puntenArray = [[0,12],[12... | true |
89340df2241f27d74db9db9ca82bc39012f3634d | xqzhu/aporeto | /Samples/problem2/uniquify.py | UTF-8 | 5,204 | 3.0625 | 3 | [] | no_license | import sys
import re
import os
def Merge_Sort(inputfile, outputfile, appendix, minFileSize, showMessage):
fileLength = os.path.getsize(inputfile)
fr = open(inputfile, 'r')
fo = open(outputfile, 'w')
# If inputfile's size is less then minFileSize:
# Then copy fr to fo while deleting duplicates at t... | true |
a2fa7cb1ff7ba6f1c37f98a6411ecff02fc3bcd8 | flupke/pyflu | /pyflu/setuptools/cython.py | UTF-8 | 3,352 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | import os
from os.path import splitext, getmtime, isfile
from pyflu.setuptools.base import CommandBase
from pyflu.path import iter_files
from setuptools import setup, find_packages, Extension
class CompileCythonCommand(CommandBase):
description = "compile all cython files"
user_options = [
("i... | true |
c8df9927ac96adef1f054a8c009c94112f8cbde4 | PaulLandaeta/couchdb-cluster | /src/copies.py | UTF-8 | 1,007 | 2.828125 | 3 | [] | no_license | import json
import requests
import utils.constants as cons
from requests.models import HTTPBasicAuth
def read_movies():
with open('data/movies.json') as f:
movies = json.load(f)
return movies
def store_copies():
movies = read_movies()
for movie in movies:
#TODO: create random number ... | true |
07d7760585e678e34b8c258b972685b46d1f5731 | chaeyeonp/pre-education | /quiz/algorithm_quiz4.py | UTF-8 | 1,200 | 4.125 | 4 | [] | no_license | '''
4.
탐욕 알고리즘은 최적해를 구하는 상황에서 사용하는 방법입니다.
여러 경우 중 하나를 선택할 때 그것이 그상황에서 가장 좋다고 생각하는 것을
선택해 나가는 방식으로 진행하여 답을 구합니다.
하지만 탐욕알고리즘은 그 상황에서 가장 좋다고 생각하는 것을 선택해 나가는
방식이기 때문에 가장 좋은 결과를 얻는 것이 보장되는것은 아닙니다.
탐욕 알고리즘을 이용하여 동전을 지불하는 함수(greedy)를 짜는데 지불해야 하는
동전의 갯수가 최소가 되도록 함수를 구현하시오
(input 으로 액수와 동전의 종류를 입력하게 구현)
<입력>
print(greedy())
<... | true |
63b7065c50a6b0be775d558e23cf052cc33210a9 | skkmurthy/dup_finder | /Directory.py | UTF-8 | 17,738 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
import os.path
import Logger
try:
from os import scandir
except ImportError:
from scandir import scandir
from time import strftime, localtime
import ntpath
import hashlib
from enum import IntEnum
import pprint
from shutil import copyfile
import time
class Fingerprint:
def __init__(self,... | true |
e1e7e296f5cd6e837dc686efd57cd777935cc231 | kennknowles/python-rightarrow | /setup.py | UTF-8 | 881 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | import setuptools
import sys
import os.path
import subprocess
# Build README.txt from README.md if not present
if not os.path.exists('README.txt') and 'sdist' in sys.argv:
subprocess.call(['pandoc', '--to=rst', '--smart', '--output=README.txt', 'README.md'])
# But use the best README around
readme = 'README.txt'... | true |
0bed5295232b1d797fd540b27a2c67765b63e50e | bitcores/adventofcode2016 | /d18.py | UTF-8 | 777 | 3.109375 | 3 | [] | no_license |
#inp = '.^^.^.^^^^'
inp = '^.^^^..^^...^.^..^^^^^.....^...^^^..^^^^.^^.^^^^^^^^.^^.^^^^...^^...^^^^.^.^..^^..^..^.^^.^.^.......'
trows = 40
rows = []
row = []
row.append('.')
for x in inp:
row.append(x)
row.append('.')
rows.append(row)
for y in range(0,trows-1):
row = []
row.append('.')
... | true |
7c792575b8b4f2ef036a724f4db88201829eab56 | hult/github-open | /gh-open | UTF-8 | 794 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import os
import subprocess
import sys
import webbrowser
REPO_URL = "https://github.com/%(repo)s/tree/%(branch)s"
def run_command(command):
return subprocess.Popen(command, stdout=subprocess.PIPE, shell=True).communicate()[0]
def repo():
output = run_command("git remote -v | grep -E '^... | true |
aaff990fcc1a34f23f059682098dfc62c8c09046 | fectkai/stock_pred | /nets.py | UTF-8 | 4,262 | 2.671875 | 3 | [] | no_license | import torch
from torch import nn
from torch.autograd import Variable
import torch.nn.functional as F
class SimpleLSTM(nn.Module):
def __init__(self, input_size, hidden_size, num_layers = 2):
super(SimpleLSTM, self).__init__()
self.lstm = nn.LSTM(input_size, hidden_size, dropout = .5, num_layers... | true |
e9825c50b5101c6160fcb25ab0de4a0035dfb925 | New-generation-hsc/PPractice | /model/predict.py | UTF-8 | 712 | 2.65625 | 3 | [] | no_license | import numpy as np
from sklearn.externals import joblib
from load import loaddata
from feature import extractfeature
def testmodel(filepath):
"""
according to the image feature, predict the img label
"""
print("test model....")
images, tags = loaddata(filepath)
feature_info = extractfeature(im... | true |
adbc644dfbdeac689d3d5d70b3bc9ee6e8e868e8 | Messinias1/Harvard-CS_50 | /week_6/caesar.py | UTF-8 | 730 | 3.4375 | 3 | [] | no_license | from cs50 import get_string
import sys
def main():
if len(sys.argv) != 2:
print("Usage: python key")
exit(1)
key = int(sys.argv[1])
if key < 0:
printf("Key must be a positive number")
exit(1)
plaintext = get_string("plaintext: ")
print("ciphertext: ", end="")
... | true |
074aa7e849071822152bdeec231654f9ac9a1369 | manikandaj/python-program | /beginners/positive or negative.py | UTF-8 | 105 | 3.140625 | 3 | [] | no_license | a=int(input("value="))
if (1<=a<=100000):
print('positive')
else:
print('zero')
| true |
b33f0e57884700a2bcb472aeda10e297557a568e | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_200/3128.py | UTF-8 | 418 | 2.890625 | 3 | [] | no_license | t=input()
m=1
while m<=t:
n=input()
k=list(str(n))
ind=-1
for i in xrange(len(k)):
if i!=len(k)-1:
if k[i]>k[i+1]:
if i==0:
k[i]=str(int(k[i])-1)
ind=1
else:
while i!=0 and k[i-1]==k[i]:
i-=1
k[i]=str(int(k[i])-1)
ind=i+1
break
if ind!=-1:
... | true |
fb161d5872eb5eaba73b51c41eead7e0d5dc7e7b | Vaibhav3M/Coding-challenges | /2-BSTCLosestValue/closestvalue.py | UTF-8 | 1,837 | 3.6875 | 4 | [] | no_license |
import sys
def closest_value(t, target):
print(closest_helper(t.root,target,sys.maxsize))
def closest_helper(node,target,closest):
if node == None:
return closest
if abs(node.val - target) < abs(target - closest):
closest = node.val
if (target < node.val):
return... | true |
ec91a7f94273aa71f974688899ba13f1c259af47 | xinge666/sar_test | /feature/feature_prepare.py | UTF-8 | 8,684 | 2.75 | 3 | [] | no_license | import sys
sys.path.append(sys.path[0] +"/..")
sys.path.append(sys.path[0])
import numpy as np
import pandas as pd
import utils.file_wav as file_wav
from utils.data_set_op import Chinese2Pinyin
from utils.dir_op import get_file_name_ls_from_dir,get_child_dir_ls_from_dir,\
get_file_dict_for_different_type
import j... | true |
ece466ed76fae98ae2736fba377a3d3ddc5896bf | joinbu/python_study | /功能实现(function)/数据处理(data processing)/分解字符串,取代字符.py | UTF-8 | 303 | 3.984375 | 4 | [] | no_license |
A = 'abc'
for i in A:
print(i)
#拓展
#取代单类字符,用X取代字符串中的a字符
A = 'abc'
for i in A:
if i == 'a':
A = A.replace(i,"X")
print(A)
#取代某些字符,用X取代字符串中的ab字符
A = 'abc'
B = 'ab'
for i in A:
if i in B:
A = A.replace(i,"X")
print(A)
| true |
18e88bcc36b8a632ab13982dd789095744d3b8b0 | good-data-foundation/data-api | /data_loader/s3_data_loader.py | UTF-8 | 998 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | from typing import Dict
from io import StringIO
import boto3
import pandas as pd
from data_loader import BaseDataLoader
class S3DataLoader(BaseDataLoader):
def _load(self, config: Dict):
# create aws client object
s3_client = boto3.client(service_name=config['server_name'],
... | true |
e9f47f7ea23a2c087999860367b66a2f80dec714 | haohmal/WebCalendar | /Topics/Json module/JSON input/main.py | UTF-8 | 145 | 2.90625 | 3 | [] | no_license | import json
# write your code here
json_input = input()
python_object = json.loads(json_input)
print(type(python_object))
print(python_object) | true |
4cf42958246d5f838c48fdec54f0e4d363ae354b | kimjy392/exception | /백준/test.py | UTF-8 | 984 | 3.109375 | 3 | [] | no_license | def solution(p):
def recur(string):
if string == '':
return ''
u, v = '', ''
for i in range(len(string)):
word = string[i]
u += word
if u and u.count('(') == u.count(')'):
break
v = string[i + 1:]
tmp = []
... | true |
e98462201a7d5ad97602613cac3780f1af532aad | bdemin/daily-coding-problem | /P39_game_of_life.py | UTF-8 | 3,829 | 4.34375 | 4 | [
"MIT"
] | permissive | # Conway's Game of Life takes place on an infinite two-dimensional board of square cells.
# Each cell is either dead or alive, and at each tick, the following rules apply:
# Any live cell with less than two live neighbours dies.
# Any live cell with two or three live neighbours remains living.
# Any live cell with mor... | true |
a70c7e8905859da13cb25074270f857476118c6f | hirajanwin/LeetCode-5 | /1411. Number of Ways to Paint N × 3 Grid/main.py | UTF-8 | 291 | 2.53125 | 3 | [
"MIT"
] | permissive | class Solution:
def numOfWays(self, n: int) -> int:
c3, c2 = 6, 6
p = 10 ** 9 + 7
t = 0
for i in range(2, n+1):
t = c3
c3 = (2 * c3 + 2 * c2) % p
c2 = (2 * t + 3 * c2) % p
res = (c3 + c2) % p
return res
| true |
86edb7db99fea6b8c417cdca44ed86652effb507 | gelang93/neural-nlp | /visualization/curves.py | UTF-8 | 3,226 | 2.5625 | 3 | [] | no_license | from visualizer import Visualizer
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class LearningCurveVisualizer(Visualizer):
@property
def learning_curves(self):
if self.num_exps == 0:
return
nrows = np.ceil(self.num_exps / 3.).astype(np.int)
scali... | true |
5f700c196e441fcbf03be133d3ca7f6bd992989c | VaibhavBajaj/BadmintonBot | /cogs/general.py | UTF-8 | 4,486 | 2.53125 | 3 | [] | no_license | import asyncio
import traceback
from typing import Union
import discord
from discord.ext import commands
from helpers.exceptions import TIMEOUT
from helpers.scheduler import Scheduler
# GeneralCog holds all the general commands that the bot handles
class GeneralCog(commands.Cog, name='General'):
def __init__(se... | true |
563fb530ab79ac8c300d54f8dbdb6300aa6d2820 | pblischak/polyploid-demography | /supp/plot_polyploid_continuum.py | UTF-8 | 1,669 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
import dadi
import dadi.NLopt_mod
import matplotlib
import matplotlib.pyplot as plt
# Defining demographic model
def segtetraploid_iso(params, ns, pts):
"""
params = (nu,T1,T2,dij)
ns = (n1,n2)
Split into two populations of specifed size.
nu: Size of populations after spl... | true |
81ace12814b6911c1fb7562f3e0144f651d25854 | Priya1705/Movie_Recommendation_System | /index.py | UTF-8 | 3,260 | 2.6875 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import LabelEncoder
from sklearn import svm
import matplotl... | true |
c8e489f44e802f2fa84a50f01da04d3ee790b5e4 | hyunhee7/python_work | /Django03_CRUD/member/views.py | UTF-8 | 2,601 | 2.78125 | 3 | [] | no_license | #-*- coding: utf-8 -*-
from django.shortcuts import render
from member.models import Member
from django.http.response import HttpResponseRedirect
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
# Create your views here.
def list(request):
contact_list = Member.objects.all()
paginator ... | true |
335bb5449bbe791525bc79e84c4530721eab9339 | alf808/rps-game | /rps_game.py | UTF-8 | 2,129 | 4.90625 | 5 | [] | no_license | """
Rock-Paper-Scissors Game
Code a game of rock paper scissors.
## Instructions
* take in a number 0-2 from the user that represents their hand
* generate a random number 0-2 to use for the computer's hand
* call the function `get_hand` to get the string representation of the user's hand
* call the function `get_ha... | true |
287f71a02b83c2b21f11c0217e293f28e1e4e2ac | aicioara/dotfiles | /src/home/.scripts/dropbox.py | UTF-8 | 297 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import os
startCommand = "dropbox start"
stopCommand = "dropbox stop"
os.system(startCommand)
try:
print "ctrl + c to close"
while True:
raw_input()
except KeyboardInterrupt:
print "Stopping Dropbox..."
os.system(stopCommand)
print "Dropbox stopped"
| true |
aedcd25da2d2fa9c6da337803c00be02699c9b38 | joeltio/mini-maze-django | /mini_maze/test_players_json.py | UTF-8 | 2,078 | 2.921875 | 3 | [
"MIT"
] | permissive | from django.test import TestCase
from settings import *
from setup import reset_all
import json
class PlayersJSONTest(TestCase):
def setUp(self):
reset_all()
with open(players_json_filename, "r") as f:
self.players_json = json.load(f)
with open(maze_json_filename, "r") as f:... | true |
d70bada78050fd340e9eb19edbffff6bed3b54c1 | feng-hui/python_books_examples | /fluent_python/chapter_17/ch17_flags_processpool.py | UTF-8 | 823 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding:utf-8 -*-
# @author FH
# @email: capricorn1203@126.com
# @time: 2019/1/22 17:57
from concurrent import futures
from chapter_17.ch17_flags import save_flag, main, get_flag, get_one, show
def download_one(url):
img = get_one(url)
file_name = url.split('/')[-1]
show(file_name... | true |
2c433e2b2a76ea5688a8f04688d28e9a152d658e | cloud2010/dl-models | /rulefit-k-fold-multi-run.py | UTF-8 | 5,404 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
This a implementation of the rulefit algorithm for predict bio datasets with kfold cross-validation.
Derived from: Christoph Molnar
Source: https://github.com/christophM/rulefit
Date: 2019-01-03
"""
import os
import time
import numpy as np
import pandas as pd
from multiprocessing import curr... | true |
89677a8d4df8a8e2bdc15ffac43f6cd34923a767 | fnqn/lphython27 | /list_001.py | UTF-8 | 125 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
L = []
n =1
while n <= 99:
L.append(n)
n = n + 2
print L
| true |
887d4d4e9dd2ed4245be7364773251d590588f88 | dhann4/Tutorial-Python-tkinter | /A. Module di dalam tkinter/#16 Border/border.py | UTF-8 | 910 | 3.171875 | 3 | [] | no_license | '''
16. Border berguna untuk menjadikan tampilan dalam widget menjadi lebih hidup
'''
from tkinter import *
root = Tk()
root.geometry('200x200')
label1 = Label(root, text='label1', bg = 'powder blue', fg = 'black',
font=('URW Gothic L',14,'bold'), relief = RIDGE, bd = 10)
label2 = Label(root, text='la... | true |
8ad85d7322e9a410bba21e307d983e427edc7316 | Noname-RFV/Py_reprease | /untitled5/test.py | UTF-8 | 1,011 | 2.96875 | 3 | [] | no_license | import pygame
win_h=500
win_w=1000
window=pygame.display.set_mode((win_w,win_h))
run=True
clock=pygame.time.Clock()
ball_x=200
ball_y=200
speed_x=2
speed_y=2
ball_r=50
rect_x=0
rect_y=0
rect_w=30
rect_h=150
while run:
clock.tick(30)
window.fill((255,0,63))
keys=pygame.key.get_pressed()
... | true |
a0b1f42536a37164fb80eebcb3aa67e73881523a | alliefitter/boto3_type_annotations | /boto3_type_annotations_with_docs/boto3_type_annotations/connect/paginator.py | UTF-8 | 25,364 | 2.640625 | 3 | [
"MIT"
] | permissive | from typing import Dict
from typing import List
from datetime import datetime
from botocore.paginate import Paginator
class GetMetricData(Paginator):
def paginate(self, InstanceId: str, StartTime: datetime, EndTime: datetime, Filters: Dict, HistoricalMetrics: List, Groupings: List = None, PaginationConfig: Dict =... | true |
c73b6ea8dd1b913c553ac534395c16789d17ed1a | bbglab/adventofcode | /2017/iker/day11.py | UTF-8 | 2,859 | 4.0625 | 4 | [
"MIT"
] | permissive | """
--- Day 11: Hex Ed ---
Crossing the bridge, you've barely reached the other side of the stream when a program comes up to you, clearly in distress. "It's my child process," she says, "he's gotten lost in an infinite grid!"
Fortunately for her, you have plenty of experience with infinite grids.
Unfortunately for ... | true |
15f1532ac4c9eae354ef9691c6b72cfbcce9a190 | Aasthaengg/IBMdataset | /Python_codes/p02851/s352976730.py | UTF-8 | 510 | 2.96875 | 3 | [] | no_license | import collections
N, K = map(int, input().split())
A = list(map(int, input().split()))
table = collections.defaultdict(int)
ans = 0
s = [0]*(N+1)
a = set()
for i in range(N):
s[i+1] = s[i]+A[i]
s = [(s[i]-i) % K for i in range(N+1)]
for i in range(N+1):
ans += table[s[i]] # i番目まで取る組み合わせの数
table[s[i]] +=... | true |
aec230f66b981af8cfc8290c03d329fcac1e3aaf | ChillarAnand/just-queue-it | /retry.py | UTF-8 | 873 | 2.71875 | 3 | [] | no_license | import random
import time
from celery import Celery, task
app = Celery(backend='amqp', broker='amqp://')
def run_task(n):
try:
time.sleep(2)
number = random.randint(0, 9)
if number in [2, 3]:
raise Exception
print("Task {0} Success".format(n))
except Exception:
... | true |
3d8dcba0da55d1fae60bfdb3886647215744a2fb | CatalinConstantin94/projects | /blackjack_v1.py | UTF-8 | 566 | 3.890625 | 4 | [] | no_license | import random
lt = [2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 11, 12, 13, 14]
xlist = []
while True:
x = random.choice(lt)
print(x)
xlist.append(x)
print("the total is", sum(xlist))
if sum(xlist) < 21:
xcont = input("Do you want to continue?")
if xcont == "y":
c... | true |
c8ccdabff4f038c8207f71ee24c1d791dc3281c1 | markk628/tweet-gen-heroku | /app.py | UTF-8 | 772 | 2.515625 | 3 | [] | no_license | from flask import Flask, render_template
from histogram import dic_histogram
from sample import read, random_word
from markovchain2 import run_generator
import dictogram
import os
app = Flask(__name__)
# @app.route('/')
# def index():
# source_text = 'test.txt'
# word_list = read(source_text)
# words_lis... | true |
83824acdf9a864fed11cac1a6ec12d80cd550517 | INCF/ids-tools | /bin/ids-event-logger | UTF-8 | 13,362 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
# -*- python -*-
import os
import sys
import signal
import errno
import time
from datetime import datetime
# Don't actually write log files.
debug = 0
# top-level directory location for the event log files.
log_dir = '/tmp/ids_audit_logs'
# desired ISO 8601 date/time format
iso_8601_fmt = '%Y%... | true |