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 |
|---|---|---|---|---|---|---|---|---|---|---|
99c80edcf6990b91aa0c7b6676043554ea92bc69 | nathanielatom/Gravity-Well | /SliderWidget.py | UTF-8 | 9,318 | 3.046875 | 3 | [] | no_license | import pygame
from pygame.locals import *
SLIDER_WIDGET_CLICK = USEREVENT + 2
class SliderWidget(object):
# Hand Cursor
__hand_cursor_string = (
" XX ",
" X..X ",
" X..X ",
" X..X ",
" X..XXXXX ",
" X..X..X.XX... | true |
632440e2eeb4254841d2d411b390bb38ae6056df | LRCJ/SpiderBilibili | /MyFunc.py | UTF-8 | 16,477 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from urllib import request, error, parse
import os, time, json, mysql.connector,logging
########## 配置日志记录 ##########
logging.basicConfig(format='%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s',
level=logging.DEBUG,filename="log.txt",filemode="... | true |
1238cf4f9c3406422aedef811611e89f440e25bb | planzcg/ragdolize | /physics/simulation.py | UTF-8 | 3,619 | 2.75 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""Particle system main simulation core
MIT License
Copyright (c) 2020 Mauro Lopez
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 ... | true |
01dafba48cfb172f7a4a56a08791685a10ae84fd | carlzhangweiwen/python-01-utilities | /image/images02.py | UTF-8 | 1,089 | 3.578125 | 4 | [] | no_license | # import required classes
from PIL import Image, ImageDraw, ImageFont
# create Image object with the input image
image = Image.open('mountain-road-1556177_1920.jpg')
# initialise the drawing context with
# the image object as background
draw = ImageDraw.Draw(image)
# create font object with the font file an... | true |
11dc8629915d7cc9c3d9840b590ba749cf2122d8 | stevepentland/swarmer | /jobs/runner.py | UTF-8 | 2,455 | 2.609375 | 3 | [
"MIT"
] | permissive | import json
import ulid
from jobs.queue import JobQueue
from log import LogManager
from wrapper import DockerWrapper
class JobRunner:
def __init__(self, client: DockerWrapper, job_queue: JobQueue):
self._docker = client
self._job_queue = job_queue
# Not sure I'm a fan of this, probably n... | true |
a8d21ee85865950a667280a534d2b4bfe0fb83bb | CONABIO-audio/selia-templates | /selia_templates/custom_tags/components/base.py | UTF-8 | 1,153 | 2.625 | 3 | [
"BSD-2-Clause"
] | permissive | from django.template import Node
from django.template.loader import get_template
class GenericNode(Node):
def __init__(self, template_name=None, **kwargs):
self.template_name = template_name
self.data = kwargs
def render(self, context):
template = get_template(self.template_name)
... | true |
e9e07bd0489d08ceff7ff289805805df9173c14e | zachallaun/bittorrent | /peerwiretranslator.py | UTF-8 | 8,861 | 2.859375 | 3 | [] | no_license | """
The PeerWireTranslator is responsible for translating a stream of bytes into
higher level messages and vice versa related to the peer wire protocol between
BitTorrent peers. The bytes are exchanged with a readerwriter and the higher
level messages are exchanged with a receiver. The creator of the
PeerWireTranslat... | true |
f87db2f9e07e14af7b5ac8c88772a113dd5e130a | rohitkaundal19/Python-Training-Michigen | /Python/Python Programs/1_USElevator.py | UTF-8 | 334 | 4.09375 | 4 | [] | no_license | # Converting World floor to US floor - The First Program
print ('Welcome to the Elevator Calculation Program')
#Country = input ('Please Enter Your Country')
C_Floor = input ('Please Enter the Floor Number')
US_Floor = int(C_Floor) + 1
print('If you are in US you will be sitting in ' + str(US_Floor) + ' floor')
print ... | true |
6cb3faf7c451740c9c7cce9b9a2be1606775befc | VivianoRiccardo/Customized-Training-Data-for-Eye-Tracking-on-screen | /circle_GUI.py | UTF-8 | 5,174 | 3.03125 | 3 | [] | no_license | from tkinter import *
import cv2
import time
import numpy
import glob
class ClickCircleF:
def __init__(self):
self.circle = None
self.dataset = None
self.file_to_fill = None
# we load all the data in the data directory
try:
self.da... | true |
01760359e4c1c70f99d687889a62215f9550f87f | steven5538/leetcode | /algorithms/MoveZeroes.py | UTF-8 | 246 | 2.875 | 3 | [] | no_license | class Solution(object):
def moveZeroes(self, nums):
position = 0
for i in xrange(len(nums)):
if nums[i] != 0:
nums[i], nums[position] = nums[position], nums[i]
position += 1 | true |
3cff1d0471aed3197384e9e746078ce7385b2664 | Rufflewind/_urandom | /netcat.py | UTF-8 | 483 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# very ad hoc implementation of netcat
# for use on systems that don't have it installed D:
import socket
def netcat(host, port, content):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.sendall(content)
s.shutdown(socket.SHUT_WR)
while True:
... | true |
cd4d7c875271a06bd97daa6e912c4d4409d7fedc | calebkw/slmc | /Image.py | UTF-8 | 330 | 3.125 | 3 | [
"MIT"
] | permissive | class Image:
"""
Image class for holding image data and metadata
"""
def __init__(self, im_data, filename):
"""Initialize image object
:param im_data: mxn array of image pixel data
:param filename: str, name of file
"""
self.image = im_data
self.name =... | true |
f3a0dfc577d1981d6049056356823365d1fd5d0a | bb2qqq/tech_notes | /THEORIES/algorithm/leetcode/Y226_Invert_Binary_Tree.py | UTF-8 | 4,708 | 3.46875 | 3 | [] | no_license | # coding: utf-8
"""
Link: https://leetcode.com/problems/invert-binary-tree/
Description:
Invert a binary tree.
4
/ \
2 7
/ \ / \
1 3 6 9
to
4
/ \
7 2
/ \ / \
9 6 3 1
"""
# 看起来invert是让我们把每个叶片的左右翻转
# 那么我们首先需要找到所有的节点。然后再以一个不... | true |
ac3d235bf043b593fe36ee09f830423e2a1eddc3 | anujstam/AIR_Search_Engine | /tf_idf_generator.py | UTF-8 | 4,314 | 3.28125 | 3 | [] | no_license | '''
Generates the inverted index for the corpus
Also generates an index to file name dictionary and a vocab index to word dictionary
'''
import nltk
from pywsd.utils import lemmatize_sentence # An all in one stemmer + lemmatizer
from nltk.tokenize import sent_tokenize
from nltk.corpus import stopwords
from nu... | true |
74c7567285d2ca4e5da6d194ba42affb95331920 | gabrieldepaiva/Exercicios-CursoEmVideo | /Python_Exercicios/ex098.py | UTF-8 | 776 | 4.09375 | 4 | [
"MIT"
] | permissive | from time import sleep
def contagem (inicio,fim,razao):
if razao == 0:
razao = 1
if razao < 0:
razao = razao * -1
if fim < inicio:
razao = razao * -1
for c in range(inicio, fim-1, razao):
print(c, end=' ')
sleep(0.5)
print()
elif fim > inic... | true |
6c08a1f6d563ebe45d8e70233e1f46382caac312 | JHenrysson/dice_game | /dice/highscore_test.py | UTF-8 | 1,317 | 3.171875 | 3 | [
"MIT"
] | permissive | """Highscore class tests."""
import os
import pickle
import unittest.mock as mock
import unittest
import highscore
class TestHighscoreClass(unittest.TestCase):
"""Tests for the highscore class."""
def test_file_created_when_non_existent(self):
"""Check file is created when not found."""
no_f... | true |
ad61552496e9278e43b791adcfcb3fadcf656d46 | fgsl/classes | /ai/alfredo02/KnowledgeBase.py | UTF-8 | 451 | 2.53125 | 3 | [] | no_license | from KnowledgeAcquirer import KnowledgeAcquirer
import json
class KnowledgeBase:
def __init__(self):
self.knowledgeAcquirer = KnowledgeAcquirer()
self.facts = []
def getFacts(self, question):
self.facts = self.getKnownFacts(question)
if (self.facts == []):
self.fa... | true |
cd7643daa5ce1794b9a4e132f01900e2f4c75a72 | fzn0728/leetcode | /leetcode/Q162.py | UTF-8 | 990 | 3.625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 20 23:42:47 2017
@author: Chandler
"""
def findPeakElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
left = 0
right = len(nums)-1
if left == right:
return 0
while left<right:
mid = (left+right)//2
# p... | true |
9317ea701ede3f14a162f8ddaaafa67f9aab246d | alexbottero/MathsDecision | /Python/Eleve.py | UTF-8 | 4,516 | 2.953125 | 3 | [] | no_license | import random
class Eleve:
def __init__(self, numeroE, prefE, prefP, nom):
# creerEleve : int -> int
# Donnees : numeroE, le numero qui representera l'eleve cree
# Preconditions : numeroE est compris dans [0, n[
# Resultat : Retourne un eleve
self.numeroEleve = numeroE
self.nom = nom
self.pr... | true |
8ae46cf7feda425d4a8a7657d255a7cf4f0bdbb6 | kcarson097/Beginner-Projects | /Bank-account-manager.py | UTF-8 | 3,281 | 3.859375 | 4 | [] | no_license | #Bank Account Manager - Create a class called Account which will be an abstract class for three other classes called CheckingAccount,
#SavingsAccount and BusinessAccount.
#Manage credits and debits from these accounts through an ATM style program.
#withdraw
#deposit
#Project Scope
#To tackle this projec... | true |
0b0bbf69242ae036eccca979c796f8f9c33aeae9 | HariSelva5/python-intern-programs | /fun2.py | UTF-8 | 170 | 3.203125 | 3 | [] | no_license | def details(name,age,residence):
print("I'm",name)
print("I'm {} years old".format(age))
print("I live in {}".format(residence))
details("Hariselva",18,"kpm") | true |
8da4d7daa54f1cb7c46bd95e1faa6de3021886a1 | Cheater115/acmp | /Python/0529.py | UTF-8 | 120 | 3.40625 | 3 | [] | no_license | x1, y1, x2, y2 = map(int, input().split())
distance = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
print(f'{distance:.5f}')
| true |
f514007a78d8f9cc2ef19266241db31fb3f87e7d | Stormtrooper089/AlgoTrades | /JindalStel.py | UTF-8 | 5,100 | 2.6875 | 3 | [] | no_license | import LoadTickData as fileLoader
import os
import itertools
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import time
#filePath="/home/ashish/Desktop/JINDALSTEL.txt"
filePath = os.path.join(os.path.dirname(__file__), 'JINDALSTEL.txt')
def generateBuySignals(list):
buyList=[]
popen,pc... | true |
505c592212f11dcd913f235521b0090d22db1c66 | HansMPrieto/CIS-313-Coursework | /Lab0/test_lab0.py | UTF-8 | 3,688 | 3.3125 | 3 | [] | no_license | import lab0
import unittest
class T0_TestingGCD(unittest.TestCase):
def test_testing_with_zero(self):
#testing with zero
g1 = lab0.mathOps(0, 0)
print(g1)
print(repr(g1))
with self.assertRaises(Exception):
g1.gcd()
g1.lcm()
pri... | true |
68fea9f988deb8381e65803c6e44ca60cb6584b3 | pkchuyen/kratest | /scripts/find_untagged_docker_image.py | UTF-8 | 671 | 2.65625 | 3 | [] | no_license | import re
import subprocess
import sys
def get_docker_images():
"""
Get docker image output and return the the output without header
"""
output = [
[i.strip() for i in line.decode().split(' ') if i.strip()]
for line in subprocess.check_output(['docker', 'images']).splitlines()
]
... | true |
aa42a98202946fb36ff3afba45e93a818f0ff09a | itsuhi/AutomatePython | /test.py | UTF-8 | 609 | 3.3125 | 3 | [] | no_license | # def solution(S):
# # write your code in Python 3.6
# consonants = "BCDFGHJKLMNPQRSTVWXYZ"
# vowels = "AEIOU"
# input_length = len(S)
# consonants_list = []
# vowels_list = []
# for char in S:
# if char in consonants:
# consonants_list.append(char)
# else:
# ... | true |
14f473f8de0f9a9e3f7c96cc660e9f5462206bea | Gembelton/3dMachineModeling | /moduleHelpServer.py | UTF-8 | 573 | 2.859375 | 3 | [] | no_license | import socket
print("Сервер запущен.")
sock = socket.socket()
sock.bind(('', 9090))
sock.listen(1)
conn, addr = sock.accept()
print ('connected:', addr)
helpMessage = (b"Hello!\n"
b"This program made by Rafael Mirzad.\n"
b"vk.com/rafisgood/\n\n\n"
b"P.S.this is the... | true |
c35ece9e29dd606aaed943091ce9ea6f52f84931 | ramanraja/CV1 | /2/cvis25A.py | UTF-8 | 537 | 2.65625 | 3 | [] | no_license | # Color filters
import cv2
import numpy as np
img = cv2.imread('photo.png')
cv2.imshow("Original", img)
print img.shape
mat = np.ones(img.shape, np.uint8)*100
mat[: ,:, 0] *= 0
img2 = cv2.add(img, mat)
cv2.imshow("No blue", img2)
mat = np.ones(img.shape, np.uint8)*100
mat[: ,:, 1] *= 0
img2 = ... | true |
a5bf10ba72cc2beb6a9930edb9fe07b407463bae | tsakailab/spmlib | /demo/demo_spmlib_solvers_matrix.py | UTF-8 | 10,191 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 21 19:36:00 2017
@author: tsakai
"""
from math import sqrt
import numpy as np
from scipy import linalg
from time import time
from spmlib import solver as sps
from spmlib import thresholding as th
np.set_printoptions(suppress=True)
print('====(Deomo 1: low-rank ... | true |
33430269b8ea685ca3bbc4c8222167a6ee15dcdb | YuHw81/Python_basic | /vscodePython/5-2.py | UTF-8 | 3,566 | 3.9375 | 4 | [] | no_license | def q1():
a = "Life is too short, you need python"
if "wife" in a: print("wife")
elif "python" in a and "you" not in a: print("python")
elif "shirt" not in a: print("shirt")
elif "need" in a: print("need")
else: print("none")
# q1() # shirt
def q2():
result = 0
i = 1... | true |
161231db42f2dcf1efaab58e2008370f26ad2eaf | pradnyasangoram/Flexible_Robot_Cell | /inspection/PCA.py | UTF-8 | 1,590 | 2.71875 | 3 | [] | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
perimeters=[]
threshVal=50
img=cv2.imread("Images/Square35.jpg",1)
img_height,img_width=img.shape[:2]
blur_img = cv2.bilateralFilter(img,1,75,75)
grey_img=cv2.cvtColor(blur_img,cv2.COLOR_BGR2GRAY)
_,thresh_img=cv2.threshold(grey_img,threshVal,255,cv2.THRESH... | true |
065190e82f71c96926d4dff2d2858576c90a36b8 | AshleyLTW/crime-map | /extract.py | UTF-8 | 3,808 | 2.71875 | 3 | [] | no_license | import camelot
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
import datetime
from datetime import timedelta
import re
# Set up a firebase instance
cred = credentials.Certificate('./hodp-scraping-f5c8cc1cd113.json')
firebase_admin.initialize_app(cred)
db = firestore.... | true |
e2f8b01ac3fedd483ff5c04bc79015b0bd454c88 | keykey563/filecopy | /schedfilecopy.py | UTF-8 | 7,519 | 3 | 3 | [] | no_license | # coding:utf-8
import os
import shutil
import time
import sched
import logging
import logging.handlers
import configparser
class FileCopy:
def __init__(self):
# 备份原地址
self.src_file_path = ''
# 备份目标地址
self.dst_file_path = ''
# 备份文件总数量
self.total_num = 0
# 备份... | true |
2513b56c2c118531bb3bff1d953b46a4432b5324 | GrigoriiKluev/python-learning | /client-server-app/messenger/previous-version/jim/exceptions.py | UTF-8 | 827 | 3.234375 | 3 | [] | no_license | class ResponseCodeError(Exception):
def __init__(self, code, *args, **kwargs):
self.code = code
super().__init__(*args, **kwargs)
def __str__(self):
return f"{super().__str__()} некорректный код ответа, {self.code}"
class MessageError(Exception):
def __init__(self, error, *args, *... | true |
76e1b1453739d91a0a82db3c15f0001e6f707133 | onaclovtech/ABAGAIL | /src/util/linalg/Vector.py | UTF-8 | 6,478 | 3.453125 | 3 | [] | no_license | #/**
#* A class representing a vector with linear algebra
#* operations.
#* @author Andrew Guillory gtg008g@mail.gatech.edu
#* @version 1.0
#*/
class Vector:
#/**
#* Get the size of the vector (the number of rows)
#* @return the number of rows
#*/
# abstract int size()
#/**
#* Get an element from the vec... | true |
2725e3b4542b2023985d20ae2f96853a3f28221b | YasiruR/travelTimeUsingGeo | /Map.py | UTF-8 | 5,047 | 2.59375 | 3 | [] | no_license | #i/usr/bin/python
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import copy as cp
class Map:
def createMapWithGrids():
#m = Basemap(projection='lcc',
# lat_0 = 40.831,
# lon_0 = -73.97... | true |
130d84a839a2a40732196c7a8581f0287b6ffd99 | Lencof/Hello-World | /def_DEC.py | UTF-8 | 690 | 3.125 | 3 | [] | no_license | # __Author__ __Lencof__
# DEC.py
def DEC():
print('Hi! DEC')
print('Hi! DEC')
print('Hi! DEC')
print('Hi! DEC')
print('Hi! DEC')
print('Hi! DEC')
print('Hi! DEC')
print('Hi! DEC')
print('Hi! DEC')
print('Hi! DEC')
print('Hi! DEC')
print('Hi! DE... | true |
e67f94794e939296efc8b32d312fde56a9cea480 | MartrixG/GraduationProject | /MatrixGoPy/utils/boardEncode.py | UTF-8 | 4,800 | 2.90625 | 3 | [
"MIT"
] | permissive | from MatrixGo import GoSGF, GoGame
from time import time
class BoardState(object):
def __init__(self, game):
self.game = game
self.state = []
for i in range(45):
if i == 3:
self.state.append([[1] * 19 for _ in range(19)])
else:
self.s... | true |
1901a6e45dc8b262248c0a2bc72c70cb4ec0f331 | wbsth/mooc-da | /part02-e08_prepend/src/prepend.py | UTF-8 | 260 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python3
class Prepend(object):
def __init__(self, s):
self.s = s
def write(self, text):
print(f'{self.s}{text}')
def main():
p = Prepend("+++ ")
p.write("Hello")
if __name__ == "__main__":
main()
| true |
aba87327d6ebbb77f5a392f0c121a65fb99ec2d2 | CooperGilliland/SimpleChatbotWithChatterbot | /chatterTest.py | UTF-8 | 704 | 2.96875 | 3 | [] | no_license | from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
#define parameters for chatterbot
chatterbot = ChatBot("Test Bot")
chatterbot.set_trainer(ChatterBotCorpusTrainer)
chatterbot.train(
#train on the included english language corpus
"chatterbot.corpus.english",
)
print("This is... | true |
63183dac12e1ac146a8ee95e08c3d767c7460535 | VladyslavHnatchenko/united | /2018/function.py | UTF-8 | 641 | 4.1875 | 4 | [] | no_license | def function_a():
global a
a = 1
b = 2
return a+b
def function_b():
c = 3
return a+c
print(function_a())
print(function_b())
# def many(*args, **kwargs):
# print(args)
# print(kwargs)
#
#
# many(1, 2, 3, name="Mike", job="programmer")
# def keyword_function(a=1, b=2):
# retur... | true |
925df462543e209faeb28161b29f9e7e86a3a7e4 | AlonsoCerpa/sgpf | /mycash/models.py | UTF-8 | 5,039 | 2.59375 | 3 | [] | no_license | from __future__ import unicode_literals
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin
from django.core.validators import MinValueValidator, RegexValidator
from django.core.urlresolvers import reverse
from datetime import datetime
from django.utils import timezone
from django... | true |
2fef68e5a739ec7d78d6318aa343e57d623739d4 | ttong-ai/games | /simple/ball1.py | UTF-8 | 552 | 3.546875 | 4 | [] | no_license | import tkinter as tk
import time
window = tk.Tk()
window.title("Bouncing Ball")
window.geometry("500x500")
width = 500
height = 500
canvas = tk.Canvas(window, width=width, height=height)
canvas.pack()
ball = canvas.create_oval(10, 10, 60, 60, fill="orange")
xspeed = 4
yspeed = 5
while True:
canvas.move(ball, xsp... | true |
c7fdf9dfb1043baa82a2768e3f25ce12bbe07d67 | abhilash1392/pythonBasicExercisesPart1 | /exercise_9.py | UTF-8 | 324 | 3.90625 | 4 | [] | no_license | """9. Write a Python program to display the examination schedule. (extract the date from exam_st_date).
exam_st_date = (11, 12, 2014)
Sample Output : The examination will start from : 11 / 12 / 2014"""
examdate=(11,12,2014)
print('The examination will start from: {}/{}/{}'.format(examdate[0],examdate[1],examdate[2])... | true |
8a1bf1644df5bf361f6be93d9ff3e94c903f9e44 | Aaron-Hastings/Python_Getting_Started_II | /Conditional_Statements.py | UTF-8 | 549 | 4.65625 | 5 | [] | no_license | print("\n\n")
print("Conditional Statements")
# Logical operators ==, !=, <, >, >=, <=
amount = 3590
if amount < 1000:
print("The value of the variable " + str(amount) + " is small")
elif amount < 5000:
print("The value of the variable " + str(amount) + " is medium")
else:
print("The value of the variable... | true |
50ed8f9d2c786b5c9a502870f73ee02469cc29f1 | mikeleppane/Advent_of_Code | /2021/Solutions/Day-12/solution_p1.py | UTF-8 | 1,994 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from pprint import PrettyPrinter
from typing import List
custom_printer = PrettyPrinter(
indent=4,
width=100,
depth=2,
compact=True,
sort_dicts=False,
underscore_numbers=True,
)
INPUT_FILE = "input.txt"
def read_map() -> List[List[str... | true |
25289e41e47b6e6e9cf3efd25c0555884394bce7 | archer884/dictionary-problem-python | /classes_by_teacher.py | UTF-8 | 399 | 3.53125 | 4 | [] | no_license | classes_by_teacher = {}
with open('classes.csv') as input:
for line in input.readlines():
parts = line.split(',')
teacher = parts[1]
if teacher not in classes_by_teacher:
classes_by_teacher[teacher] = 1
else:
classes_by_teacher[teacher] += 1
for teacher, cla... | true |
5727a3a580ce76e980acea9585b6ae9f3de5573c | rdtsc/codeeval-solutions | /src/hard/repeated-substring/solutions/python/solution.py | UTF-8 | 293 | 2.90625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import re
import sys
regex = re.compile(r'(.+)(?=.*\1)')
legit = lambda string: string != ' '
for line in (line.rstrip() for line in sys.stdin):
matches = sorted(filter(legit, regex.findall(line)), key=len, reverse=True)
print(matches[0] if matches else 'NONE')
| true |
49f12c085d039b64ef87e06841115ecfd77b90d7 | itzsen/Python | /python codes/Test.py | UTF-8 | 168 | 3.0625 | 3 | [] | no_license | import os
clear = lambda: os.system('clear')
clear()
import random
num = random.randint(1,10)
print (num)
import datetime
now=datetime.datetime.now()
print (now)
| true |
02525e0e8321abb698b0f6f43cb753a7f3277fa9 | moritzFuchs/AdventOfCode | /2018/day01/q2/q2.py | UTF-8 | 256 | 3.03125 | 3 | [] | no_license | input = "input.in"
file = open(input, "r")
freqChange = []
for line in file:
freqChange.append(int(line))
seen = set()
x = 0
idx = 0
while (x not in seen):
seen.add(x)
x += freqChange[idx]
idx += 1
idx %= len(freqChange)
print(x)
| true |
113f612c517d7ea250cbfaad5d9149369f136cc9 | fireflynights/Coursera_python_mini_projects | /pong.py | UTF-8 | 4,588 | 3.453125 | 3 | [] | no_license | # Implementation of classic arcade game Pong
import simplegui
import random
# initialize globals - pos and vel encode vertical info for paddles
WIDTH = 600
HEIGHT = 400
BALL_RADIUS = 20
PAD_WIDTH = 8
PAD_HEIGHT = 80
HALF_PAD_WIDTH = PAD_WIDTH / 2
HALF_PAD_HEIGHT = PAD_HEIGHT / 2
LEFT = False
RIGH... | true |
3e19a4e7ce91f3b8f96350b810caff3b21611328 | kouhei-k/atcoder_submissions | /abc111/abc111_b/7214321.py | UTF-8 | 77 | 2.9375 | 3 | [] | no_license | N=int(input())
if N % 111 == 0:
print(N)
else:
print((N // 111 + 1)*111)
| true |
7e398d7e9d03d0a5e96107ee3f8b27a76967eda0 | galtay/record_linkage | /mutator.py | UTF-8 | 3,782 | 4.25 | 4 | [] | no_license | """
A module to help with mutating strings. Provides a class with methods that
mutate input strings,
1) insert - insert a character
2) delete - delete a character
3) replace - replace the character at a given index with another
4) transpose - transpose two characters at a given index
In addition, a call to set_rando... | true |
f8e88cc45e93b9b5f7e29546a01e4a91fec1721e | miguel0393/python-api-ui-automation | /python-api-testing/tests/tests_books.py | UTF-8 | 1,621 | 2.59375 | 3 | [] | no_license | import unittest
from datetime import datetime
from core import books
class ApiBooks(unittest.TestCase):
now = datetime.now()
def test_get_all_books(self):
self.response = books.get_all_books()
# Esperamos que el código de respuesta del endpoint sea 200
self.assertEqual(self.response.s... | true |
3a198d7b83eca7ba512cfcae99f3725639ef9d25 | Rasedujjaman/pythonCourseBasic | /10.2functionBasics_kwargs.py | UTF-8 | 1,211 | 4.5 | 4 | [] | no_license | # Here we well learn how to pass a dictionary type arguments in a function
# kwargs stands for keyword arguments
def disp_infos(**kwargs):
# kwargs: is a place holder for any number of argumnets as key and value pairs
# print(kwargs) # it displays all the argumnets as a dictionary
print('T... | true |
b1f25abb17827b1c593b233a4dc305d8732fe3af | fidelio851/skrypty | /python_labs/skrypt6.py | UTF-8 | 170 | 2.78125 | 3 | [] | no_license | #!/usr/bin/python
import os
path = os.getcwd()
filenames = os.listdir(path)
for filename in filenames:
os.rename(filename, filename.replace("jpg", "png").lower()) | true |
0dbed2c26e6cd228ffb1513edf9880e7a504c97b | Afoucaul/pokemon-python | /src/tools/map_editor/app.py | UTF-8 | 1,975 | 2.71875 | 3 | [] | no_license | import tkinter as tk
import os.path
from core.overworld import Overworld
from core.picklable import PicklableOptions
from core.tileset import Tileset
import map_frame
import tileset_frame
import main_menu
import collision_frame
from tileset import TkTileset
class SingletonError(Exception):
pass
class App(tk.T... | true |
0302206112165939febdedca6db139fb625bc202 | xw-666/CNN-Dog-and-Human-Recognition | /02_test_face_detector.py | UTF-8 | 1,432 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
# coding=UTF-8
'''
@Description: 应用openCV预训练模型,进行人脸识别。
参考:https://docs.opencv.org/trunk/d7/d8b/tutorial_py_face_detection.html
@Author: Joe
@Verdion: 1.0
'''
import cv2
import numpy as np
import os
import matplotlib.pyplot as plt
DIR_ROOT = os.path.dirname(os.path.abspath("__file__"))
PATH_PR... | true |
c9907a5f4cce4b5c871713d1e26e27f3e6f32309 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_34/810.py | UTF-8 | 789 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python
import sys, re
def count_matches(pat, dict):
_pattern = pat.replace('(', '[')
_pattern = _pattern.replace(')', ']')
pattern = re.compile(_pattern)
count = 0
res = pattern.finditer(dict)
while True:
try:
res.next()
count += 1
except ... | true |
129496be6bec35cf0066e6cc2d8bffd1aa33faca | RishabhSinha07/DataStructures | /linked_list.py | UTF-8 | 3,156 | 4.03125 | 4 | [] | no_license | #Node Class
class Node:
def __init__(self,data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def printList(self):
pl = []
temp = self.head
while(temp):
pl.append(str(temp.data))
temp = tem... | true |
3c17abb89990344837bca0ff54477f59ca62dcfb | intuit07/structure_data | /bubble.py | UTF-8 | 1,037 | 4.09375 | 4 | [] | no_license |
# test_list = [115, 1, 33, 5, 10, 5558, 87, 5435, 987]
#
#
#
def sort(income_list):
last_element = len(income_list) - 1
for element in range(last_element):
for el in range(last_element-element):
if income_list[el] > income_list[el+1]:
income_list[el], income_list[el+1] = in... | true |
1d8d760afcabb93e918d1fc3da68ab76b3586df4 | Krl1/Flappy-Bird-AI | /pipeTop.py | UTF-8 | 825 | 3.046875 | 3 | [
"MIT"
] | permissive | import pygame
import numpy as np
from pygame.sprite import Sprite
class PipeTop(Sprite):
def __init__(self, ai_settings, screen, random_int):
super().__init__()
self.screen = screen
self.ai_settings = ai_settings
self.left = ai_settings.screen_width + ai_settings.pipes_space
self.top = random_int
self.... | true |
794bbbe787004f660c96412a1b84f90270137f04 | SudoThis913/CSU_Programs | /CSC 320/CSC320_Portfolio/ITS320_CTA5_Option1-1.py | UTF-8 | 1,488 | 4.15625 | 4 | [] | no_license | #!/usr/bin/env python3
#Gregory Norris - Module 5 Option 1.
#CSU Global Campus
#ITS 320 - 1/28/2019
#------------Defines main program. Obtains user input, calls upon functions to calculate, calls upon function to print---------------
def main():
# Get user input and store as three seperate variables. Would pr... | true |
2e94b327b466d5ae023bcbe58927c20d7796e267 | radishzhang/pythonWeb | /course2/decorator.py | UTF-8 | 475 | 3.40625 | 3 | [] | no_license | #-*- encoding=UTF-8 -*-
def log(level,*args, **kvargs):
def inner(func):
'''
*args, 有名参数
**kvargs 无名参数
'''
def wrapper(*args, **kvargs):
print 'before calling',func.__name__
func(*args, **kvargs)
print 'end calling',func.__name__
... | true |
b3c73eefd9d4227c4ef140bedf887e13146ed6de | alexpilk/BD2 | /front/app/gui/frames/reserve_apartment.py | UTF-8 | 5,054 | 2.71875 | 3 | [] | no_license | import tkinter as tk
from tkinter import messagebox
from .base import BaseFrame
from app.gui import frames
from app.api import api
import tkcalendar
# nie działa do końca wybieranie apartamentu... bez zaznaczenia niczego,
# automatycznie wybiera pozycję pierwszą i podaje ją jako wybraną
class ApartmentReservePage(Bas... | true |
91e179adbcf07cb52f70b59572309bc5275a8365 | xljixieqiu/cookbook | /demo5.5.py | UTF-8 | 462 | 3.640625 | 4 | [] | no_license | #当文件不存在才能写入。也就是不允许覆盖已存在的文件内容
#可以在open()函数中使用x模式代替w模式来实现
import os
with open('d:/python work/test1.txt','wt') as f:
pass
'''
with open('d:/python work/test1.txt','xt') as f:#会报错
pass
'''
#代替方案
path='d:/python work/test1.txt'
if not os.path.exists(path):
with open(path,'wt') as f:
f.write('hello\n')
e... | true |
1b66df9df7d8e6ff6556835276c3bf4edf797ddf | ulises-8/Python | /09_test.py | UTF-8 | 13,856 | 3.59375 | 4 | [] | no_license | """
CS3B, Assignment #9, AI Tic Tac Toe Player
Ulises Marian
testing
"""
import unittest
from assignment09 import *
class PlayerTestCase(unittest.TestCase):
def testStr(self):
self.assertEqual(" ", str(GameBoardPlayer.NONE))
self.assertEqual("X", str(GameBoardPlayer.X))
self.assertEqual("... | true |
14bd82df344c6f291634733ed8762cdc1995d5e0 | PoojaMohan12/Guvi | /Codes/three.py | UTF-8 | 194 | 3.671875 | 4 | [] | no_license | alpha=input()
f=['a','e','i','o','u','A','E','I','O','U']
if(alpha.isalpha()==True):
if alpha in f:
print("Vowel")
else:
print("Consonant")
else:
print("invalid")
| true |
a70eb569239a1568da6e995b458ef90ac87c5f91 | aexhg/aoc | /2018/day16/calc.py | UTF-8 | 3,465 | 2.625 | 3 | [] | no_license | import sys
import re
from collections import defaultdict
from collections import deque
opcodes = {
'addr': lambda a,b,reg: reg[a] + reg[b],
'addi': lambda a,b,reg: reg[a] + b,
'mulr': lambda a,b,reg: reg[a] * reg[b],
'muli': lambda a,b,reg: reg[a] * b,
'banr': lambda a,b,reg: re... | true |
ebe7455e1c9ad060ee004f4fd25bf9ab2308ad06 | SealedJoy/axosay | /axosay | UTF-8 | 17,677 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from time import sleep
import random
import threading
import subprocess
import signal
import sys
import os
import argparse
import textwrap
from blessed import Terminal
term = Terminal()
# # # USER SETTINGS # # #
bubble_char = '.'
animation_mouth_line = 4
frame_rate = 0.17
h_padding_int = 2
v_padd... | true |
ac5222cca011af0442546dc720a77163d39c9e83 | farukcatalkaya/FogRemoval | /single_image_fog_removal.py | UTF-8 | 4,885 | 2.5625 | 3 | [] | no_license | import numpy as np
import cv2
import math
import timeit
start=timeit.default_timer() #Starts the timer to estimate the full processing time
img=cv2.imread('./img/fog67.jpg',1)
b,g,r =cv2.split(img) #splits the image into its 3 channels
h= r.shape[0]
w= r.shape[1]
print... | true |
51f8cec8565fbcca8b9ffcb34290d89849b4fdfa | wwpdb-dictionaries/mmcif_pdbx | /tests/test_diffrn_source.py | UTF-8 | 2,096 | 2.609375 | 3 | [
"CC0-1.0"
] | permissive | import pytest
@pytest.fixture(scope = "module")
def getSourceTypes(dictionary):
stypes = dictionary.getEnumListAltWithDetail('diffrn_source', 'type')
return stypes
@pytest.fixture(scope = "module")
def getSourceSources(dictionary):
stypes = dictionary.getEnumListAltWithDetail('diffrn_source', 'source')
... | true |
617af1e90637aae55ea2b6115708e2fec82adb12 | kellyseeme/pythonexample | /323/stripString.py | UTF-8 | 757 | 3.78125 | 4 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
#define a string
x = " kel "
#strip is to cut the space of the head and tail
#lstrip is cut the space of the begin
#rstrip is cut the space of the end
print "|",x.strip(),"|",x.lstrip(),"|",x.rstrip(),"|"
#define a string
x = "xyxxyy hejyx yyx"
#if there have a chars ,th... | true |
f2f28e914c5e102f6e62626227a7c40e36fdb267 | Aasthaengg/IBMdataset | /Python_codes/p02762/s789188859.py | UTF-8 | 1,572 | 3.109375 | 3 | [] | no_license | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = ... | true |
a3d1cefeb91da2f07dc4a3bc437788a76a12d364 | panas-zinchenko/zinchenko_lab | /Lab2(7).py | UTF-8 | 191 | 4.125 | 4 | [] | no_license | a=int(input("Введіть число a: "))
b=int(input("Введіть число b: "))
if a>b:
print("a>b")
elif b>a:
print("b>a")
elif a==b:
print("a=b")
else:
print()
| true |
b8c520b66f65c44d6add5175e6d57b0e6419b955 | brian41005/NewsCrawler | /crawler.py | UTF-8 | 3,149 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import time
import multiprocessing
import csv
import datetime
from NewsPage import NewsPage
from bs4 import BeautifulSoup
from multiprocessing import Pool, freeze_support, Queue, cpu_count
from timecode import generate_url_list
from itertools import chain
def crawlerfunc(urlList):
pages = ... | true |
eef70d0ad46a43b385c235b73996fc51a6f09b6c | ozifirebrand/Packt_and_study_for_python | /Exercises/looping_with_while_and_for_loops.py | UTF-8 | 242 | 3.890625 | 4 | [] | no_license | counter = 1
while counter <= 10:
print(counter)
counter += 1
number = 100
while number >= 100:
number += 1
if number % 17 == 0:
print(number, 'is the first number divisible by 17 and greater than 100.')
break
| true |
1288e4c302fa75e4ee43f4ba801848cb3f495e04 | sameerpokhrel/email-crawler | /find_email_addresses.py | UTF-8 | 833 | 3.015625 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from lib import check_domain, find_emails
def main():
'''Main method to read command line arguments and validate them
Uses lib.find_emails library to find emails in a domain
'''
args = sys.argv
if len(args) < 2:
print "Usage: p... | true |
cb2743d24214582389d6431c15f83c00d3c5037b | 1572903465/PythonProjects | /设计模式/结构型模式/13_享元模式.py | UTF-8 | 2,066 | 3.671875 | 4 | [] | no_license | '''
Flyweight
'''
class FlyweightBase(object):
_instances = dict() # 皴法实例化的对象内存地址
def __init__(self, *args, **kwargs):
# 继承的子类必须初始化
raise NotImplementedError
def __new__(cls, *args, **kwargs):
print(cls._instances, type(cls)) # cls 就是你要实例化的子类如:obj = Spam(1,abc)
return c... | true |
ebef2749eaa9a1922d02ea4e28bc742f773e5048 | spoonsandhangers/learning_pygame | /3lines.py | UTF-8 | 2,489 | 4.0625 | 4 | [
"CC0-1.0"
] | permissive |
"""
Pygame base template for opening a window
Sample Python/Pygame Programs
Simpson College Computer Science
http://programarcadegames.com/
http://simpson.edu/computer-science/
Explanation video: http://youtu.be/vRB_983kUMc
"""
import pygame
import math
# Define some colors
BLACK = (0, 0, 0)
WHITE = (255, 25... | true |
04f61dd940be0a5b95ced26e001cbc199cc86a00 | aigerimzh/BFDjango | /Week1/Informatics/k3-1.py | UTF-8 | 84 | 3.390625 | 3 | [] | no_license | n = int(input())
s = 0
for x in range(n):
t = int(input())
s = s+t
print(s)
| true |
e3ca84107e4c37cec4d3488b0dfe7e05c2c7aca0 | pdst-lccs/lccs-python | /Section 2 - Data (variables, assignments and expressions)/Breakouts/Breakout 2.2 - ATM/convert pseudo-code solution.py | UTF-8 | 904 | 3.828125 | 4 | [
"CC0-1.0"
] | permissive | # Event: LCCS Python Fundamental Skills Workshop
# Date: May 2018
# Author: Joe English, PDST
# eMail: computerscience@pdst.ie
# Purpose: Solution to Breakout 2.2 (ATM)
# Display a welcome message
print("Welcome to LCCS Bank Ltd.")
print("=========================")
# Initialise a variable called balance to... | true |
45bfbe537eeca48e8ef9cdf2c3c911605473a904 | gis-support/qgis-location-lab-plugin | /modules/geocoder/modules/base/errorTableModel.py | UTF-8 | 1,803 | 2.609375 | 3 | [] | no_license | from qgis.PyQt.QtCore import QAbstractTableModel, Qt, QModelIndex, QCoreApplication
class ErrorTableModel(QAbstractTableModel):
def __init__(self, parent=None):
super(ErrorTableModel, self).__init__(parent)
self.items = []
def rowCount(self, parent=QModelIndex()):
return len(self.item... | true |
f49bd667a163e56dc7fccd35f31e6779ca91dd60 | damtung2000/MaxSharpeRatio | /test.py | UTF-8 | 348 | 2.84375 | 3 | [] | no_license | import pandas as pd
names = ['DJI', 'TSL']
dictDJI = {'DJI' : [1,2,3]}
dictTSL = {'TSL': [4,5,6]}
listDJI = [1,2,3]
listTSL = [4,5,6]
list
# dictOfDicts = {dictDJI, dictTSL}
listOfDicts = (dictDJI,dictTSL)
listOfLists = [listDJI, listTSL]
prepDataFrame = list(zip(list))
print(listOfDicts)
df = pd.DataFrame(prepDataFra... | true |
6361a10b040f63edc6d8547f12461160b32126ce | zhanglizhou/python_learn | /numpy and pandas/pro4.py | UTF-8 | 239 | 3.328125 | 3 | [] | no_license | import numpy as np
A = np.arange(3,15).reshape(3,4)
print(A[2,1])
print(A[2][1])
print(A[2,:])
print(A[2])
print(A[1,1:2])
print(A[:,1]) #1col
for row in A:
print(row)
for item in A.flat:#寻找值,默认是按照行
print(item) | true |
696fb88603a979f84a600ce46b9f7dcd47a01691 | GproDCode/becasDevnet | /APIC-EM-Auto-Connection-0.1.py | UTF-8 | 6,457 | 3.03125 | 3 | [] | no_license | import requests
import json
import urllib3
from pprint import pprint
import sys
#definimos variables para pedir el ticket automaticamente
requests.packages.urllib3.disable_warnings()
url = "https://sandboxapicem.cisco.com/api/v1/ticket"
headers = {
'Content-Type' : 'application/json'
}
body_json = {
"passwo... | true |
e8e99d9f22f88a387e245f65270e12b83ec40caa | BeamIO-Inc/sarpy_apps | /sarpy_apps/apps/aperture_tool/panels/frequency_vs_degree_panel/frequency_vs_degree_panel.py | UTF-8 | 3,319 | 3.171875 | 3 | [] | no_license | import tkinter
from tkbuilder.widgets.image_canvas import ImageCanvas
import numpy
class FrequencyVsDegreePanel(tkinter.LabelFrame):
def __init__(self, parent, canvas_width=800, canvas_height=600,
left_margin=0.15, right_margin=0,
top_margin=0.1, bottom_margin=0.25):
tkin... | true |
9ec350c583cb1d8fa6929ff147f6eb51265c567c | jod35/listerine | /backend/models.py | UTF-8 | 530 | 2.65625 | 3 | [] | no_license | from flask_sqlalchemy import SQLAlchemy
sa=SQLAlchemy()
class Article(sa.Model):
id=sa.Column(sa.Integer(),primary_key=True)
title=sa.Column(sa.String(50),nullable=False)
description=sa.Column(sa.Text(),nullable=False)
def __repr__(self):
return self.title
def save(self):
sa.sess... | true |
ac400e22b6eacdb3484beadae9e6d217bcc2f07e | umairgillani93/python-sockets | /client.py | UTF-8 | 796 | 3.140625 | 3 | [] | no_license | """
CLIENT FILE:
- Create socket
- Connect with the server using connect()
- Decode data from bytes to string using data.decode('utf-8')
-
"""
import socket
import os, subprocess
s = socket.socket()
host = '192.168.1.6'
port = 9999
s.connect((host,port))
while True:
data = s.recv(1024)
i... | true |
f9982b0b024141f8fee94412271bcb3c497aacc2 | smsxgz/euler_project | /problems/problem_185/simulated_annealing.py | UTF-8 | 1,385 | 3 | 3 | [] | no_license | import numpy as np
guesses = []
nums = []
with open("./guess.txt", "r") as f:
for line in f.readlines():
line = line.split(" ;")
nums.append(int(line[1][0]))
guesses.append(line[0])
# guesses = sorted(guesses, key=lambda x: x[1])
n = len(guesses[0])
print(guesses)
def number2vector(n_str)... | true |
8bdcad2b0aad361bf06d984293b1c57007be396e | zhangcj5131/tensorflow_teaching | /Tensorflow_basic/1.numpy and tensorflow.py | UTF-8 | 768 | 2.8125 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
x = np.random.rand(100)
y = x * 0.2 + 0.3
print(x.shape, y.shape)
with tf.Graph().as_default():
w = tf.Variable(initial_value=tf.random_uniform(shape=[], minval=-1, maxval=1))
b = tf.Variable(initial_value=tf.zeros(shape=[]))
y_pred = x * w + b
loss = tf.redu... | true |
14bc1d395d484ad11d0672a8fe16b5972ca1f367 | ai-biology/dcnn-gap-filling | /tessellation-generator/tessellator.py | UTF-8 | 12,202 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Create pairs of noisy and segmented images using voronoi tesselation
"""
from collections import defaultdict
from dataclasses import asdict, dataclass
import json
import os
from typing import Dict, List, Optional, Tuple
import warnings
import click
import numpy as np
from scipy.spatial imp... | true |
f68a9a495ea7a4a257bb0456de20bee25280dda2 | r-arun/cse523 | /points/fuzz_polygon.py | UTF-8 | 953 | 2.828125 | 3 | [] | no_license | import random
import os
import sys
count = 0
while count < 200:
count += 1
num = str(random.randint(4, 3000))
ret1 = os.system("echo "+num+"| ./test_convex_hull.o > out_"+num)
if(ret1!=0):
print "First Failed"
sys.exit(0)
fd = open("out_"+num, 'rb')
string = fd.read()
fd.close()
c_str = "Convex Hull\n"
p... | true |
a361d35907779685397f0f0a4a923cdf43e26751 | kameko/server.py | /src/events.py | UTF-8 | 1,391 | 2.734375 | 3 | [] | no_license |
from typing import Callable
import discord
class Events:
def __init__(self):
self.system_shutdown_callbacks = []
self.discord_message_recieve_callbacks = []
self.discord_message_updated_callbacks = []
# system
def on_system_shutdown(self, callback: Callable[[object], None... | true |
b4d575752c03e387573e9c73264f30fbb9cb2faa | shooshx/my_py | /my_utils.py | UTF-8 | 11,183 | 2.578125 | 3 | [] | no_license | import os
import sys
import glob
import subprocess
import shutil
import time
import thread
import __main__ # the module which imported us
scriptdir = os.path.dirname(os.path.abspath(__main__.__file__))
wdirFromScriptDir = "" # everything is relative (by default) the the folder where the importing script is
def wd... | true |
234bab36ef18663723dabe489efad4da974119b2 | rockxja/algo | /simple_queue.py | UTF-8 | 839 | 3.671875 | 4 | [] | no_license | # implementing the queue ADT
# I will implement it using an underlying Array data structure
class Queue:
def __init__(self):
self.instack = []
self.outstack = []
def isEmpty(self):
return len(self.instack)+len(self.outstack)==0
def dequeue(self):
if(self.isEmpty()):
return None
if len(self.outstack)!=... | true |
9df8a89d784f0f063ac3f192f5ec3b1d28e28856 | conglinh99/maconglinh-fundamentals-c4e13 | /Session02/maze.py | UTF-8 | 95 | 3.03125 | 3 | [] | no_license | from turtle import *
for i in range(20, 200, 8):
forward(i)
left(90)
mainloop()
| true |
629800b7900c0e38f1e2d6502ac59430427ceb8e | mvarge/files_finder | /files_finder.py | UTF-8 | 2,469 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python3
import os
from collections import deque
class Finder(object):
"""Parent object for other classes.
This object is created to be inherited and consequently handling
the tree traversal logical using recursion feeding another
deque object inside child object.
"""
def find(s... | true |
71dc997ae189e1cb75ca3a4f494b3b31a35c5fa7 | marshall-jj/WeatherWebsite | /weather_app_main/api_data.py | UTF-8 | 11,272 | 2.53125 | 3 | [] | no_license | import requests
import datetime
from .models import Location_Data
from django.core.files import File
# The basic api and api key for the Met office data.
base_api = 'http://datapoint.metoffice.gov.uk/public/data/'
api_key = 'PLACEHOLDER'
location_list_api = base_api + 'val/wxfcs/all/json/sitelist?' + api_key
map_lay... | true |
cc221da00aebfad30a286c704f6d9720e009f9c6 | hahahihiho/storage | /_3_python_project/_1_customer_management_system/ver1_basic_form.py | UTF-8 | 4,924 | 3.546875 | 4 | [] | no_license | ########################
# 제작: 2019/09/03
# 수정: 2020/01/14
# 제작자: 조현명(https://github.com/hahahihiho)
# title: 고객관리 시스템-1
########################
# ***Brief Description***
# 고객정보 관리
# 정규표현식으로 예외처리
# update는 예외처리x(추후 def로 구현예정)
########################
import re
start_explanation="="*40+"""
I : 고객정보 입력
P/C/N : 이전/현재/다음... | true |