Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: third_party/six/documentation/index.rst

Issue 1587593003: Replace six with the current version which passes checklicenses.py. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Update URL field in README.chromium. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/six/README.chromium ('k') | third_party/six/setup.cfg » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Six: Python 2 and 3 Compatibility Library 1 Six: Python 2 and 3 Compatibility Library
2 ========================================= 2 =========================================
3 3
4 .. module:: six 4 .. module:: six
5 :synopsis: Python 2 and 3 compatibility 5 :synopsis: Python 2 and 3 compatibility
6 6
7 .. moduleauthor:: Benjamin Peterson <benjamin@python.org> 7 .. moduleauthor:: Benjamin Peterson <benjamin@python.org>
8 .. sectionauthor:: Benjamin Peterson <benjamin@python.org> 8 .. sectionauthor:: Benjamin Peterson <benjamin@python.org>
9 9
10 10
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 226
227 .. function:: create_bound_method(func, obj) 227 .. function:: create_bound_method(func, obj)
228 228
229 Return a method object wrapping *func* and bound to *obj*. On both Python 2 229 Return a method object wrapping *func* and bound to *obj*. On both Python 2
230 and 3, this will return a :func:`py3:types.MethodType` object. The reason 230 and 3, this will return a :func:`py3:types.MethodType` object. The reason
231 this wrapper exists is that on Python 2, the ``MethodType`` constructor 231 this wrapper exists is that on Python 2, the ``MethodType`` constructor
232 requires the *obj*'s class to be passed. 232 requires the *obj*'s class to be passed.
233 233
234 234
235 .. function:: create_unbound_method(func, cls)
236
237 Return an unbound method object wrapping *func*. In Python 2, this will
238 return a :func:`py2:types.MethodType` object. In Python 3, unbound methods
239 do not exist and this wrapper will simply return *func*.
240
241
235 .. class:: Iterator 242 .. class:: Iterator
236 243
237 A class for making portable iterators. The intention is that it be subclassed 244 A class for making portable iterators. The intention is that it be subclassed
238 and subclasses provide a ``__next__`` method. In Python 2, :class:`Iterator` 245 and subclasses provide a ``__next__`` method. In Python 2, :class:`Iterator`
239 has one method: ``next``. It simply delegates to ``__next__``. An alternate 246 has one method: ``next``. It simply delegates to ``__next__``. An alternate
240 way to do this would be to simply alias ``next`` to ``__next__``. However, 247 way to do this would be to simply alias ``next`` to ``__next__``. However,
241 this interacts badly with subclasses that override 248 this interacts badly with subclasses that override
242 ``__next__``. :class:`Iterator` is empty on Python 3. (In fact, it is just 249 ``__next__``. :class:`Iterator` is empty on Python 3. (In fact, it is just
243 aliased to :class:`py3:object`.) 250 aliased to :class:`py3:object`.)
244 251
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 383
377 A "fake" unicode literal. *text* should always be a normal string literal. 384 A "fake" unicode literal. *text* should always be a normal string literal.
378 In Python 2, :func:`u` returns unicode, and in Python 3, a string. Also, in 385 In Python 2, :func:`u` returns unicode, and in Python 3, a string. Also, in
379 Python 2, the string is decoded with the ``unicode-escape`` codec, which 386 Python 2, the string is decoded with the ``unicode-escape`` codec, which
380 allows unicode escapes to be used in it. 387 allows unicode escapes to be used in it.
381 388
382 389
383 .. note:: 390 .. note::
384 391
385 In Python 3.3, the ``u`` prefix has been reintroduced. Code that only 392 In Python 3.3, the ``u`` prefix has been reintroduced. Code that only
386 supports Python 3 versions greater than 3.3 thus does not need 393 supports Python 3 versions of 3.3 and higher thus does not need
387 :func:`u`. 394 :func:`u`.
388 395
389 .. note:: 396 .. note::
390 397
391 On Python 2, :func:`u` doesn't know what the encoding of the literal 398 On Python 2, :func:`u` doesn't know what the encoding of the literal
392 is. Each byte is converted directly to the unicode codepoint of the same 399 is. Each byte is converted directly to the unicode codepoint of the same
393 value. Because of this, it's only safe to use :func:`u` with strings of 400 value. Because of this, it's only safe to use :func:`u` with strings of
394 ASCII data. 401 ASCII data.
395 402
396 403
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 | ``email_mime_nonmultipart`` | :mod:`py2:email.MIMENonMultipart` | :mod:`py3 :email.mime.nonmultipart` | 570 | ``email_mime_nonmultipart`` | :mod:`py2:email.MIMENonMultipart` | :mod:`py3 :email.mime.nonmultipart` |
564 +------------------------------+-------------------------------------+---------- ---------------------------+ 571 +------------------------------+-------------------------------------+---------- ---------------------------+
565 | ``email_mime_text`` | :mod:`py2:email.MIMEText` | :mod:`py3 :email.mime.text` | 572 | ``email_mime_text`` | :mod:`py2:email.MIMEText` | :mod:`py3 :email.mime.text` |
566 +------------------------------+-------------------------------------+---------- ---------------------------+ 573 +------------------------------+-------------------------------------+---------- ---------------------------+
567 | ``email_mime_base`` | :mod:`py2:email.MIMEBase` | :mod:`py3 :email.mime.base` | 574 | ``email_mime_base`` | :mod:`py2:email.MIMEBase` | :mod:`py3 :email.mime.base` |
568 +------------------------------+-------------------------------------+---------- ---------------------------+ 575 +------------------------------+-------------------------------------+---------- ---------------------------+
569 | ``filter`` | :func:`py2:itertools.ifilter` | :func:`py 3:filter` | 576 | ``filter`` | :func:`py2:itertools.ifilter` | :func:`py 3:filter` |
570 +------------------------------+-------------------------------------+---------- ---------------------------+ 577 +------------------------------+-------------------------------------+---------- ---------------------------+
571 | ``filterfalse`` | :func:`py2:itertools.ifilterfalse` | :func:`py 3:itertools.filterfalse` | 578 | ``filterfalse`` | :func:`py2:itertools.ifilterfalse` | :func:`py 3:itertools.filterfalse` |
572 +------------------------------+-------------------------------------+---------- ---------------------------+ 579 +------------------------------+-------------------------------------+---------- ---------------------------+
580 | ``getcwd`` | :func:`py2:os.getcwdu` | :func:`py 3:os.getcwd` |
581 +------------------------------+-------------------------------------+---------- ---------------------------+
582 | ``getcwdb`` | :func:`py2:os.getcwd` | :func:`py 3:os.getcwdb` |
583 +------------------------------+-------------------------------------+---------- ---------------------------+
573 | ``http_cookiejar`` | :mod:`py2:cookielib` | :mod:`py3 :http.cookiejar` | 584 | ``http_cookiejar`` | :mod:`py2:cookielib` | :mod:`py3 :http.cookiejar` |
574 +------------------------------+-------------------------------------+---------- ---------------------------+ 585 +------------------------------+-------------------------------------+---------- ---------------------------+
575 | ``http_cookies`` | :mod:`py2:Cookie` | :mod:`py3 :http.cookies` | 586 | ``http_cookies`` | :mod:`py2:Cookie` | :mod:`py3 :http.cookies` |
576 +------------------------------+-------------------------------------+---------- ---------------------------+ 587 +------------------------------+-------------------------------------+---------- ---------------------------+
577 | ``html_entities`` | :mod:`py2:htmlentitydefs` | :mod:`py3 :html.entities` | 588 | ``html_entities`` | :mod:`py2:htmlentitydefs` | :mod:`py3 :html.entities` |
578 +------------------------------+-------------------------------------+---------- ---------------------------+ 589 +------------------------------+-------------------------------------+---------- ---------------------------+
579 | ``html_parser`` | :mod:`py2:HTMLParser` | :mod:`py3 :html.parser` | 590 | ``html_parser`` | :mod:`py2:HTMLParser` | :mod:`py3 :html.parser` |
580 +------------------------------+-------------------------------------+---------- ---------------------------+ 591 +------------------------------+-------------------------------------+---------- ---------------------------+
581 | ``http_client`` | :mod:`py2:httplib` | :mod:`py3 :http.client` | 592 | ``http_client`` | :mod:`py2:httplib` | :mod:`py3 :http.client` |
582 +------------------------------+-------------------------------------+---------- ---------------------------+ 593 +------------------------------+-------------------------------------+---------- ---------------------------+
583 | ``BaseHTTPServer`` | :mod:`py2:BaseHTTPServer` | :mod:`py3 :http.server` | 594 | ``BaseHTTPServer`` | :mod:`py2:BaseHTTPServer` | :mod:`py3 :http.server` |
584 +------------------------------+-------------------------------------+---------- ---------------------------+ 595 +------------------------------+-------------------------------------+---------- ---------------------------+
585 | ``CGIHTTPServer`` | :mod:`py2:CGIHTTPServer` | :mod:`py3 :http.server` | 596 | ``CGIHTTPServer`` | :mod:`py2:CGIHTTPServer` | :mod:`py3 :http.server` |
586 +------------------------------+-------------------------------------+---------- ---------------------------+ 597 +------------------------------+-------------------------------------+---------- ---------------------------+
587 | ``SimpleHTTPServer`` | :mod:`py2:SimpleHTTPServer` | :mod:`py3 :http.server` | 598 | ``SimpleHTTPServer`` | :mod:`py2:SimpleHTTPServer` | :mod:`py3 :http.server` |
588 +------------------------------+-------------------------------------+---------- ---------------------------+ 599 +------------------------------+-------------------------------------+---------- ---------------------------+
589 | ``input`` | :func:`py2:raw_input` | :func:`py 3:input` | 600 | ``input`` | :func:`py2:raw_input` | :func:`py 3:input` |
590 +------------------------------+-------------------------------------+---------- ---------------------------+ 601 +------------------------------+-------------------------------------+---------- ---------------------------+
591 | ``intern`` | :func:`py2:intern` | :func:`py 3:sys.intern` | 602 | ``intern`` | :func:`py2:intern` | :func:`py 3:sys.intern` |
592 +------------------------------+-------------------------------------+---------- ---------------------------+ 603 +------------------------------+-------------------------------------+---------- ---------------------------+
593 | ``map`` | :func:`py2:itertools.imap` | :func:`py 3:map` | 604 | ``map`` | :func:`py2:itertools.imap` | :func:`py 3:map` |
594 +------------------------------+-------------------------------------+---------- ---------------------------+ 605 +------------------------------+-------------------------------------+---------- ---------------------------+
595 | ``queue`` | :mod:`py2:Queue` | :mod:`py3 :queue` | 606 | ``queue`` | :mod:`py2:Queue` | :mod:`py3 :queue` |
596 +------------------------------+-------------------------------------+---------- ---------------------------+ 607 +------------------------------+-------------------------------------+---------- ---------------------------+
597 | ``range`` | :func:`py2:xrange` | :func:`py 3:range` | 608 | ``range`` | :func:`py2:xrange` | :func:`py 3:range` |
598 +------------------------------+-------------------------------------+---------- ---------------------------+ 609 +------------------------------+-------------------------------------+---------- ---------------------------+
599 | ``reduce`` | :func:`py2:reduce` | :func:`py 3:functools.reduce` | 610 | ``reduce`` | :func:`py2:reduce` | :func:`py 3:functools.reduce` |
600 +------------------------------+-------------------------------------+---------- ---------------------------+ 611 +------------------------------+-------------------------------------+---------- ---------------------------+
601 | ``reload_module`` | :func:`py2:reload` | :func:`py 3:imp.reload` | 612 | ``reload_module`` | :func:`py2:reload` | :func:`py 3:imp.reload`, |
613 | | | :func:`py 3:importlib.reload` |
614 | | | on Python 3.4+ |
602 +------------------------------+-------------------------------------+---------- ---------------------------+ 615 +------------------------------+-------------------------------------+---------- ---------------------------+
603 | ``reprlib`` | :mod:`py2:repr` | :mod:`py3 :reprlib` | 616 | ``reprlib`` | :mod:`py2:repr` | :mod:`py3 :reprlib` |
604 +------------------------------+-------------------------------------+---------- ---------------------------+ 617 +------------------------------+-------------------------------------+---------- ---------------------------+
605 | ``shlex_quote`` | :mod:`py2:pipes.quote` | :mod:`py3 :shlex.quote` | 618 | ``shlex_quote`` | :mod:`py2:pipes.quote` | :mod:`py3 :shlex.quote` |
606 +------------------------------+-------------------------------------+---------- ---------------------------+ 619 +------------------------------+-------------------------------------+---------- ---------------------------+
607 | ``socketserver`` | :mod:`py2:SocketServer` | :mod:`py3 :socketserver` | 620 | ``socketserver`` | :mod:`py2:SocketServer` | :mod:`py3 :socketserver` |
608 +------------------------------+-------------------------------------+---------- ---------------------------+ 621 +------------------------------+-------------------------------------+---------- ---------------------------+
609 | ``_thread`` | :mod:`py2:thread` | :mod:`py3 :_thread` | 622 | ``_thread`` | :mod:`py2:thread` | :mod:`py3 :_thread` |
610 +------------------------------+-------------------------------------+---------- ---------------------------+ 623 +------------------------------+-------------------------------------+---------- ---------------------------+
611 | ``tkinter`` | :mod:`py2:Tkinter` | :mod:`py3 :tkinter` | 624 | ``tkinter`` | :mod:`py2:Tkinter` | :mod:`py3 :tkinter` |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 modules in Python 2 and 3. *old_mod* is the name of the Python 2 module. 832 modules in Python 2 and 3. *old_mod* is the name of the Python 2 module.
820 *new_mod* is the name of the Python 3 module. 833 *new_mod* is the name of the Python 3 module.
821 834
822 835
823 .. class:: MovedAttribute(name, old_mod, new_mod, old_attr=None, new_attr=None) 836 .. class:: MovedAttribute(name, old_mod, new_mod, old_attr=None, new_attr=None)
824 837
825 Create a mapping for :mod:`six.moves` called *name* that references different 838 Create a mapping for :mod:`six.moves` called *name* that references different
826 attributes in Python 2 and 3. *old_mod* is the name of the Python 2 module. 839 attributes in Python 2 and 3. *old_mod* is the name of the Python 2 module.
827 *new_mod* is the name of the Python 3 module. If *new_attr* is not given, it 840 *new_mod* is the name of the Python 3 module. If *new_attr* is not given, it
828 defaults to *old_attr*. If neither is given, they both default to *name*. 841 defaults to *old_attr*. If neither is given, they both default to *name*.
OLDNEW
« no previous file with comments | « third_party/six/README.chromium ('k') | third_party/six/setup.cfg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698