1#!/usr/bin/env python2.7
2# -*- coding: utf-8 -*-
3"""
4.. *************
5Built-in Types
6**************
7
8The following sections describe the standard types that are built into the
9interpreter.
10
11"""
12class set:
13
14
15	"""frozenset([iterable])
16
17	Return a new set or frozenset object whose elements are taken from
18	*iterable*.  The elements of a set must be hashable.  To represent sets of
19	sets, the inner sets must be :class:`frozenset` objects.  If *iterable* is
20	not specified, a new empty set is returned.
21
22	Instances of :class:`set` and :class:`frozenset` provide the following
23	operations:
24
25	"""
26
27
28	def __init__(self, ):
29		pass
30
31	def isdisjoint(self, other):
32		"""
33		Return True if the set has no elements in common with *other*.  Sets are
34		disjoint if and only if their intersection is the empty set.
35
36		"""
37		pass
38
39	def issubset(self, other):
40		"""set <= other
41
42		Test whether every element in the set is in *other*.
43
44		"""
45		pass
46
47	def set"other(self, ():
48		"""
49		Test whether the set is a true subset of *other*, that is,
50		``set <= other and set != other``.
51
52		"""
53		pass
54
55	def issuperset(self, other):
56		"""set >= other
57
58		Test whether every element in *other* is in the set.
59
60		"""
61		pass
62
63	def set"other(self, ():
64		"""
65		Test whether the set is a true superset of *other*, that is, ``set >=
66		other and set != other``.
67
68		"""
69		pass
70
71	def union(self, other,more):
72		"""set | other | more
73
74		Return a new set with elements from the set and all others.
75
76		"""
77		pass
78
79	def intersection(self, other,more):
80		"""set & other & more
81
82		Return a new set with elements common to the set and all others.
83
84		"""
85		pass
86
87	def difference(self, other,more):
88		"""set - other - more
89
90		Return a new set with elements in the set that are not in the others.
91
92		"""
93		pass
94
95	def symmetric_difference(self, other):
96		"""set ^ other
97
98		Return a new set with elements in either the set or *other* but not both.
99
100		"""
101		pass
102
103	def copy(self, ):
104		"""
105		Return a new set with a shallow copy of *s*.
106
107
108		Note, the non-operator versions of :meth:`union`, :meth:`intersection`,
109		:meth:`difference`, and :meth:`symmetric_difference`, :meth:`issubset`, and
110		:meth:`issuperset` methods will accept any iterable as an argument.  In
111		contrast, their operator based counterparts require their arguments to be
112		sets.  This precludes error-prone constructions like ``set('abc') & 'cbs'``
113		in favor of the more readable ``set('abc').intersection('cbs')``.
114
115		Both :class:`set` and :class:`frozenset` support set to set comparisons. Two
116		sets are equal if and only if every element of each set is contained in the
117		other (each is a subset of the other). A set is less than another set if and
118		only if the first set is a proper subset of the second set (is a subset, but
119		is not equal). A set is greater than another set if and only if the first set
120		is a proper superset of the second set (is a superset, but is not equal).
121
122		Instances of :class:`set` are compared to instances of :class:`frozenset`
123		based on their members.  For example, ``set('abc') == frozenset('abc')``
124		returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``.
125
126		The subset and equality comparisons do not generalize to a complete ordering
127		function.  For example, any two disjoint sets are not equal and are not
128		subsets of each other, so *all* of the following return ``False``: ``a<b``,
129		``a==b``, or ``a>b``. Accordingly, sets do not implement the :meth:`__cmp__`
130		method.
131
132		Since sets only define partial ordering (subset relationships), the output of
133		the :meth:`list.sort` method is undefined for lists of sets.
134
135		Set elements, like dictionary keys, must be :term:`hashable`.
136
137		Binary operations that mix :class:`set` instances with :class:`frozenset`
138		return the type of the first operand.  For example: ``frozenset('ab') |
139		set('bc')`` returns an instance of :class:`frozenset`.
140
141		The following table lists operations available for :class:`set` that do not
142		apply to immutable instances of :class:`frozenset`:
143
144		"""
145		pass
146
147	def update(self, other,more):
148		"""set |= other | more
149
150		Update the set, adding elements from all others.
151
152		"""
153		pass
154
155	def intersection_update(self, other,more):
156		"""set &= other & more
157
158		Update the set, keeping only elements found in it and all others.
159
160		"""
161		pass
162
163	def difference_update(self, other,more):
164		"""set -= other | more
165
166		Update the set, removing elements found in others.
167
168		"""
169		pass
170
171	def symmetric_difference_update(self, other):
172		"""set ^= other
173
174		Update the set, keeping only elements found in either set, but not in both.
175
176		"""
177		pass
178
179	def add(self, elem):
180		"""
181		Add element *elem* to the set.
182
183		"""
184		pass
185
186	def remove(self, elem):
187		"""
188		Remove element *elem* from the set.  Raises :exc:`KeyError` if *elem* is
189		not contained in the set.
190
191		"""
192		pass
193
194	def discard(self, elem):
195		"""
196		Remove element *elem* from the set if it is present.
197
198		"""
199		pass
200
201	def pop(self, ):
202		"""
203		Remove and return an arbitrary element from the set.  Raises
204		:exc:`KeyError` if the set is empty.
205
206		"""
207		pass
208
209	def clear(self, ):
210		"""
211		Remove all elements from the set.
212
213
214		Note, the non-operator versions of the :meth:`update`,
215		:meth:`intersection_update`, :meth:`difference_update`, and
216		:meth:`symmetric_difference_update` methods will accept any iterable as an
217		argument.
218
219		Note, the *elem* argument to the :meth:`__contains__`, :meth:`remove`, and
220		:meth:`discard` methods may be a set.  To support searching for an equivalent
221		frozenset, the *elem* set is temporarily mutated during the search and then
222		restored.  During the search, the *elem* set should not be read or mutated
223		since it does not have a meaningful value.
224
225
226		"""
227		pass
228
229
230
231
232class dict:
233
234
235	"""
236	Return a new dictionary initialized from an optional positional argument or from
237	a set of keyword arguments. If no arguments are given, return a new empty
238	dictionary. If the positional argument *arg* is a mapping object, return a
239	dictionary mapping the same keys to the same values as does the mapping object.
240	Otherwise the positional argument must be a sequence, a container that supports
241	iteration, or an iterator object.  The elements of the argument must each also
242	be of one of those kinds, and each must in turn contain exactly two objects.
243	The first is used as a key in the new dictionary, and the second as the key's
244	value.  If a given key is seen more than once, the last value associated with it
245	is retained in the new dictionary.
246
247	If keyword arguments are given, the keywords themselves with their associated
248	values are added as items to the dictionary. If a key is specified both in the
249	positional argument and as a keyword argument, the value associated with the
250	keyword is retained in the dictionary. For example, these all return a
251	dictionary equal to ``{"one": 1, "two": 2}``:
252
253	* ``dict(one=1, two=2)``
254	* ``dict({'one': 1, 'two': 2})``
255	* ``dict(zip(('one', 'two'), (1, 2)))``
256	* ``dict([['two', 2], ['one', 1]])``
257
258	The first example only works for keys that are valid Python
259	identifiers; the others work with any valid keys.
260
261	"""
262
263
264	def __init__(self, ):
265		pass
266
267	def clear(self, ):
268		"""
269		Remove all items from the dictionary.
270
271		"""
272		pass
273
274	def copy(self, ):
275		"""
276		Return a shallow copy of the dictionary.
277
278		"""
279		pass
280
281	def _fromkeys(self, seq,value):
282		"""
283		Create a new dictionary with keys from *seq* and values set to *value*.
284
285		:func:`fromkeys` is a class method that returns a new dictionary. *value*
286		defaults to ``None``.
287
288		"""
289		pass
290
291	def get(self, key,default):
292		"""
293		Return the value for *key* if *key* is in the dictionary, else *default*.
294		If *default* is not given, it defaults to ``None``, so that this method
295		never raises a :exc:`KeyError`.
296
297		"""
298		pass
299
300	def has_key(self, key):
301		"""
302		Test for the presence of *key* in the dictionary.  :meth:`has_key` is
303		deprecated in favor of ``key in d``.
304
305		"""
306		pass
307
308	def items(self, ):
309		"""
310		Return a copy of the dictionary's list of ``(key, value)`` pairs.
311
312		"""
313		pass
314
315	def iteritems(self, ):
316		"""
317		Return an iterator over the dictionary's ``(key, value)`` pairs.  See the
318		note for :meth:`dict.items`.
319
320		Using :meth:`iteritems` while adding or deleting entries in the dictionary
321		may raise a :exc:`RuntimeError` or fail to iterate over all entries.
322
323		"""
324		pass
325
326	def iterkeys(self, ):
327		"""
328		Return an iterator over the dictionary's keys.  See the note for
329		:meth:`dict.items`.
330
331		Using :meth:`iterkeys` while adding or deleting entries in the dictionary
332		may raise a :exc:`RuntimeError` or fail to iterate over all entries.
333
334		"""
335		pass
336
337	def itervalues(self, ):
338		"""
339		Return an iterator over the dictionary's values.  See the note for
340		:meth:`dict.items`.
341
342		Using :meth:`itervalues` while adding or deleting entries in the
343		dictionary may raise a :exc:`RuntimeError` or fail to iterate over all
344		entries.
345
346		"""
347		pass
348
349	def keys(self, ):
350		"""
351		Return a copy of the dictionary's list of keys.  See the note for
352		:meth:`dict.items`.
353
354		"""
355		pass
356
357	def pop(self, key,default):
358		"""
359		If *key* is in the dictionary, remove it and return its value, else return
360		*default*.  If *default* is not given and *key* is not in the dictionary,
361		a :exc:`KeyError` is raised.
362
363		"""
364		pass
365
366	def popitem(self, ):
367		"""
368		Remove and return an arbitrary ``(key, value)`` pair from the dictionary.
369
370		:func:`popitem` is useful to destructively iterate over a dictionary, as
371		often used in set algorithms.  If the dictionary is empty, calling
372		:func:`popitem` raises a :exc:`KeyError`.
373
374		"""
375		pass
376
377	def setdefault(self, key,default):
378		"""
379		If *key* is in the dictionary, return its value.  If not, insert *key*
380		with a value of *default* and return *default*.  *default* defaults to
381		``None``.
382
383		"""
384		pass
385
386	def update(self, other):
387		"""
388		Update the dictionary with the key/value pairs from *other*, overwriting
389		existing keys.  Return ``None``.
390
391		:func:`update` accepts either another dictionary object or an iterable of
392		key/value pairs (as tuples or other iterables of length two).  If keyword
393		arguments are specified, the dictionary is then updated with those
394		key/value pairs: ``d.update(red=1, blue=2)``.
395
396		"""
397		pass
398
399	def values(self, ):
400		"""
401		Return a copy of the dictionary's list of values.  See the note for
402		:meth:`dict.items`.
403
404		"""
405		pass
406
407	def viewitems(self, ):
408		"""
409		Return a new view of the dictionary's items (``(key, value)`` pairs).  See
410		below for documentation of view objects.
411
412		"""
413		pass
414
415	def viewkeys(self, ):
416		"""
417		Return a new view of the dictionary's keys.  See below for documentation of
418		view objects.
419
420		"""
421		pass
422
423	def viewvalues(self, ):
424		"""
425		Return a new view of the dictionary's values.  See below for documentation of
426		view objects.
427
428		"""
429		pass
430
431
432
433
434class memoryview:
435
436
437	"""
438	Create a :class:`memoryview` that references *obj*.  *obj* must support the
439	buffer protocol.  Built-in objects that support the buffer protocol include
440	:class:`str` and :class:`bytearray` (but not :class:`unicode`).
441
442	A :class:`memoryview` has the notion of an *element*, which is the
443	atomic memory unit handled by the originating object *obj*.  For many
444	simple types such as :class:`str` and :class:`bytearray`, an element
445	is a single byte, but other third-party types may expose larger elements.
446
447	``len(view)`` returns the total number of elements in the memoryview,
448	*view*.  The :class:`~memoryview.itemsize` attribute will give you the
449	number of bytes in a single element.
450
451	A :class:`memoryview` supports slicing to expose its data.  Taking a single
452	index will return a single element as a :class:`str` object.  Full
453	slicing will result in a subview::
454
455	>>> v = memoryview('abcefg')
456	>>> v[1]
457	'b'
458	>>> v[-1]
459	'g'
460	>>> v[1:4]
461	<memory at 0x77ab28>
462	>>> v[1:4].tobytes()
463	'bce'
464
465	If the object the memoryview is over supports changing its data, the
466	memoryview supports slice assignment::
467
468	>>> data = bytearray('abcefg')
469	>>> v = memoryview(data)
470	>>> v.readonly
471	False
472	>>> v[0] = 'z'
473	>>> data
474	bytearray(b'zbcefg')
475	>>> v[1:4] = '123'
476	>>> data
477	bytearray(b'z123fg')
478	>>> v[2] = 'spam'
479	Traceback (most recent call last):
480	File "<stdin>", line 1, in <module>
481	ValueError: cannot modify size of memoryview object
482
483	Notice how the size of the memoryview object cannot be changed.
484
485	:class:`memoryview` has two methods:
486
487	"""
488
489
490	def __init__(self, ):
491		pass
492
493	def tobytes(self, ):
494		"""
495		Return the data in the buffer as a bytestring (an object of class
496		:class:`str`). ::
497
498		>>> m = memoryview("abc")
499		>>> m.tobytes()
500		'abc'
501
502		"""
503		pass
504
505	def tolist(self, ):
506		"""
507		Return the data in the buffer as a list of integers. ::
508
509		>>> memoryview("abc").tolist()
510		[97, 98, 99]
511
512		There are also several readonly attributes available:
513
514		"""
515		pass
516
517
518
519
520