blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
3f83279312fa5531920a7bf716aa8bbf1be5f909
Python
architnagpal001/Tkinter-Full-Course-
/Tkinter/canvas-widget.py
UTF-8
531
2.875
3
[ "MIT" ]
permissive
from tkinter import * root = Tk() canvas_width = 800 canvas_height = 400 root.geometry(f"{canvas_width}x{canvas_height}") can_widget = Canvas(root, width=canvas_width, height=canvas_height) can_widget.pack() can_widget.create_line(0,0,800,200, fill="red") can_widget.create_line(0,400,800,0, fill="red"...
true
f548c8a4efb15084cf083e436ff04c8878197bbb
Python
cosmicBboy/pandera
/pandera/model_components.py
UTF-8
11,182
2.515625
3
[ "MIT" ]
permissive
"""SchemaModel components""" from typing import ( Any, Callable, Dict, Iterable, List, Optional, Set, Tuple, Type, TypeVar, Union, cast, ) from .checks import Check from .errors import SchemaInitError from .schema_components import ( Column, Index, PandasDtyp...
true
fe477afd361f60292c0ae958b906b3e40e8855de
Python
ankitaku2019/Term-Project-Open-CV
/signUp.py
UTF-8
2,568
3.359375
3
[]
no_license
#user can sign up using this import string def mousePressed(event, data): if data.width//4<event.x<0.75*data.width and 0.25*data.height<event.y<0.375*data.height: data.clickedPass=False data.clickedUser=True elif data.width//4<event.x<0.75*data.width and 0.5*data.height<event.y<0.625*data...
true
3a9f00fc6e578308ac5819bbd6ee8add4175f1ff
Python
wills0909/OATR
/figure3.py
UTF-8
1,448
3.15625
3
[]
no_license
# This file is to figure out the relationship between total energy consumption with Ratio of acoustic and optical # You can change Node number, Data amount:L and the ratio. from get_optimum_omega import * import math # define a function of total consumption def totalConsumption(DataAmout, OpticaRatio): dis1 = Op...
true
03baf7ddcd3a7d6f203fe7ff153b39e92c5c5708
Python
shehryarbajwa/Mad-Libs
/udacity.py
UTF-8
2,493
4.0625
4
[]
no_license
easy_string = ('_1 is the capital of Canada, _2 is the capital of UK, _3 is the capital of Pakistan, _4 is the capital of China') easy_answer = ('ottawa', "london", "islamabad", "beijing") medium_string = ('__1__ is the birthplace of Napolean, __2__ is the birthplace of Kennedy, __3__ is the birthplace of Ada Lovelace...
true
c18b80164915bcdaf800e8f9a93a3d8679d4b121
Python
pcleon/python_challenge
/l6-2.py
UTF-8
420
2.78125
3
[]
no_license
#!/usr/bin/env python #coding=utf-8 #学习python 压缩zip import zipfile dir = "files" + "/" file = dir + "channel.zip" zip_file = zipfile.ZipFile(file) comment ='' file_name = '90052.txt' zc =[] while 1: f = open('files/%s' % file_name) next_num = f.read().split()[-1] f.close zc.append(zip_file.getinfo(file_name).commen...
true
c72670ebc1b0d081bc44244c4695d54a3aef14c4
Python
RQuispeC/Machine-Learning
/t3/t3_1.py
UTF-8
6,300
3.0625
3
[ "MIT" ]
permissive
import numpy as np import csv import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn import model_selection from sklearn import metrics from sklearn import preprocessing from sklearn.model_selection import GridSearchCV from sklearn import svm from sklearn.discriminant_analysis import Li...
true
d9be63cd74bef9864b30d1f39905c6dddeead375
Python
Escartin85/Krypthon
/gui/Terminal.py
UTF-8
2,656
3.28125
3
[]
no_license
# this class will hold functions for interaction with a terminal or command prompt # cleaning it working in all operative systems. And adding the customization of # the out with many diferents colors # @Author: Javier Escartin Diaz # @ID Student: 15017740 import os import sys # define class Terminal or Command Promp...
true
bec6135103d278b1399e2c21377e093b417a0f36
Python
triposorbust/stable-persistence
/spec/parsed_spec.py
UTF-8
5,645
3.03125
3
[]
no_license
#!/usr/bin/python import os.path import sys sys.path.append(os.path.relpath("../src", os.path.dirname(__file__))) import parsed as P import unittest TEST_FILENAME = "parsed.spec" class CatAcceptanceTest(unittest.TestCase): def setUp(self): self.cat_parser = P.SeriesIterator(TEST_FILENAME, False) ...
true
4d36f6f13aa9ed1d940c59a0629c67a9e00eb14b
Python
hkim150/Leetcode-Problems
/Top_Interview_Questions/131._Palindrome_Partitioning/solution.py
UTF-8
996
3.109375
3
[]
no_license
class Solution: def partition(self, s: str) -> List[List[str]]: leng = len(s) # get the memoization of dp palindrome memPal = [[False] * leng for _ in range(leng)] memPal[leng-1][leng-1] = True for i in range(leng-1): memPal[i][i] = memPal[i+1][i...
true
e8824cf3fa551fa18994ee6fdf5b084c487bd7cd
Python
tzerchyuan/Coup
/coup/classes/characters/Ambassador.py
UTF-8
464
3.15625
3
[ "MIT" ]
permissive
from .Character import Character class Ambassador(Character): def __init__(self): pass def description(self) -> str: return "Ambassadors can do the following:\n Exchange: Exchange cards with the Court. First take random cards (default: 2) from the Court deck. Choose which, if any, to excha...
true
74b0d1704da71f37da465616541f8a40c1f55e55
Python
gavinmaleney/gavobd
/gavobd.py
UTF-8
1,431
2.8125
3
[]
no_license
# encoding: utf-8 import obd import time starttime = time.time() # connect to the car connection = obd.OBD() # Assign OBD Commands to Variables rpm = obd.commands.RPM # select an OBD command (sensor) - RPM dtc = obd.commands.GET_DTC # Trouble Codes intake_pressure = obd.commands.INTAKE_PRESSURE # Pressure vehicle_sp...
true
5c438b5dd90acb5f6a095a5804655fcf1b400dab
Python
choyj0920/algorithm
/algorithm_202012/baek2108.py
UTF-8
556
3.40625
3
[]
no_license
# 백준 2108 통계학 import sys from collections import Counter num=[0 for i in range(8001)] #input n= int(sys.stdin.readline()) arr=[0 for i in range(n)] cnt=0 for _ in range(n): temp= int(sys.stdin.readline()) arr[_]=temp cnt+=temp # 산술 평균 ave =round(cnt/n) print(ave) # arr sort arr=sorted(arr) # 중간 값 prin...
true
c975083aca1aa57b6bccc82b3b7958ee12dcaa1e
Python
evenchen0321/testmac
/20170119/filenew.py
UTF-8
676
3.421875
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: Even f = open("yesterday",'r',encoding="utf-8") ''' # print(f.readline()) # print(f.readline()) # print(f.readline()) # print(f.readline()) # print(f.readline()) 笨办法 ''' ''' for i in range(5): print(f.readline()) 第二种办法 ''' ''' for index,i ...
true
0d39314d7bc63edb504bc2c7e6f00dc8b04a5f0a
Python
OctavianBarbu/MyFirstProject
/TicTacToe_functions.py
UTF-8
2,508
3.796875
4
[]
no_license
from IPython.display import clear_output import random def display_board(board): clear_output() #Clearing the output every time the function is called print(" ") print(f" {board[7]} | {board[8]} | {board[9]} ") print("-----|-----|-----") print(f" {board[4]} | {board[5]} ...
true
683ee747874e33f94ff9c7b9fcf5f1bfccd635f3
Python
Roel/Gyrid-server
/olof/logger.py
UTF-8
4,683
2.828125
3
[ "BSD-3-Clause" ]
permissive
#-*- coding: utf-8 -*- # # This file belongs to Gyrid Server. # # Copyright (C) 2012 Roel Huybrechts # All rights reserved. """ Module providing logging infrastructure for info and error messages from the server. """ import logging, logging.handlers import os import sys import time import traceback class Logger(obj...
true
8e75aeafe726c7be06d866436bb0df3e9551559d
Python
chrisl0411/Python-Fundamentals-Part-1
/fibonacci.py
UTF-8
292
3.9375
4
[]
no_license
def fibonacci(n): if n == 1: return 1 elif n == 2: return 1 else: fn1 = fibonacci(n-1) fn2 = fibonacci(n-2) print("fibonacci("+str(n)+") =",str(fn1)+" + "+str(fn2)) return fn1 + fn2 def main(): print(fibonacci(7)) main()
true
305757e73eee1f0e9c78658d6b73839749f33494
Python
forestlight1999/algorithm
/heap.py
UTF-8
5,421
3.6875
4
[]
no_license
#!/usr/bin/env python # coding=utf-8 ''' @Author: forestlight @Date: 2019-08-25 17:06:29 @LastEditTime: 2019-09-04 20:32:35 @Description: used to implement the heap data structure ''' from utils import get_randint_data from collections.abc import Iterable ''' @description: now we use array to implement min heap @param...
true
ff9658dc68dd22c6fd2dbf880a09f1a2fb08d19f
Python
ankrypted/castle-defence
/gameComponents.py
UTF-8
3,660
3.515625
4
[]
no_license
import pygame import math import computation ''' This class is to denote a bullet A bullet has the following attributes: 1> timeTravelled : The amount of time a bullet has lived 2> orientation : The current orientation of the bullet in radians 3> firedBy : Id of the ent...
true
9507e5b1bb777974a4439ae637b438a7f425ac43
Python
Xilma/Lynn
/Python Practice/main.py
UTF-8
1,801
4.59375
5
[]
no_license
#imports the module Calculator from the calculator file from calculator import Calculator #creates an object of the Calculator class calculate = Calculator() #calls the __str__ method that returns my name print(calculate) #calculates the sum def addNumbers(): input_string = input("Enter the numbers you want ...
true
f876e9dac51dff32c551510b9940743eb9229905
Python
ticod/goodee-python
/210205/exam2.py
UTF-8
609
4.09375
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Feb 5 14:38:36 2021 @author: Dohun exam2.py """ def calc(var1, var2, oper): if oper == "+": return var1 + var2 elif oper == "-": return var1 - var2 elif oper == "*": return var1 * var2 elif oper == "/": return var1 / var2 ...
true
1b6b180b53293f3bfc7c19ddb4348d8af4188a97
Python
zimarinvitalii/task-2
/тема 4/task4.py
UTF-8
1,171
4.3125
4
[]
no_license
''' Write a program that asks the answer for a mathematical expression, checks whether the user is right or wrong, and then responds with a message accordingly. ''' import random import operator def askQuestion(): answer = randomCalc() guess = float(input()) return guess == answer def randomCalc(): o...
true
4041f16e43fc0ee2f290f7d6fd5033e9d2a94b0a
Python
gaborpapp/AIam
/movement_ai/text_renderer.py
UTF-8
3,421
2.890625
3
[]
no_license
from OpenGL.GL import * from OpenGL.GLUT import * try: import FTGL except ImportError: pass class TextRenderer: def __init__(self, window, text, size, font=None, spacing=None): self.window = window self.text = text self.size = size self.font = font self.spacing = spa...
true
4c7ba045cec16be49f023dfb4ac8e74e71e324d0
Python
bojinyao/snake
/oop_snake.py
UTF-8
11,199
2.890625
3
[]
no_license
from random import randint import os import time import signal def New_Board_List(row, column): assert type(row) is int and row > 0 and type(column) is int and column > 0 lst = [[' ' for _ in range(column + 2)] for _ in range(row + 2)] for i in range(len(lst[0])): lst[0][i] = '-' for i in range...
true
2084d944da154773a3bcf364dc7b9b7fac63c7cb
Python
Isihiro4423/due_deligence
/due_deligence/filtering/result_underpriced_filter.py
UTF-8
923
2.84375
3
[]
no_license
from typing import Dict, List class ResultUnderpricedFilter(object): def __init__(self, underpriced: int): self._underpriced_cond = underpriced def filter(self, results: Dict) -> Dict: result_dict = {} for sec_code, result in results.items(): result['due_deligences'] = sel...
true
376fead969dde22405d037c29ae775ee1b5dfafc
Python
rec/EnergyEngineersCodes
/SummerStudents2016/IndividualCharacters/Ampersand.py
UTF-8
223
2.671875
3
[]
no_license
from LEDsetup import* led.fill(Off) led.update() def And (Color): nd =[37,47,26,56,25,35,55,34,44,23,53,73,22,32,62,21,31,41,51,71] for i in nd: led.set(i,Color) led.update() return And(Violet)
true
3ec8f6cd9b1e869e790c05dbae3bb17fdaefc3b6
Python
Aasthaengg/IBMdataset
/Python_codes/p02261/s622713082.py
UTF-8
790
3.359375
3
[]
no_license
n = int(input()) card1 = list(input().split()) card2 = [i for i in card1] def bubbleSort(c1:list, n:int): for i in range(n): for j in range(n-1, i, -1): if c1[j][1] < c1[j-1][1]: c1[j], c1[j-1] = c1[j-1], c1[j] return c1 def selectionSort(c2:list, n:int): for i in range(...
true
5c68fcb04f3f0962bd140398a81b36d72dc6dea7
Python
atsunaakiya/teletako
/twitter_crawler.py
UTF-8
4,187
2.578125
3
[]
no_license
import sys from collections import deque import re from typing import Iterable, NamedTuple, List, Optional, Set, Tuple, Deque import tweepy from lib.config import TwitterConfig, parse from lib.db import UDB from lib.utils import UMessage, MessageType class RelatedStatusRef(NamedTuple): username: str id: str ...
true
781e14bcfdcea2e43ce8f912ab5f65cf183399b2
Python
zhumu17/Movie_Recommender_System
/Models/RecentPopularModel.py
UTF-8
1,480
3.046875
3
[]
no_license
# most popular model # here it is a simple design: find the one with highest score with most of the users import DatabaseQueries import pandas as pd import numpy as np import logging class RecentPopularModel(object): # the year and number of rating thresholds can be modified inside DatabaseQueries SQL query def...
true
87a8c44996e8bea7affbd93c8298bde46436dd17
Python
JiGro/NLP_Wikipedia_Summarizer
/Summarizer.py
UTF-8
2,377
3.28125
3
[]
no_license
import wikipedia from nltk.corpus import stopwords from nltk.stem import PorterStemmer from nltk.tokenize import word_tokenize, sent_tokenize def frequency_table(inputString): stemmer = PorterStemmer() words = word_tokenize(inputString) stopWords = set(stopwords.words("english")) filteredWords = [w for...
true
498ee90184b710e34183b7c97fa3b4203b66588f
Python
F286/FreeNet
/experimental/mnist.py
UTF-8
1,614
2.984375
3
[]
no_license
import tensorflow as tf sess = tf.Session() from keras import backend as K K.set_session(sess) img = tf.placeholder(tf.float32, shape=(None, 784)) from keras.layers import Dense, Activation def selu(x): alpha = 1.6732632423543772848170429916717 scale = 1.0507009873554804934193349852946 return scale * tf...
true
5c7eaeadde7599e416f406208890373747a85dc7
Python
barmi/CodingClub_python
/LV1/SourceCode/Chapter5/bounceBall.py
UTF-8
2,277
3.421875
3
[]
no_license
# base source : https://stackoverflow.com/questions/29158220/tkinter-understanding-mainloop # tkinter ref : http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html from tkinter import * import math canvas_width = 600 canvas_height = 400 root = Tk() root.title = "Game" #root.resizable(0,0) #root.wm_attributes("-t...
true
52b00b8d3c9a6011c007d4846977afe60cc31261
Python
Crystal-Lilith/PDbot
/cogs/dpy/ls.py
UTF-8
2,128
2.53125
3
[]
no_license
@client.command(description='Shows you all files in the specified directory||<dir>') @commands.has_any_role('PDBot Mod', 'PDBot Dev') async def ls(ctx, *, directory='.'): try: x = '' split_directory = directory.split('/') for i in ['..']: if i in split_directory: ...
true
00568e1ed2ec4f5e623da2280573d9e1bc782c70
Python
micdm/receipt-tracker
/receipt_tracker/tests/test_models.py
UTF-8
2,789
2.5625
3
[]
no_license
import pytest from pytest import fixture from receipt_tracker.models import Product, ReceiptItem pytestmark = pytest.mark.django_db class TestSeller: def test_str(self, seller): result = str(seller) assert result def test_name_if_user_friendly_name_set(self, mocker, seller): mocker...
true
454e9dc2363053f84d9534ed34ec71baf45c0041
Python
retfings/PaddleGAN
/applications/DAIN/util.py
UTF-8
2,478
2.78125
3
[]
no_license
import os, sys import glob import shutil import cv2 class AverageMeter(object): """Computes and stores the average and current value""" def __init__(self): self.reset() def reset(self): self.val = 0 self.avg = 0 self.sum = 0 self.count = 0 def update(self, val...
true
1f0234b238b9953acf531e09eefdebcf9b23b0ca
Python
IanGHill/Python_CRUD_cinema
/models/customer.py
UTF-8
2,143
2.875
3
[]
no_license
import sys sys.path.append('../db') sys.path.append('../models') from sqlrunner import * from ticket import * class Customer(): def __init__(self, name, funds): self.id = 0 self.name = name self.funds = funds def save(self): sql = """ INSERT INTO customers (name, f...
true
195cf34486ab1a8554730296d60e90d663a67ecc
Python
neon520/Python-for-dummies
/Programas varios/regularExpression with functions.py
UTF-8
877
3.75
4
[]
no_license
#! /usr/bin/python3 import re def caso1(str): if re.match('\w+\s[A-Z]',str): print (str+" cumple el caso 1 (palabra seguida de un espacio y una única letra mayúscula.") return True else: return False def caso2(str): if re.match('\w+@(\w+)\.com|es',str): print (str+" cumple el...
true
2096cd4848bb7abc79b9aedde943d1a021d737b9
Python
DaniellFoncho/python-facturas
/ventas.py
UTF-8
3,160
3.03125
3
[]
no_license
import libsistema as lbs import libcrud as lbc #menú para ventas def submenu(): #variables tipo lista para archivos vendedores = [] clientes = [] productos = [] detalles = [] ventas = [] #cargar los archivos llamando funciones vendedores = lbc.cargar(vendedores,'vendedores.dat') clientes = lbc.carga...
true
5095696417930a8f8d1235518d284e039dd60bf1
Python
HamPUG/examples
/ncea_level2/snippets/snip_l2_01_a.py
UTF-8
1,030
3.375
3
[]
no_license
# Import sys for retrieving the name of the program in list sys.argv[0] import sys # Import time an use the sleep() function to provide a delay in the program. import time _description_ = """ Import time and use sleep() for 5 seconds. """ _author_ = """Ian Stewart - December 2016 Hamilton Python User Group...
true
fbce0a5487de5486fc37643128c9f11003b7f846
Python
Stanford-PERTS/neptune
/app/model/notification.py
UTF-8
3,629
2.703125
3
[ "JSON", "Unlicense", "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
"""Notification: An alert to a user about some event, with sufficient context to quickly navigate and take action.""" from collections import defaultdict from google.appengine.ext import ndb import json import logging from gae_models import Email, DatastoreModel class Notification(DatastoreModel): task_id = ndb...
true
0fb135b005d535c14f5e0099a3f95958116a3158
Python
nvchung599/JerbBot
/trunk/basic_bot.py
UTF-8
12,305
2.65625
3
[]
no_license
# PURPOSE: # Bot parent class. # Children bots scan/scrape their assigned websites, filtering jobs as they go. # These jobs are reported back to the Agency. from trunk.job import * from trunk.general import * import requests from bs4 import BeautifulSoup import abc class BasicBot(metaclass=abc.ABCMeta): # -----...
true
a93cdcce54c0962c262506fda48da79fafe9b647
Python
utamhank1/data_mining_algorithms
/data_splitting_rcv1.py
UTF-8
1,033
3.125
3
[]
no_license
# This script takes the rcv1 dataset (www.jmlr.org/papers/volume5/lewis04a/lewis04a.pdf) of 800,000 categorized news # stories and splits it into training and test data. # Import libraries import numpy as np from sklearn.datasets import fetch_rcv1 def main(): # Fetch the rcv1 dataset from sklearn. rcv1 = fet...
true
f6718a4bef102b0efc2d55fa623e75b697495bec
Python
Fromang/bigdata-1a
/programs/a.py
UTF-8
3,425
3.171875
3
[]
no_license
from common import Traffic, AirportCounter, AirportTable from _base import BaseTest class BaseTestA(BaseTest): def __init__(self, *args, **kwargs): BaseTest.__init__(self, *args, **kwargs) def test_process(self, traffic): self.get_airport(traffic.arrival).increase_take_off() self.get_...
true
cf28a4a6b2e61de42a2345cae81eb88ba0352853
Python
V-Marco/dimreducers-crusher
/dimreducers_crusher/datasets/SwissRollDataset.py
UTF-8
505
2.609375
3
[ "Apache-2.0" ]
permissive
import sklearn import numpy as np from AbstractDataset import AbstractDataset from sklearn.datasets import make_swiss_roll # shape is defined by args in get # default is (1000,3) class SwissRollDataset(AbstractDataset): def __init__(self): super().__init__() def get(self,n_samples = 1000, noise = 0.1, **kwargs...
true
8d85f3a827210aff2864fbda3eee6960f3615099
Python
malibustacy/tstoolbox
/tests/test_normalization.py
UTF-8
2,102
2.53125
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_normalization ---------------------------------- Tests for `tstoolbox` module. """ import shlex import subprocess from unittest import TestCase from pandas.util.testing import assert_frame_equal import pandas as pd from tstoolbox import tstoolbox from tstoolbox...
true
b451997a985350a0cb525fb294eea8bd0a95ea9d
Python
Zemllia/bot-killer
/face_detect.py
UTF-8
641
2.546875
3
[]
no_license
import cv2 import urllib.request import numpy as np def url_to_image(url): resp = urllib.request.urlopen(url) image = np.asarray(bytearray(resp.read()), dtype="uint8") image = cv2.imdecode(image, cv2.IMREAD_COLOR) # return the image return image def check_img(image): cascPath = "haarcascade...
true
08cd9d18b1382a7497b964b6201d0886e39e8280
Python
niketagrawal/F3DASM
/f3dasm/abaqus/geometry/utils.py
UTF-8
2,030
3.453125
3
[ "BSD-3-Clause" ]
permissive
''' Created on 2020-03-24 15:01:13 Last modified on 2020-03-24 16:28:53 Python 3.7.3 v0.1 @author: L. F. Pereira (lfpereira@fe.up.pt) Main goal --------- Define functions used among the modules of the current subpackage. ''' #%% imports # third-party import numpy as np #%% geometry-related functions def transfo...
true
558eeeeedc166e6fb8ab9f8b3a0ca2f66d3783b0
Python
warren511/210CT-coursework---Warren-Elliott
/Week 2 Question 3.py
UTF-8
2,801
3.703125
4
[]
no_license
""" ADDITION(B,C) for x range length of B //n for i in range length of B[0] //n*n addition_result1[x][i]<-ADD b[x][i] and c[x][i] //n*n retur...
true
979dcd515e96c16f276bef0d6a9d25d0a96d7854
Python
caiquanshi/fator_code
/classes.py
UTF-8
14,262
2.71875
3
[]
no_license
import json import sys import sqlite3 import logging class DAO: """A date access object super class """ def __init__(self, database): self.connection = sqlite3.connect(database) self.queryCursor = self.connection.cursor() logging.basicConfig(level=logging.ERROR) self.logger = ...
true
f8ba58c0b6365e47ea0104794b6e7770cee68791
Python
thariqkhalid/perception4all
/classification/networks/inception.py
UTF-8
5,451
2.8125
3
[]
no_license
import torch.nn.functional as F from torch import nn import torch # we'll put the input to the inception block as the first value of the list inception_3a = [192, 64, 96, 128, 16, 32, 32] inception_3b = [256, 128, 128, 192, 32, 96, 64] inception_4a = [480, 192, 96, 208, 16, 48, 64] inception_4b = [512, 160, 112, 224, ...
true
058b229e325a7795f80e5fde71e1b101b7ff6296
Python
tabriz83/WriteUps
/CTF-2018/YISF/exploit.py
UTF-8
2,265
2.65625
3
[ "MIT" ]
permissive
# -*- coding: cp949 -*- from pwn import * r = remote('112.166.114.144', 35122) print r.recvuntil('[>]') # 1. Yisf lotto # 2. Yisf bank # 3. explanation # 4. EXIT # [>] r.sendline('2') print r.recvuntil('[>]') # Yisf Bank # 1. Loan # 2. Repayment # 3. Bank account # 4. Previous Screen # [>] r.sendline('2') print r.r...
true
25df0398a769191503f0d314ee67c93fdb743a9c
Python
mariomech/mosaic-aca_aflux_data_processing
/radar/scripts/utils/in_out/write_helpers/write_ancillary_data.py
UTF-8
1,418
2.625
3
[]
no_license
#!/usr/bin/python def main(fid, data, setup): """Write position, attitude, velocity of the sensor.""" write_dropsonde_data(fid, data, setup) write_beam_width(fid, data, setup) def write_dropsonde_data(fid, data, setup): varnames = ( 'v_dropsonde_x', 'v_dropsonde_y', 'wind_speed_dropson...
true
7d76be377fa9c044953d8c06ee12effc66f49501
Python
sumitpatra6/leetcode
/backspace_string.py
UTF-8
389
3.078125
3
[]
no_license
class Solution: def backSpaceCompare(self,S,T): + sol= Solution() s = 'xywrrmp' t = 'xywrrmu#p' print(True) print(sol.backSpaceCompare(s,t)) """s = 'ab##' t = 'c#d#' print(True) print(sol.backSpaceCompare(s,t)) s = 'a##c' t = '#a#c' print(True) print(sol.backSpaceCompare(s,t)) s ...
true
891b02e0ee614939f87817dc11971bc26aa1f9db
Python
MartinR2295/University-Exercises-Artificial-Intelligence
/traveling_salesman/src/node.py
UTF-8
627
4.03125
4
[ "MIT" ]
permissive
#!/usr/bin/env python3 """ Node Class This is one single node in the graph """ class Node(object): def __init__(self, x, y, name, color, size=50): self.x = x self.y = y self.name = name self.color = color self.size = size # calculate the distance to another node with ...
true
fd09333d11e27a068f4f0eddc9aae64842ac97d4
Python
ColinMcCullough/ColinMcCullough.github.io
/cs260/data_structures/ch_six_hw/test_binheap.py
UTF-8
5,884
3.234375
3
[]
no_license
from binheap import * import unittest class BinaryHeapTests(unittest.TestCase): def setUp(self): self.minbst = BinHeap(True,10) self.maxbst = BinHeap(False,10) def test_properties(self): self.assertEqual(self.minbst.heapList,[0]) self.assertEqual(self.maxbst.heapList,[0]) ...
true
bf99e0549f4ef0954a23c165483b93bbcaa450af
Python
SerMeliodas/space_Shooterw
/space_shooter/game_objects.py
UTF-8
7,184
2.875
3
[]
no_license
import pygame import random from settings import * #============Bullet=============== class Bullet(pygame.sprite.Sprite): def __init__(self,position): super(Bullet,self).__init__() self.image = pygame.image.load('assets/bullet.png') self.rect = self.image.get_rect() self.rect.midbott...
true
699db5ad5eb7149dc6baead23eddc8ca49985306
Python
ericick/literal_mini_game
/game/iuuihw.py
UTF-8
2,104
2.6875
3
[]
no_license
#-*-coding:utf-8-*- from jiiu import uuju, xrze #======================================================================== #======================================================================== class Game(object): def enter(self): return 'mine' #==================================================================...
true
f267e181bba8de580b89cea2442887c4950f9363
Python
chiwah-keen/flask-demo-pro
/src/conf/loader.py
UTF-8
1,218
2.671875
3
[]
no_license
#! /usr/bin/env python # -*- coding:utf-8 -*- """ Created on 2020年02月06日 @author: jianzhihua 配置加载器 """ import os conf_dict = {} def load_from_file(file_path=None): ''' @param file_path 从配置文件中加载配置 ''' file_path = file_path or env_loader('CONF_FILE_PATH') or "/run/secrets/global.conf" if os.p...
true
986f016bf60312912c34627fb2830cedf9a9c497
Python
henriqueguarneri/anisotroPy
/transformation.py
UTF-8
10,731
2.625
3
[ "BSD-3-Clause" ]
permissive
import math import pandas as pd import numpy as np from scipy.spatial.distance import cdist, pdist import matplotlib.pyplot as plt import gc class Transformation(object): def __init__(self, basepath, basegrid, msp=1000, st = 0.0001): self.basepath = basepath.basepath self.basegrid = basegrid.ba...
true
2ed55d41a528387e5273f2bf1461382a65e1b512
Python
fredrikt/nerds
/producers/juniper_conf/util/logger.py
UTF-8
136
2.9375
3
[]
no_license
def error(msg): print("ERROR: {0}".format(msg)) def warn(msg): _log("WARN: {0}".format(msg)) def _log(msg): print(msg)
true
ae39bdf65e12d3a85b84101334dd235f93121d62
Python
cutesparrow/Intuduce-to-algorithm
/Part3/Chapter11/11-1.py
UTF-8
1,248
3.359375
3
[]
no_license
#hash table can find or delete in O(1) class HashTable: potential_length = [11, 41, 71, 131, 251, 541, 761, 1091, 1181] def __init__(self): self._length = 0 self._rate = 0 self._count = 0 self._list = [(None, None) for i in range(self.potential_length[self....
true
53d69d27ff3fe1b82066b3ea01a5b3df0d93ff50
Python
laocaicaicai/algorithm
/Week_04/id_3/dp/LeetCode_63_3_v2.py
UTF-8
788
3.40625
3
[]
no_license
""" 尝试DP """ class Solution: def uniquePathsWithObstacles(self, grid) -> int: if not grid or not grid[0]: return 0 for m in range(len(grid)): for n in range(len(grid[0])): if grid[m][n] == 1: grid[m][n] = 0 continue ...
true
d0b7d86c06970220aad76c148b8d7ab90cf829fe
Python
starknguyen/data-science-python-uni-helsinki
/DataScienceUniHelsinki/Week01/unittest/reverse_dictionary_tst.py
UTF-8
1,547
3.109375
3
[]
no_license
#!/usr/bin/env python3 import unittest from unittest.mock import patch from Week01.reverse_dictionary import reverse_dictionary class ReverseDictionary(unittest.TestCase): def test_first(self): d = {"move": ["liikuttaa"], "hide": ["piilottaa", "salata"]} sd = str(d) r = reverse_dictionar...
true
8367b143b590a28e233739d452b3e5b273f1dcd2
Python
kevinrankine/1401-projects
/mini3/cool.py
UTF-8
2,571
3.234375
3
[]
no_license
import numpy as np from copy import copy import matplotlib.pyplot as plt ''' input_neurons : [(neuron, weight), ..., (neuron, weight)] tau : between [0, 1], regulates inertia of neuron's input default_value : value an input neuron outputs (either 0 or 1) ''' class Neuron(object): def __init__(self, input_neurons =...
true
25a7bb6ebb36b8e1f4238c51abc4a91016c5c21a
Python
osho1278/calculator-minor
/main.py
UTF-8
89
2.671875
3
[]
no_license
from add import add from subtract import subtract print(add(5,5)) print(subtract(50,5))
true
8267f137f37b349e6e7085c37ca27cf14bf1aa16
Python
DaHuO/Supergraph
/codes/CodeJamCrawler/16_0_1/guilhermedelima/A.py
UTF-8
547
3.375
3
[]
no_license
#!/usr/bin/python2 import sys def append_num( N, digit ): num = str( N ) for i in num: digit[ ord( i ) - ord( '0' ) ] = True def solve(N): if N == 0: return 'INSOMNIA' digit = [ False for i in range(10) ] count = 1 while( False in digit ): append_num( N*count, digit ) count = count+1 return st...
true
25abcc3d93372f82997680c61de6de68c8e74afd
Python
yjshi2015/PythonDemo
/com/syj/demo/firstDistributedSpider/NodeManager.py
UTF-8
5,152
2.890625
3
[]
no_license
# coding=utf-8 from DataOutput import DataOutput from UrlManager import UrlManager import time from multiprocessing.managers import BaseManager from multiprocessing import Process, Queue class NodeManager(object): def start_manager(self, url_q, result_q): ''' 创建一个分布式管理器 :param url_q: UR...
true
d93517a9e16392fb2b293e3849b05bbef25e1fa6
Python
frankplus/electricityconsumptionapi
/app.py
UTF-8
1,627
2.59375
3
[]
no_license
from flask import Flask from flask import request import mysql.connector import sys import json import hashlib with open('config.json') as config_data_file: config = json.load(config_data_file) mysqlconfig = config['mysql'] appconfig = config['app'] mydb = mysql.connector.connect( host=mysqlconfig['host'], ...
true
78f6a43e1e5141b122ebbb4b12de8090661ac584
Python
ADSL-Plucky/learngit
/homework-10/2.py
UTF-8
4,490
3.265625
3
[]
no_license
# -*- encoding: utf-8 -*- ''' @File : 2.py @Time : 2020/06/3 21:30:35 @Author : 黎淞 @Version : 3.7.0 @Contact : 836046238@qq.com ''' ''' 2 设计一个留言本的表(ID,留言内容,留言人,留言时间,是否删除)(表名,和字段名自己设计成英文:注意,不要用中文,用中文的直接0分); 使用PyMySQL 驱动模块,实现对这个表的增加,删除,修改,查询;数据库操作需要加入异常处理逻辑; ''' import pymysql import os import datetim...
true
b38bd73559f7ee02c9f2dedd5ccc39d3b6c43443
Python
JulianWack/MPhysProject
/SU2xSU2_preproduction/calibrate_paras.py
UTF-8
3,263
3.1875
3
[]
no_license
import numpy as np from SU2xSU2 import SU2xSU2 def calibrate(model_paras, sim_paras=None, production_run=False, accel=False): '''For a model, specified by the dictionary model_paras, this function calibrates the values of ell and eps to produce an acceptance rate in the desireable range between 60 and 80%. Wh...
true
12fb02dd1010692755bc9aefcb49b7619dd31443
Python
jarrodmillman/nb2plots
/nb2plots/tests/test_doctree2nb.py
UTF-8
4,554
2.671875
3
[ "BSD-2-Clause" ]
permissive
""" Test conversion of doctree to Jupyter notebook """ from os.path import join as pjoin from glob import glob from nb2plots.converters import to_notebook from nb2plots.ipython_shim import nbf # Shortcuts n_nb = nbf.new_notebook n_md_c = nbf.new_markdown_cell n_c_c = nbf.new_code_cell from nose.tools import assert_e...
true
4221efe820e303b6dbcec5771dd6f37cce1239ae
Python
illikainen/luoda
/tests/plugins/test_markdown.py
UTF-8
1,500
2.703125
3
[ "BSD-2-Clause" ]
permissive
# pylint: disable=W0621 # # Copyright (c) 2019, Hans Jerry Illikainen <hji@dyntopia.com> # # SPDX-License-Identifier: BSD-2-Clause from pathlib import Path from textwrap import dedent from luoda.item import Item from luoda.plugins.markdown import available, run from ..fixtures import tmpdir # pylint: disable=W0611 ...
true
8eb528814a219e584735a84a487d84ba740fd23d
Python
Yorwxue/CPy
/Python_C_API/pymodule.py
UTF-8
324
3.28125
3
[]
no_license
# an example # """ class pycompute(object): def add(self, a, b): return a + b def subtraction(self, a, b): return a - b def compute(self, a, b): print("a = %.2f" % a) print("b = %.2f" % b) # c = self.add(a, b) c = self.subtraction(a, b) return c # ...
true
31aed61f8d87e86361c32490cf6962f0181e1a39
Python
al3xhh/CloudAndBigDataProgrammingAssigments
/P22_spark.py
UTF-8
317
2.515625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/python import sys from pyspark import SparkContext sc = SparkContext() logRDD = sc.textFile('../Data/P12_data') logRDD = logRDD.map(lambda log: log.split()) logRDD = logRDD.map(lambda log: (log[6], 1)) logRDD = logRDD.reduceByKey(lambda key, value: key + value) firstTen = logRDD.take(10) print firstTen
true
49f39e47436a189ea3221f71efc86f01f005c617
Python
RobertTLange/picknmix
/picknmix/picknmix.py
UTF-8
8,486
3.25
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """Pick n Mix is a simple stacking tool for stacking Sci-Kit learn models of your picks. It provided 2 classes: Layer and Stack. Layer is a parallel combination of models, while Stack combine Layers to create a stacking model""" from copy import deepcopy import numpy as np import warnings cla...
true
36d33f7dc893f893e61f2f3fa3bcaf6853e1c282
Python
ChihchengHsieh/EventLogDiCE
/cf_search/CfSearcher.py
UTF-8
3,610
2.671875
3
[]
no_license
import tensorflow as tf import pandas as pd import textdistance class CfSearcher(object): def __init__(self, training_df, pred_model, milestones=[ "A_SUBMITTED_COMPLETE", "A_PARTLYSUBMITTED_COMPLETE", "A_PREACCEPTED_COMPLETE", "A_ACCEPTED_COMPLETE", "A_FINALIZED_COMPLETE", ...
true
50a0f4736c7083914702df15769cd1b668ea1b18
Python
yunaichun/python3-study
/03基础库/文件和目录.py
UTF-8
498
2.9375
3
[]
no_license
import os # from os import path print(os.path.abspath('.')) print(os.path.exists('/Users')) print(os.path.isfile('/Users')) print(os.path.isdir('/Users')) print(os.path.join('/Users/', 'a')) from pathlib import Path p = Path('.') print(p.resolve()) # 等价于 print(os.path.abspath('.')) print(p.exists()) print(p.is_file()...
true
61ecc308d5ebbf91bdae81149f234377f0aacd30
Python
unjambonakap/ctf
/hacklu/2010/ch5.bak/bot.py
UTF-8
2,473
2.53125
3
[]
no_license
#!/usr/bin/python from operator import indexOf; import re; import socket; import sys; from battleships import *; from redbeard import *; msgSuccess = ["Hahaha, is this your first sea-fight?!", "HrhrhrhrHrrrrrr!", "*Sing* 13 men on the dead man's chest, and a buddle of rum...","W0000ty!","rofl","You callin you'self mi...
true
0d0f59c515e0ffb55bfba1cdbb884fa089a7f62f
Python
krenevych/programming
/P_04/ex_5.py
UTF-8
774
4.15625
4
[]
no_license
""" Приклад 4.4. Визначити найменший з елементів квадратної дійсної матриці порядку N. """ # Блок введення матриці з клавіатури N = int(input("Кількість рядків матриці ")) M = [] # Створюємо порожню матрицю for i in range(N): # Вводимо рядок матриці row з клавіатури row = list(map(float, input("%d: ...
true
da2ac8765dd0f194188cb9e2e7554161a01c6caa
Python
destroyerdust/Citation-Needed-AI
/server/main.py
UTF-8
6,085
3.0625
3
[]
no_license
#!/usr/bin/python """ Main server for the AI competition """ # Creates a child process for the competitor AI, communicates via STDIO # # Main processing: # 1- write world state to player process # 2- wait for input from player process # 3- process player output # 4- sanity check world state; verify pla...
true
adf1ff716765ed73fac0b4237c2a66379f2b5d1f
Python
wfslithtaivs/InterviewPrepTasks
/patternmatch.py
UTF-8
2,854
3.953125
4
[]
no_license
"""Check if pattern matches. Given a "pattern string" starting with "a" and including only "a" and "b" characters, check to see if a provided string matches that pattern. For example, the pattern "aaba" matches the string "foofoogofoo" but not "foofoofoodog". Patterns can only contain a and b and must start with a: ...
true
b1bb4f33c87c9f53da18b2477c537f563c5caa43
Python
nyu-cds/yfc259_assignment3
/mpi_assignment_2.py
UTF-8
1,845
4.0625
4
[]
no_license
""" Author: Yu-Fen Chiu Date: 04/16/2017 Question 2: Write an MPI program in which the first process get an integer less than 100 and send to the second process. Then each process multiples the number with their ranks and continues to the last process. Then the final result is send to the first process and printed. ...
true
a60768771d974a354b8ea6b4ba2f74e43f4c355d
Python
JoseEvanan/frikr
/users/serializers.py
UTF-8
2,307
2.984375
3
[]
no_license
from django.contrib.auth.models import User from rest_framework import serializers class UserSerializer(serializers.Serializer): id = serializers.ReadOnlyField() # read only first_name = serializers.CharField() last_name = serializers.CharField() username = serializers.CharField() email = serializ...
true
668c2af8c90533f05fdd070449e257183f600bec
Python
shepdl/Russian-Text-Mining
/screen-scraping/extract_author_links.py
UTF-8
5,010
2.828125
3
[]
no_license
# coding=utf8 __author__ = 'Dave Shepard' from selenium import webdriver from selenium.common.exceptions import NoSuchElementException class AuthorLinkExtractor(object): def __init__(self): self.browser = webdriver.Firefox() def get_links_from_individual_sections(self, author_link, sections): ...
true
0d8fe3230af77e51eb67fb56b0e244feeeba0db1
Python
MidD3Vil/Consulta-DNS
/main.py
UTF-8
3,483
2.96875
3
[ "Apache-2.0" ]
permissive
import time import socket from requests import get import smtplib import socket import os print('') restart = 'S' while restart == 'S': if os.name == 'nt': os.system('cls') else: os.system('clear') print('#####################') time.sleep(0.5) print('Consulta de IP por DNS') t...
true
7ed5525feae66263b45558b0906f937835f7c669
Python
SatyaChipp/PythonImpls
/LinkedLists/doublyLinkedLists.py
UTF-8
2,538
3.609375
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Jun 7 16:13:51 2018 @author: Jen """ class Node(object): def __init__(self, data, prev=None, next=None): self.data = data self.prev = prev self.next = next class doubleLinkedLists(object): head=None tail=None def size(self): ...
true
38ea8c6030bf0d671a7234eef823eea98b16702c
Python
SeseelLybon/Minefield
/source/statemanager.py
UTF-8
2,458
2.625
3
[]
no_license
from enum import Enum from enum import auto import pyglet from button import Button from chunkmanager import ChunkManager from scoremanager import ScoreManager from configmanager import ConfigManager class MineField: window_size = ConfigManager.config_dict.get("window_size") score_label = pyglet.text.Labe...
true
14a10b80d44d499bb4935a6909157798429c3c12
Python
Vijendrapratap/Machine-Learning
/Week4/Matplotlib/Barchart/1.WAP to display a bar chart of the popularity of programming Languages.py
UTF-8
572
4.09375
4
[]
no_license
""" Write a Python programming to display a bar chart of the popularity of programming Languages. Sample data: Programming languages: Java, Python, PHP, JavaScript, C#, C++ Popularity: 22.2, 17.6, 8.8, 8, 7.7, 6.7 """ import matplotlib.pyplot as plt languages = ['Java', 'Python', 'PHP', 'JavaScript', 'C#', 'C++'] pop...
true
8858ec01ae81627b0dea8d4e0fcc9dca437a1481
Python
fmpn2/teste-lista-1-gracafpaula
/questao2.py
UTF-8
229
3.734375
4
[]
no_license
#peca ao usuario um numero e verifique se este numero eh par. imprima na tela o resultado da sua verificacao. numero = int(input("digite um numero")) if(numero%2==0): print("numero eh par") else: print("numero nao eh par")
true
4a842258855a96898e4af2cb5f3e3f7379449e83
Python
noahsmitty/cs121cities
/main.py
UTF-8
4,916
3.109375
3
[]
no_license
""" AUTHORS: Josh Cheung, Noah Smith, Arun Ramakrishna, Chuksi Emuwa, Giovanni Castro DESCRIPTION: Our main app file using Flask and Fastai, responsible for taking an input image from our frontend, sending it to the appropriate models, returning a prediction, and routing between our two webpag...
true
2fbe30bac55108665810c796c55cce508a0fcf67
Python
bam-lab/MagneticMicromanipulatorAPI
/Demagnetization/demag.py
UTF-8
3,408
3
3
[ "MIT" ]
permissive
import time import RPi.GPIO as GPIO from getField import getField, getFieldAvg # The main functions are: # print(getField()) # print(getFieldAvg(int)) from power_supply import PowerSupply ps = PowerSupply('/dev/ttyUSB0') def calibrate(): print("Calibrating no field condition...") return(getFieldAvg(20)) ...
true
ddde5531f9263ef392eb24dd66a8b894bf77c6f0
Python
adamluna/web-335
/week-8/luna_calculator.py
UTF-8
657
4.53125
5
[]
no_license
# ======================================== # Title: luna_calculator.py # Author: Adam Luna # Date: 9 May 2021 # Description: Create a calculator using Python. # ======================================== # Create an “add” function with two parameters and return the total def add(add1, add2): return add1 + add2 # Cr...
true
ff57e2abb92625ac3fe060026d9be84d0058ddfc
Python
jhonatang1988/holbertonschool-web_back_end
/0x01-python_async_function/3-tasks.py
UTF-8
306
2.78125
3
[]
no_license
#!/usr/bin/env python3 """ tasks """ import asyncio wait_random = __import__('0-basic_async_syntax').wait_random def task_wait_random(max_delay: int) -> asyncio.Task: """ tasks :param max_delay: max delay :return: an asyncio task """ return asyncio.Task(wait_random(max_delay))
true
6c4e1f8183528cdb1f62afad08c472383e6cb0b3
Python
SamelaBruna/Curso-Python
/ex058.py
UTF-8
492
3.875
4
[]
no_license
from random import randint numRand = randint(0,10) tentativa = 1 jogada = int(input('Vamos Jogar!?\nAcabei de pensar em um número entre 0 e 10, será que você consegue adivinhar? ')) while numRand != jogada: if jogada < numRand: jogada = int(input('Mais...Tente novamente: ')) palpite += 1 ...
true
022e455a34b15c1f400d53042c75e384ccc1af41
Python
Arc676/Advent-of-Code-2017
/Day6/realloc2.py
UTF-8
696
3.1875
3
[ "MIT" ]
permissive
#!/usr/bin/python def findMax(arr): i = 0 j = 0 maxVal = arr[0] for val in arr: if val > maxVal: maxVal = val i = j j += 1 return i, maxVal filename = raw_input("Enter filename: ") file = open(filename, 'r') banks = [int(i) for i in file.readline().split('\t')] states = [] reallocations = 0 toRepeat =...
true
d3b371bc0f0ec1cda70ac3d83485a28e2ce69c90
Python
Biju-vinoth/LPHW
/ex11.py
UTF-8
597
3.484375
3
[]
no_license
''' #============================================================================= # FileName: ex11.py # Desc: recieve the input from keyboard # Author: Honglong Wu # Email: wuhonglong@genomics.cn # Version: 0.0.1 # Created: 04/03/2015 # History: #==============================...
true
4f9d56da858336948b70b2f45970398b5d904f27
Python
nicolaspoulain/travaux
/python/curses_example.py
UTF-8
1,465
3.6875
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import curses """ pad = curses.newpad(100, 100) # These loops fill the pad with letters; this is # explained in the next section for y in range(0, 100): for x in range(0, 100): try: pad.addch(y,x, ord('a') + (x*x+y*y) % 26) except curses.e...
true
425827c2fef1323e90fd9ebdaafa863501059546
Python
CourseraK2/ud617Intro2HadoopMR
/code/lesson_4_weekday_sum_red.py
UTF-8
550
2.890625
3
[]
no_license
#!/usr/bin/python import sys def reducer(): old_key = None total = 0 for line in sys.stdin: data = line.strip().split("\t") if len(data) != 2: continue this_key, sale = data if old_key and old_key != this_key: print "{0}\t{1}".format(old_key, total) ...
true
6775d8abad105fbd3be3e255dbc638b314c1fc68
Python
annsshadow/fakepractice
/py/beg/createfile.py
UTF-8
580
3.4375
3
[]
no_license
#! /usr/bin/env python 'createfile.py : to create text file' import os ls = os.linesep # get the filename while True: if os.path.exists(fname): print "[ERROR]: '%s' already exists" % fname else: break # get file content:text line all = [] print "\nenter lines ('.' by itself to quit).\n" # loop until user fin...
true
ab85501bbc67b44a99828323d3cf15933d47fc6d
Python
YorkFish/git_study
/CodingInterviews/python/21_is_pop_order.py
UTF-8
600
3.328125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # coding:utf-8 class Solution: def IsPopOrder(self, pushV, popV): if pushV is None or len(pushV) != len(popV): return None stk = [] idx = 0 for num in pushV: stk.append(num) while stk and stk[-1] == popV[idx]: ...
true