-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollections.py
133 lines (93 loc) · 3.71 KB
/
collections.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
"""
Module: 'collections' on esp32 1.11.0
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-580-g973f68780 on 2019-11-17', machine='ESP32 module with ESP32')
# Stubber: 1.3.2
class OrderedDict:
"""
Return an instance of a dict subclass, supporting the usual dict methods. An OrderedDict is a dict that remembers the order that keys were first inserted. If a new entry overwrites an existing entry, the original insertion position is left unchanged. Deleting an entry and reinserting it will move it to the end.
Parameters
----------
- [items] :
http://docs.micropython.org/en/latest/library/ucollections.html#ucollections.OrderedDict
"""
def clear(self):
"""
Remove all elements from the deque leaving it with length 0.
https://docs.python.org/3/library/collections.html#collections.deque.clear
"""
pass
def copy(self):
"""
Create a shallow copy of the deque.
https://docs.python.org/3/library/collections.html#collections.deque.copy
"""
pass
def fromkeys(self, iterable):
"""
Parameters
----------
- iterable :
"""
pass
def get():
pass
def items():
pass
def keys():
pass
def pop(self, ):
"""
Remove and return an element from the right side of the deque. If no elements are present, raises an IndexError.
"""
pass
def popitem(self, last=True) -> dict:
"""
The popitem() method for ordered dictionaries returns and removes a (key, value) pair. The pairs are returned in LIFO order if 'last' is true or FIFO order if false.
Parameters
----------
- last = true : order of return
https://docs.python.org/3/library/collections.html#collections.OrderedDict.popitem
"""
pass
def setdefault():
pass
def update():
pass
def values():
pass
class deque:
"""
Deques (double-ended queues) are a list-like container that support O(1) appends and pops from either side of the deque. New deques are created using the following arguments:
Parameters
----------
- iterable : must be the empty tuple, and the new deque is created empty.
- maxlen : must be specified and the deque will be bounded to this maximum length. Once the deque is full, any new items added will discard items from the opposite end.
- [flags] : can be 1 to check for overflow when adding items.
As well as supporting bool and len.
"""
def append(self, x):
"""
Add x to the right side of the deque. Raises IndexError if overflow checking is enabled and there is no more room left.
Parameters
----------
- x
http://docs.micropython.org/en/latest/library/ucollections.html#ucollections.deque.append
"""
pass
def popleft(self):
"""
Remove and return an item from the left side of the deque. Raises IndexError if no items are present.
http://docs.micropython.org/en/latest/library/ucollections.html#ucollections.deque.popleft
"""
pass
def namedtuple(name, fields):
"""
This is factory function to create a new namedtuple type with a specific name and set of fields. A namedtuple is a subclass of tuple which allows to access its fields not just by numeric index, but also with an attribute access syntax using symbolic field names
Parameters
----------
- name : name of the tuple
- fields : sequence of strings specifying field names.
http://docs.micropython.org/en/latest/library/ucollections.html#ucollections.namedtuple
"""
pass