-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeque.py
48 lines (36 loc) · 1.01 KB
/
Deque.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from abc import ABCMeta, abstractmethod
# DO NOT CHANGE ANYTHING IN THIS FILE
# (but look into what these things mean)
class Deque(metaclass=ABCMeta):
@classmethod
def __subclasshook__(child):
print('here')
required_methods = {'push_front', 'push_back', 'peek_front', 'peek_back', 'pop_front', 'pop_back'}
if required_methods <= child.__dict__.keys():
return True
return False
@abstractmethod
def __str__(self):
raise NotImplementedError
@abstractmethod
def __len__(self):
raise NotImplementedError
@abstractmethod
def push_front(self, val):
raise NotImplementedError
@abstractmethod
def pop_front(self):
raise NotImplementedError
@abstractmethod
def peek_front(self):
raise NotImplementedError
@abstractmethod
def push_back(self, val):
raise NotImplementedError
@abstractmethod
def pop_back(self):
raise NotImplementedError
@abstractmethod
def peek_back(self):
raise NotImplementedError
# DO NOT CHANGE ANYTHING IN THIS FILE