Issue #25161: Merge full stops from 3.5
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index 0e5ff20..2e2e16f 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -962,6 +962,9 @@
constructor that is convenient for use cases where named tuples are being
subclassed.
+ * :meth:`types.SimpleNamespace` for a mutable namespace based on an underlying
+ dictionary instead of a tuple.
+
:class:`OrderedDict` objects
----------------------------
diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst
index b4c90cd..04ffdb2 100644
--- a/Doc/library/crypt.rst
+++ b/Doc/library/crypt.rst
@@ -64,7 +64,7 @@
A list of available password hashing algorithms, as
``crypt.METHOD_*`` objects. This list is sorted from strongest to
- weakest, and is guaranteed to have at least ``crypt.METHOD_CRYPT``.
+ weakest.
Module Functions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
index 976cd49..cf5d5b8 100644
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -1734,10 +1734,7 @@
otherwise :exc:`ValueError` is raised.
The *name* argument is optional. If specified it must be a string that
- is used as the value returned by the ``tzname(dt)`` method. Otherwise,
- ``tzname(dt)`` returns a string 'UTCsHH:MM', where s is the sign of
- *offset*, HH and MM are two digits of ``offset.hours`` and
- ``offset.minutes`` respectively.
+ will be used as the value returned by the :meth:`datetime.tzname` method.
.. versionadded:: 3.2
@@ -1750,11 +1747,19 @@
.. method:: timezone.tzname(dt)
- Return the fixed value specified when the :class:`timezone` instance is
- constructed or a string 'UTCsHH:MM', where s is the sign of
- *offset*, HH and MM are two digits of ``offset.hours`` and
+ Return the fixed value specified when the :class:`timezone` instance
+ is constructed. If *name* is not provided in the constructor, the
+ name returned by ``tzname(dt)`` is generated from the value of the
+ ``offset`` as follows. If *offset* is ``timedelta(0)``, the name
+ is "UTC", otherwise it is a string 'UTC±HH:MM', where ± is the sign
+ of ``offset``, HH and MM are two digits of ``offset.hours`` and
``offset.minutes`` respectively.
+ .. versionchanged:: 3.6
+ Name generated from ``offset=timedelta(0)`` is now plain 'UTC', not
+ 'UTC+00:00'.
+
+
.. method:: timezone.dst(dt)
Always returns ``None``.
@@ -1904,6 +1909,34 @@
| ``%%`` | A literal ``'%'`` character. | % | |
+-----------+--------------------------------+------------------------+-------+
+Several additional directives not required by the C89 standard are included for
+convenience. These parameters all correspond to ISO 8601 date values. These
+may not be available on all platforms when used with the :meth:`strftime`
+method. The ISO 8601 year and ISO 8601 week directives are not interchangeable
+with the year and week number directives above. Calling :meth:`strptime` with
+incomplete or ambiguous ISO 8601 directives will raise a :exc:`ValueError`.
+
++-----------+--------------------------------+------------------------+-------+
+| Directive | Meaning | Example | Notes |
++===========+================================+========================+=======+
+| ``%G`` | ISO 8601 year with century | 0001, 0002, ..., 2013, | \(8) |
+| | representing the year that | 2014, ..., 9998, 9999 | |
+| | contains the greater part of | | |
+| | the ISO week (``%V``). | | |
++-----------+--------------------------------+------------------------+-------+
+| ``%u`` | ISO 8601 weekday as a decimal | 1, 2, ..., 7 | |
+| | number where 1 is Monday. | | |
++-----------+--------------------------------+------------------------+-------+
+| ``%V`` | ISO 8601 week as a decimal | 01, 02, ..., 53 | \(8) |
+| | number with Monday as | | |
+| | the first day of the week. | | |
+| | Week 01 is the week containing | | |
+| | Jan 4. | | |
++-----------+--------------------------------+------------------------+-------+
+
+.. versionadded:: 3.6
+ ``%G``, ``%u`` and ``%V`` were added.
+
Notes:
(1)
@@ -1968,7 +2001,14 @@
(7)
When used with the :meth:`strptime` method, ``%U`` and ``%W`` are only used
- in calculations when the day of the week and the year are specified.
+ in calculations when the day of the week and the calendar year (``%Y``)
+ are specified.
+
+(8)
+ Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the
+ day of the week and the ISO year (``%G``) are specified in a
+ :meth:`strptime` format string. Also note that ``%G`` and ``%Y`` are not
+ interchangable.
.. rubric:: Footnotes
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 26a2913..af0422f 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -228,24 +228,6 @@
listed in the metaclass' custom :meth:`__dir__`.
-.. function:: getmoduleinfo(path)
-
- Returns a :term:`named tuple` ``ModuleInfo(name, suffix, mode, module_type)``
- of values that describe how Python will interpret the file identified by
- *path* if it is a module, or ``None`` if it would not be identified as a
- module. In that tuple, *name* is the name of the module without the name of
- any enclosing package, *suffix* is the trailing part of the file name (which
- may not be a dot-delimited extension), *mode* is the :func:`open` mode that
- would be used (``'r'`` or ``'rb'``), and *module_type* is an integer giving
- the type of the module. *module_type* will have a value which can be
- compared to the constants defined in the :mod:`imp` module; see the
- documentation for that module for more information on module types.
-
- .. deprecated:: 3.3
- You may check the file path's suffix against the supported suffixes
- listed in :mod:`importlib.machinery` to infer the same information.
-
-
.. function:: getmodulename(path)
Return the name of the module named by the file *path*, without including the
@@ -259,8 +241,7 @@
still return ``None``.
.. versionchanged:: 3.3
- This function is now based directly on :mod:`importlib` rather than the
- deprecated :func:`getmoduleinfo`.
+ The function is based directly on :mod:`importlib`.
.. function:: ismodule(object)
@@ -809,24 +790,6 @@
classes using multiple inheritance and their descendants will appear multiple
times.
-
-.. function:: getargspec(func)
-
- Get the names and default values of a Python function's arguments. A
- :term:`named tuple` ``ArgSpec(args, varargs, keywords, defaults)`` is
- returned. *args* is a list of the argument names. *varargs* and *keywords*
- are the names of the ``*`` and ``**`` arguments or ``None``. *defaults* is a
- tuple of default argument values or ``None`` if there are no default
- arguments; if this tuple has *n* elements, they correspond to the last
- *n* elements listed in *args*.
-
- .. deprecated:: 3.0
- Use :func:`signature` and
- :ref:`Signature Object <inspect-signature-object>`, which provide a
- better introspecting API for callables. This function will be removed
- in Python 3.6.
-
-
.. function:: getfullargspec(func)
Get the names and default values of a Python function's arguments. A
@@ -843,8 +806,6 @@
from kwonlyargs to defaults. *annotations* is a dictionary mapping argument
names to annotations.
- The first four items in the tuple correspond to :func:`getargspec`.
-
.. versionchanged:: 3.4
This function is now based on :func:`signature`, but still ignores
``__wrapped__`` attributes and includes the already bound first
@@ -873,7 +834,7 @@
.. function:: formatargspec(args[, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations[, formatarg, formatvarargs, formatvarkw, formatvalue, formatreturns, formatannotations]])
Format a pretty argument spec from the values returned by
- :func:`getargspec` or :func:`getfullargspec`.
+ :func:`getfullargspec`.
The first seven arguments are (``args``, ``varargs``, ``varkw``,
``defaults``, ``kwonlyargs``, ``kwonlydefaults``, ``annotations``).
diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst
index 0edc942..446a070 100644
--- a/Doc/library/logging.handlers.rst
+++ b/Doc/library/logging.handlers.rst
@@ -162,11 +162,19 @@
first call to :meth:`emit`. By default, the file grows indefinitely.
+ .. method:: reopenIfNeeded()
+
+ Checks to see if the file has changed. If it has, the existing stream is
+ flushed and closed and the file opened again, typically as a precursor to
+ outputting the record to the file.
+
+ .. versionadded:: 3.6
+
+
.. method:: emit(record)
- Outputs the record to the file, but first checks to see if the file has
- changed. If it has, the existing stream is flushed and closed and the
- file opened again, before outputting the record to the file.
+ Outputs the record to the file, but first calls :meth:`reopenIfNeeded` to
+ reopen the file if it has changed.
.. _base-rotating-handler:
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst
index e9a9bdd..3c320ca 100644
--- a/Doc/library/multiprocessing.rst
+++ b/Doc/library/multiprocessing.rst
@@ -868,8 +868,13 @@
.. function:: cpu_count()
- Return the number of CPUs in the system. May raise
- :exc:`NotImplementedError`.
+ Return the number of CPUs in the system.
+
+ This number is not equivalent to the number of CPUs the current process can
+ use. The number of usable CPUs can be obtained with
+ ``len(os.sched_getaffinity(0))``
+
+ May raise :exc:`NotImplementedError`.
.. seealso::
:func:`os.cpu_count`
diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst
index c01e63b..0695391 100644
--- a/Doc/library/operator.rst
+++ b/Doc/library/operator.rst
@@ -333,6 +333,21 @@
[('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)]
+.. data:: subscript
+
+ A helper to turn subscript notation into indexing objects. This can be
+ used to create item access patterns ahead of time to pass them into
+ various subscriptable objects.
+
+ For example:
+
+ * ``subscript[5] == 5``
+ * ``subscript[3:7:2] == slice(3, 7, 2)``
+ * ``subscript[5, 8] == (5, 8)``
+
+ .. versionadded:: 3.6
+
+
.. function:: methodcaller(name[, args...])
Return a callable object that calls the method *name* on its operand. If
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 30f1605..dcd5e65 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -3597,6 +3597,11 @@
Return the number of CPUs in the system. Returns None if undetermined.
+ This number is not equivalent to the number of CPUs the current process can
+ use. The number of usable CPUs can be obtained with
+ ``len(os.sched_getaffinity(0))``
+
+
.. versionadded:: 3.4
diff --git a/Doc/library/time.rst b/Doc/library/time.rst
index 3d335c8..73436ca 100644
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -634,11 +634,11 @@
it is possible to refer to February 29.
:samp:`M{m}.{n}.{d}`
- The *d*'th day (0 <= *d* <= 6) or week *n* of month *m* of the year (1
+ The *d*'th day (0 <= *d* <= 6) of week *n* of month *m* of the year (1
<= *n* <= 5, 1 <= *m* <= 12, where week 5 means "the last *d* day in
month *m*" which may occur in either the fourth or the fifth
week). Week 1 is the first week in which the *d*'th day occurs. Day
- zero is Sunday.
+ zero is a Sunday.
``time`` has the same format as ``offset`` except that no leading sign
('-' or '+') is allowed. The default, if time is not given, is 02:00:00.
diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst
index 40098d0..7c075ad 100644
--- a/Doc/library/urllib.parse.rst
+++ b/Doc/library/urllib.parse.rst
@@ -115,8 +115,9 @@
| | | if present | |
+------------------+-------+--------------------------+----------------------+
- See section :ref:`urlparse-result-object` for more information on the result
- object.
+ Reading the :attr:`port` attribute will raise a :exc:`ValueError` if
+ an invalid port is specified in the URL. See section
+ :ref:`urlparse-result-object` for more information on the result object.
.. versionchanged:: 3.2
Added IPv6 URL parsing capabilities.
@@ -126,6 +127,10 @@
false), in accordance with :rfc:`3986`. Previously, a whitelist of
schemes that support fragments existed.
+ .. versionchanged:: 3.6
+ Out-of-range port numbers now raise :exc:`ValueError`, instead of
+ returning :const:`None`.
+
.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace')
@@ -228,8 +233,13 @@
| | | if present | |
+------------------+-------+-------------------------+----------------------+
- See section :ref:`urlparse-result-object` for more information on the result
- object.
+ Reading the :attr:`port` attribute will raise a :exc:`ValueError` if
+ an invalid port is specified in the URL. See section
+ :ref:`urlparse-result-object` for more information on the result object.
+
+ .. versionchanged:: 3.6
+ Out-of-range port numbers now raise :exc:`ValueError`, instead of
+ returning :const:`None`.
.. function:: urlunsplit(parts)
diff --git a/Doc/library/urllib.robotparser.rst b/Doc/library/urllib.robotparser.rst
index f179de2..c2e1bef 100644
--- a/Doc/library/urllib.robotparser.rst
+++ b/Doc/library/urllib.robotparser.rst
@@ -53,15 +53,41 @@
Sets the time the ``robots.txt`` file was last fetched to the current
time.
+ .. method:: crawl_delay(useragent)
-The following example demonstrates basic use of the RobotFileParser class.
+ Returns the value of the ``Crawl-delay`` parameter from ``robots.txt``
+ for the *useragent* in question. If there is no such parameter or it
+ doesn't apply to the *useragent* specified or the ``robots.txt`` entry
+ for this parameter has invalid syntax, return ``None``.
+
+ .. versionadded:: 3.6
+
+ .. method:: request_rate(useragent)
+
+ Returns the contents of the ``Request-rate`` parameter from
+ ``robots.txt`` in the form of a :func:`~collections.namedtuple`
+ ``(requests, seconds)``. If there is no such parameter or it doesn't
+ apply to the *useragent* specified or the ``robots.txt`` entry for this
+ parameter has invalid syntax, return ``None``.
+
+ .. versionadded:: 3.6
+
+
+The following example demonstrates basic use of the :class:`RobotFileParser`
+class::
>>> import urllib.robotparser
>>> rp = urllib.robotparser.RobotFileParser()
>>> rp.set_url("http://www.musi-cal.com/robots.txt")
>>> rp.read()
+ >>> rrate = rp.request_rate("*")
+ >>> rrate.requests
+ 3
+ >>> rrate.seconds
+ 20
+ >>> rp.crawl_delay("*")
+ 6
>>> rp.can_fetch("*", "http://www.musi-cal.com/cgi-bin/search?city=San+Francisco")
False
>>> rp.can_fetch("*", "http://www.musi-cal.com/")
True
-
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index 01cfd6d..00e6476 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -471,10 +471,10 @@
decorators: `decorator`+
decorator: "@" `dotted_name` ["(" [`parameter_list` [","]] ")"] NEWLINE
dotted_name: `identifier` ("." `identifier`)*
- parameter_list: (`defparameter` ",")*
- : | "*" [`parameter`] ("," `defparameter`)* ["," "**" `parameter`]
- : | "**" `parameter`
- : | `defparameter` [","] )
+ parameter_list: `defparameter` ("," `defparameter`)* ["," [`parameter_list_starargs`]]
+ : | `parameter_list_starargs`
+ parameter_list_starargs: "*" [`parameter`] ("," `defparameter`)* ["," ["**" `parameter` [","]]]
+ : | "**" `parameter` [","]
parameter: `identifier` [":" `expression`]
defparameter: `parameter` ["=" `expression`]
funcname: `identifier`
diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py
index d44b052..9b78184 100644
--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -34,7 +34,7 @@
ISSUE_URI = 'https://bugs.python.org/issue%s'
-SOURCE_URI = 'https://hg.python.org/cpython/file/3.5/%s'
+SOURCE_URI = 'https://hg.python.org/cpython/file/default/%s'
# monkey-patch reST parser to disable alphabetic and roman enumerated lists
from docutils.parsers.rst.states import Body
diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst
index e966085..215af03 100644
--- a/Doc/tutorial/interpreter.rst
+++ b/Doc/tutorial/interpreter.rst
@@ -1,4 +1,4 @@
-.. _tut-using:
+3.6.. _tut-using:
****************************
Using the Python Interpreter
@@ -10,13 +10,13 @@
Invoking the Interpreter
========================
-The Python interpreter is usually installed as :file:`/usr/local/bin/python3.5`
+The Python interpreter is usually installed as :file:`/usr/local/bin/python3.6`
on those machines where it is available; putting :file:`/usr/local/bin` in your
Unix shell's search path makes it possible to start it by typing the command:
.. code-block:: text
- python3.5
+ python3.6
to the shell. [#]_ Since the choice of the directory where the interpreter lives
is an installation option, other places are possible; check with your local
@@ -24,11 +24,11 @@
popular alternative location.)
On Windows machines, the Python installation is usually placed in
-:file:`C:\\Python35`, though you can change this when you're running the
+:file:`C:\\Python36`, though you can change this when you're running the
installer. To add this directory to your path, you can type the following
command into the command prompt in a DOS box::
- set path=%path%;C:\python35
+ set path=%path%;C:\python36
Typing an end-of-file character (:kbd:`Control-D` on Unix, :kbd:`Control-Z` on
Windows) at the primary prompt causes the interpreter to exit with a zero exit
@@ -96,8 +96,8 @@
prints a welcome message stating its version number and a copyright notice
before printing the first prompt::
- $ python3.5
- Python 3.5 (default, Sep 16 2015, 09:25:04)
+ $ python3.6
+ Python 3.6 (default, Sep 16 2015, 09:25:04)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst
index 0954eba..f9ed46d 100644
--- a/Doc/tutorial/stdlib.rst
+++ b/Doc/tutorial/stdlib.rst
@@ -15,7 +15,7 @@
>>> import os
>>> os.getcwd() # Return the current working directory
- 'C:\\Python35'
+ 'C:\\Python36'
>>> os.chdir('/server/accesslogs') # Change current working directory
>>> os.system('mkdir today') # Run the command mkdir in the system shell
0
diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst
index f7d2a0a..71194b0 100644
--- a/Doc/tutorial/stdlib2.rst
+++ b/Doc/tutorial/stdlib2.rst
@@ -277,7 +277,7 @@
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
d['primary'] # entry was automatically removed
- File "C:/python35/lib/weakref.py", line 46, in __getitem__
+ File "C:/python36/lib/weakref.py", line 46, in __getitem__
o = self.data[key]()
KeyError: 'primary'
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
new file mode 100644
index 0000000..50d2a6a
--- /dev/null
+++ b/Doc/whatsnew/3.6.rst
@@ -0,0 +1,214 @@
+****************************
+ What's New In Python 3.6
+****************************
+
+:Release: |release|
+:Date: |today|
+
+.. Rules for maintenance:
+
+ * Anyone can add text to this document. Do not spend very much time
+ on the wording of your changes, because your text will probably
+ get rewritten to some degree.
+
+ * The maintainer will go through Misc/NEWS periodically and add
+ changes; it's therefore more important to add your changes to
+ Misc/NEWS than to this file.
+
+ * This is not a complete list of every single change; completeness
+ is the purpose of Misc/NEWS. Some changes I consider too small
+ or esoteric to include. If such a change is added to the text,
+ I'll just remove it. (This is another reason you shouldn't spend
+ too much time on writing your addition.)
+
+ * If you want to draw your new text to the attention of the
+ maintainer, add 'XXX' to the beginning of the paragraph or
+ section.
+
+ * It's OK to just add a fragmentary note about a change. For
+ example: "XXX Describe the transmogrify() function added to the
+ socket module." The maintainer will research the change and
+ write the necessary text.
+
+ * You can comment out your additions if you like, but it's not
+ necessary (especially when a final release is some months away).
+
+ * Credit the author of a patch or bugfix. Just the name is
+ sufficient; the e-mail address isn't necessary.
+
+ * It's helpful to add the bug/patch number as a comment:
+
+ XXX Describe the transmogrify() function added to the socket
+ module.
+ (Contributed by P.Y. Developer in :issue:`12345`.)
+
+ This saves the maintainer the effort of going through the Mercurial log
+ when researching a change.
+
+This article explains the new features in Python 3.6, compared to 3.5.
+
+For full details, see the :source:`Misc/NEWS` file.
+
+.. note::
+
+ Prerelease users should be aware that this document is currently in draft
+ form. It will be updated substantially as Python 3.6 moves towards release,
+ so it's worth checking back even after reading earlier versions.
+
+
+Summary -- Release highlights
+=============================
+
+.. This section singles out the most important changes in Python 3.6.
+ Brevity is key.
+
+* None yet.
+
+.. PEP-sized items next.
+
+.. _pep-4XX:
+
+.. PEP 4XX: Virtual Environments
+.. =============================
+
+
+.. (Implemented by Foo Bar.)
+
+.. .. seealso::
+
+ :pep:`4XX` - Python Virtual Environments
+ PEP written by Carl Meyer
+
+
+Other Language Changes
+======================
+
+* None yet.
+
+
+New Modules
+===========
+
+* None yet.
+
+
+Improved Modules
+================
+
+datetime
+--------
+
+:meth:`datetime.stftime <datetime.datetime.stftime>` and
+:meth:`date.stftime <datetime.date.stftime>` methods now support ISO 8601 date
+directives ``%G``, ``%u`` and ``%V``.
+(Contributed by Ashley Anderson in :issue:`12006`.)
+
+
+operator
+--------
+
+New object :data:`operator.subscript` makes it easier to create complex
+indexers. For example: ``subscript[0:10:2] == slice(0, 10, 2)``
+(Contributed by Joe Jevnik in :issue:`24379`.)
+
+
+rlcomplete
+----------
+
+Private and special attribute names now are omitted unless the prefix starts
+with underscores. A space or a colon can be added after completed keyword.
+(Contributed by Serhiy Storchaka in :issue:`25011` and :issue:`25209`.)
+
+
+urllib.robotparser
+------------------
+
+:class:`~urllib.robotparser.RobotFileParser` now supports ``Crawl-delay`` and
+``Request-rate`` extensions.
+(Contributed by Nikolay Bogoychev in :issue:`16099`.)
+
+
+Optimizations
+=============
+
+* The ASCII decoder is now up to 60 times as fast for error handlers:
+ ``surrogateescape``, ``ignore`` and ``replace``.
+
+* The ASCII and the Latin1 encoders are now up to 3 times as fast for the error
+ error ``surrogateescape``.
+
+* The UTF-8 encoder is now up to 75 times as fast for error handlers:
+ ``ignore``, ``replace``, ``surrogateescape``, ``surrogatepass``.
+
+* The UTF-8 decoder is now up to 15 times as fast for error handlers:
+ ``ignore``, ``replace`` and ``surrogateescape``.
+
+
+Build and C API Changes
+=======================
+
+* None yet.
+
+
+Deprecated
+==========
+
+New Keywords
+------------
+
+``async`` and ``await`` are not recommended to be used as variable, class,
+function or module names. Introduced by :pep:`492` in Python 3.5, they will
+become proper keywords in Python 3.7.
+
+
+Deprecated Python modules, functions and methods
+------------------------------------------------
+
+* None yet.
+
+
+Deprecated functions and types of the C API
+-------------------------------------------
+
+* None yet.
+
+
+Deprecated features
+-------------------
+
+* None yet.
+
+
+Removed
+=======
+
+API and Feature Removals
+------------------------
+
+* ``inspect.getargspec()`` was removed (was deprecated since CPython 3.0).
+ :func:`inspect.getfullargspec` is an almost drop in replacement.
+
+* ``inspect.getmoduleinfo()`` was removed (was deprecated since CPython 3.3).
+ :func:`inspect.getmodulename` should be used for obtaining the module
+ name for a given path.
+
+
+Porting to Python 3.6
+=====================
+
+This section lists previously described changes and other bugfixes
+that may require changes to your code.
+
+Changes in the Python API
+-------------------------
+
+* Reading the :attr:`~urllib.parse.SplitResult.port` attribute of
+ :func:`urllib.parse.urlsplit` and :func:`~urllib.parse.urlparse` results
+ now raises :exc:`ValueError` for out-of-range values, rather than
+ returning :const:`None`. See :issue:`20059`.
+
+
+Changes in the C API
+--------------------
+
+* None yet.
diff --git a/Doc/whatsnew/index.rst b/Doc/whatsnew/index.rst
index edb5502..7c92524 100644
--- a/Doc/whatsnew/index.rst
+++ b/Doc/whatsnew/index.rst
@@ -11,6 +11,7 @@
.. toctree::
:maxdepth: 2
+ 3.6.rst
3.5.rst
3.4.rst
3.3.rst
diff --git a/Grammar/Grammar b/Grammar/Grammar
index 99fcea0..14bdecd 100644
--- a/Grammar/Grammar
+++ b/Grammar/Grammar
@@ -27,13 +27,18 @@
funcdef: 'def' NAME parameters ['->' test] ':' suite
parameters: '(' [typedargslist] ')'
-typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [','
- ['*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | '**' tfpdef]]
- | '*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | '**' tfpdef)
+typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [',' [
+ '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]]
+ | '**' tfpdef [',']]]
+ | '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]]
+ | '**' tfpdef [','])
tfpdef: NAME [':' test]
-varargslist: (vfpdef ['=' test] (',' vfpdef ['=' test])* [','
- ['*' [vfpdef] (',' vfpdef ['=' test])* [',' '**' vfpdef] | '**' vfpdef]]
- | '*' [vfpdef] (',' vfpdef ['=' test])* [',' '**' vfpdef] | '**' vfpdef)
+varargslist: (vfpdef ['=' test] (',' vfpdef ['=' test])* [',' [
+ '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]
+ | '**' vfpdef [',']]]
+ | '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]
+ | '**' vfpdef [',']
+)
vfpdef: NAME
stmt: simple_stmt | compound_stmt
diff --git a/Include/Python-ast.h b/Include/Python-ast.h
index 3bc015f..ea6679c 100644
--- a/Include/Python-ast.h
+++ b/Include/Python-ast.h
@@ -201,9 +201,10 @@
SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11,
Await_kind=12, Yield_kind=13, YieldFrom_kind=14,
Compare_kind=15, Call_kind=16, Num_kind=17, Str_kind=18,
- Bytes_kind=19, NameConstant_kind=20, Ellipsis_kind=21,
- Attribute_kind=22, Subscript_kind=23, Starred_kind=24,
- Name_kind=25, List_kind=26, Tuple_kind=27};
+ FormattedValue_kind=19, JoinedStr_kind=20, Bytes_kind=21,
+ NameConstant_kind=22, Ellipsis_kind=23, Attribute_kind=24,
+ Subscript_kind=25, Starred_kind=26, Name_kind=27,
+ List_kind=28, Tuple_kind=29};
struct _expr {
enum _expr_kind kind;
union {
@@ -297,6 +298,16 @@
} Str;
struct {
+ expr_ty value;
+ int conversion;
+ expr_ty format_spec;
+ } FormattedValue;
+
+ struct {
+ asdl_seq *values;
+ } JoinedStr;
+
+ struct {
bytes s;
} Bytes;
@@ -543,6 +554,12 @@
expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena *arena);
#define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3)
expr_ty _Py_Str(string s, int lineno, int col_offset, PyArena *arena);
+#define FormattedValue(a0, a1, a2, a3, a4, a5) _Py_FormattedValue(a0, a1, a2, a3, a4, a5)
+expr_ty _Py_FormattedValue(expr_ty value, int conversion, expr_ty format_spec,
+ int lineno, int col_offset, PyArena *arena);
+#define JoinedStr(a0, a1, a2, a3) _Py_JoinedStr(a0, a1, a2, a3)
+expr_ty _Py_JoinedStr(asdl_seq * values, int lineno, int col_offset, PyArena
+ *arena);
#define Bytes(a0, a1, a2, a3) _Py_Bytes(a0, a1, a2, a3)
expr_ty _Py_Bytes(bytes s, int lineno, int col_offset, PyArena *arena);
#define NameConstant(a0, a1, a2, a3) _Py_NameConstant(a0, a1, a2, a3)
diff --git a/Include/bytesobject.h b/Include/bytesobject.h
index e379bac..2c4c4c4 100644
--- a/Include/bytesobject.h
+++ b/Include/bytesobject.h
@@ -123,6 +123,66 @@
#define F_ALT (1<<3)
#define F_ZERO (1<<4)
+#ifndef Py_LIMITED_API
+/* The _PyBytesWriter structure is big: it contains an embeded "stack buffer".
+ A _PyBytesWriter variable must be declared at the end of variables in a
+ function to optimize the memory allocation on the stack. */
+typedef struct {
+ /* bytes object */
+ PyObject *buffer;
+
+ /* Number of allocated size */
+ Py_ssize_t allocated;
+
+ /* Minimum number of allocated bytes,
+ incremented by _PyBytesWriter_Prepare() */
+ Py_ssize_t min_size;
+
+ /* If non-zero, overallocate the buffer (default: 0). */
+ int overallocate;
+
+ /* Stack buffer */
+ int use_small_buffer;
+ char small_buffer[512];
+} _PyBytesWriter;
+
+/* Initialize a bytes writer
+
+ By default, the overallocation is disabled. Set the overallocate attribute
+ to control the allocation of the buffer. */
+PyAPI_FUNC(void) _PyBytesWriter_Init(_PyBytesWriter *writer);
+
+/* Get the buffer content and reset the writer.
+ Return a bytes object.
+ Raise an exception and return NULL on error. */
+PyAPI_FUNC(PyObject *) _PyBytesWriter_Finish(_PyBytesWriter *writer,
+ char *str);
+
+/* Deallocate memory of a writer (clear its internal buffer). */
+PyAPI_FUNC(void) _PyBytesWriter_Dealloc(_PyBytesWriter *writer);
+
+/* Allocate the buffer to write size bytes.
+ Return the pointer to the beginning of buffer data.
+ Raise an exception and return NULL on error. */
+PyAPI_FUNC(char*) _PyBytesWriter_Alloc(_PyBytesWriter *writer,
+ Py_ssize_t size);
+
+/* Add *size* bytes to the buffer.
+ str is the current pointer inside the buffer.
+ Return the updated current pointer inside the buffer.
+ Raise an exception and return NULL on error. */
+PyAPI_FUNC(char*) _PyBytesWriter_Prepare(_PyBytesWriter *writer,
+ char *str,
+ Py_ssize_t size);
+
+/* Write bytes.
+ Raise an exception and return NULL on error. */
+PyAPI_FUNC(char*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer,
+ char *str,
+ char *bytes,
+ Py_ssize_t size);
+#endif /* Py_LIMITED_API */
+
#ifdef __cplusplus
}
#endif
diff --git a/Include/longobject.h b/Include/longobject.h
index aed59ce..ab92495 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -182,6 +182,13 @@
int base,
int alternate);
+PyAPI_FUNC(char*) _PyLong_FormatBytesWriter(
+ _PyBytesWriter *writer,
+ char *str,
+ PyObject *obj,
+ int base,
+ int alternate);
+
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(int) _PyLong_FormatAdvancedWriter(
diff --git a/Include/patchlevel.h b/Include/patchlevel.h
index 5145dd4..246eba8 100644
--- a/Include/patchlevel.h
+++ b/Include/patchlevel.h
@@ -17,13 +17,13 @@
/* Version parsed out into numeric values */
/*--start constants--*/
#define PY_MAJOR_VERSION 3
-#define PY_MINOR_VERSION 5
+#define PY_MINOR_VERSION 6
#define PY_MICRO_VERSION 0
-#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
+#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA
#define PY_RELEASE_SERIAL 0
/* Version as a string */
-#define PY_VERSION "3.5.0+"
+#define PY_VERSION "3.6.0a0"
/*--end constants--*/
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
diff --git a/Include/pytime.h b/Include/pytime.h
index 494322c..98612e1 100644
--- a/Include/pytime.h
+++ b/Include/pytime.h
@@ -30,7 +30,10 @@
_PyTime_ROUND_FLOOR=0,
/* Round towards infinity (+inf).
For example, used for timeout to wait "at least" N seconds. */
- _PyTime_ROUND_CEILING
+ _PyTime_ROUND_CEILING=1,
+ /* Round to nearest with ties going to nearest even integer.
+ For example, used to round from a Python float. */
+ _PyTime_ROUND_HALF_EVEN
} _PyTime_round_t;
/* Convert a time_t to a PyLong. */
diff --git a/Include/setobject.h b/Include/setobject.h
index f17bc1b..87ec1c8 100644
--- a/Include/setobject.h
+++ b/Include/setobject.h
@@ -10,12 +10,13 @@
/* There are three kinds of entries in the table:
-1. Unused: key == NULL
-2. Active: key != NULL and key != dummy
-3. Dummy: key == dummy
+1. Unused: key == NULL and hash == 0
+2. Dummy: key == dummy and hash == -1
+3. Active: key != NULL and key != dummy and hash != -1
-The hash field of Unused slots have no meaning.
-The hash field of Dummny slots are set to -1
+The hash field of Unused slots is always zero.
+
+The hash field of Dummy slots are set to -1
meaning that dummy entries can be detected by
either entry->key==dummy or by entry->hash==-1.
*/
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 4ba6328..adcb64c 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -908,7 +908,7 @@
/* minimum character (default: 127, ASCII) */
Py_UCS4 min_char;
- /* If non-zero, overallocate the buffer by 25% (default: 0). */
+ /* If non-zero, overallocate the buffer (default: 0). */
unsigned char overallocate;
/* If readonly is 1, buffer is a shared string (cannot be modified)
@@ -942,6 +942,23 @@
_PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer,
Py_ssize_t length, Py_UCS4 maxchar);
+/* Prepare the buffer to have at least the kind KIND.
+ For example, kind=PyUnicode_2BYTE_KIND ensures that the writer will
+ support characters in range U+000-U+FFFF.
+
+ Return 0 on success, raise an exception and return -1 on error. */
+#define _PyUnicodeWriter_PrepareKind(WRITER, KIND) \
+ (assert((KIND) != PyUnicode_WCHAR_KIND), \
+ (KIND) <= (WRITER)->kind \
+ ? 0 \
+ : _PyUnicodeWriter_PrepareKindInternal((WRITER), (KIND)))
+
+/* Don't call this function directly, use the _PyUnicodeWriter_PrepareKind()
+ macro instead. */
+PyAPI_FUNC(int)
+_PyUnicodeWriter_PrepareKindInternal(_PyUnicodeWriter *writer,
+ enum PyUnicode_Kind kind);
+
/* Append a Unicode character.
Return 0 on success, raise an exception and return -1 on error. */
PyAPI_FUNC(int)
@@ -2261,6 +2278,10 @@
/* Clear all static strings. */
PyAPI_FUNC(void) _PyUnicode_ClearStaticStrings(void);
+/* Fast equality check when the inputs are known to be exact unicode types
+ and where the hash values are equal (i.e. a very probable match) */
+PyAPI_FUNC(int) _PyUnicode_EQ(PyObject *, PyObject *);
+
#ifdef __cplusplus
}
#endif
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index f47df91..f472256 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -182,8 +182,8 @@
text = "t" in modes
binary = "b" in modes
if "U" in modes:
- if creating or writing or appending:
- raise ValueError("can't use U and writing mode at once")
+ if creating or writing or appending or updating:
+ raise ValueError("mode U cannot be combined with 'x', 'w', 'a', or '+'")
import warnings
warnings.warn("'U' mode is deprecated",
DeprecationWarning, 2)
diff --git a/Lib/_strptime.py b/Lib/_strptime.py
index 374923d..fe5b046 100644
--- a/Lib/_strptime.py
+++ b/Lib/_strptime.py
@@ -195,12 +195,15 @@
'f': r"(?P<f>[0-9]{1,6})",
'H': r"(?P<H>2[0-3]|[0-1]\d|\d)",
'I': r"(?P<I>1[0-2]|0[1-9]|[1-9])",
+ 'G': r"(?P<G>\d\d\d\d)",
'j': r"(?P<j>36[0-6]|3[0-5]\d|[1-2]\d\d|0[1-9]\d|00[1-9]|[1-9]\d|0[1-9]|[1-9])",
'm': r"(?P<m>1[0-2]|0[1-9]|[1-9])",
'M': r"(?P<M>[0-5]\d|\d)",
'S': r"(?P<S>6[0-1]|[0-5]\d|\d)",
'U': r"(?P<U>5[0-3]|[0-4]\d|\d)",
'w': r"(?P<w>[0-6])",
+ 'u': r"(?P<u>[1-7])",
+ 'V': r"(?P<V>5[0-3]|0[1-9]|[1-4]\d|\d)",
# W is set below by using 'U'
'y': r"(?P<y>\d\d)",
#XXX: Does 'Y' need to worry about having less or more than
@@ -295,6 +298,22 @@
return 1 + days_to_week + day_of_week
+def _calc_julian_from_V(iso_year, iso_week, iso_weekday):
+ """Calculate the Julian day based on the ISO 8601 year, week, and weekday.
+ ISO weeks start on Mondays, with week 01 being the week containing 4 Jan.
+ ISO week days range from 1 (Monday) to 7 (Sunday).
+ """
+ correction = datetime_date(iso_year, 1, 4).isoweekday() + 3
+ ordinal = (iso_week * 7) + iso_weekday - correction
+ # ordinal may be negative or 0 now, which means the date is in the previous
+ # calendar year
+ if ordinal < 1:
+ ordinal += datetime_date(iso_year, 1, 1).toordinal()
+ iso_year -= 1
+ ordinal -= datetime_date(iso_year, 1, 1).toordinal()
+ return iso_year, ordinal
+
+
def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
"""Return a 2-tuple consisting of a time struct and an int containing
the number of microseconds based on the input string and the
@@ -339,15 +358,15 @@
raise ValueError("unconverted data remains: %s" %
data_string[found.end():])
- year = None
+ iso_year = year = None
month = day = 1
hour = minute = second = fraction = 0
tz = -1
tzoffset = None
# Default to -1 to signify that values not known; not critical to have,
# though
- week_of_year = -1
- week_of_year_start = -1
+ iso_week = week_of_year = None
+ week_of_year_start = None
# weekday and julian defaulted to None so as to signal need to calculate
# values
weekday = julian = None
@@ -369,6 +388,8 @@
year += 1900
elif group_key == 'Y':
year = int(found_dict['Y'])
+ elif group_key == 'G':
+ iso_year = int(found_dict['G'])
elif group_key == 'm':
month = int(found_dict['m'])
elif group_key == 'B':
@@ -414,6 +435,9 @@
weekday = 6
else:
weekday -= 1
+ elif group_key == 'u':
+ weekday = int(found_dict['u'])
+ weekday -= 1
elif group_key == 'j':
julian = int(found_dict['j'])
elif group_key in ('U', 'W'):
@@ -424,6 +448,8 @@
else:
# W starts week on Monday.
week_of_year_start = 0
+ elif group_key == 'V':
+ iso_week = int(found_dict['V'])
elif group_key == 'z':
z = found_dict['z']
tzoffset = int(z[1:3]) * 60 + int(z[3:5])
@@ -444,28 +470,57 @@
else:
tz = value
break
+ # Deal with the cases where ambiguities arize
+ # don't assume default values for ISO week/year
+ if year is None and iso_year is not None:
+ if iso_week is None or weekday is None:
+ raise ValueError("ISO year directive '%G' must be used with "
+ "the ISO week directive '%V' and a weekday "
+ "directive ('%A', '%a', '%w', or '%u').")
+ if julian is not None:
+ raise ValueError("Day of the year directive '%j' is not "
+ "compatible with ISO year directive '%G'. "
+ "Use '%Y' instead.")
+ elif week_of_year is None and iso_week is not None:
+ if weekday is None:
+ raise ValueError("ISO week directive '%V' must be used with "
+ "the ISO year directive '%G' and a weekday "
+ "directive ('%A', '%a', '%w', or '%u').")
+ else:
+ raise ValueError("ISO week directive '%V' is incompatible with "
+ "the year directive '%Y'. Use the ISO year '%G' "
+ "instead.")
+
leap_year_fix = False
if year is None and month == 2 and day == 29:
year = 1904 # 1904 is first leap year of 20th century
leap_year_fix = True
elif year is None:
year = 1900
+
+
# If we know the week of the year and what day of that week, we can figure
# out the Julian day of the year.
- if julian is None and week_of_year != -1 and weekday is not None:
- week_starts_Mon = True if week_of_year_start == 0 else False
- julian = _calc_julian_from_U_or_W(year, week_of_year, weekday,
- week_starts_Mon)
- # Cannot pre-calculate datetime_date() since can change in Julian
- # calculation and thus could have different value for the day of the week
- # calculation.
+ if julian is None and weekday is not None:
+ if week_of_year is not None:
+ week_starts_Mon = True if week_of_year_start == 0 else False
+ julian = _calc_julian_from_U_or_W(year, week_of_year, weekday,
+ week_starts_Mon)
+ elif iso_year is not None and iso_week is not None:
+ year, julian = _calc_julian_from_V(iso_year, iso_week, weekday + 1)
+
if julian is None:
+ # Cannot pre-calculate datetime_date() since can change in Julian
+ # calculation and thus could have different value for the day of
+ # the week calculation.
# Need to add 1 to result since first day of the year is 1, not 0.
julian = datetime_date(year, month, day).toordinal() - \
datetime_date(year, 1, 1).toordinal() + 1
- else: # Assume that if they bothered to include Julian day it will
- # be accurate.
- datetime_result = datetime_date.fromordinal((julian - 1) + datetime_date(year, 1, 1).toordinal())
+ else: # Assume that if they bothered to include Julian day (or if it was
+ # calculated above with year/week/weekday) it will be accurate.
+ datetime_result = datetime_date.fromordinal(
+ (julian - 1) +
+ datetime_date(year, 1, 1).toordinal())
year = datetime_result.year
month = datetime_result.month
day = datetime_result.day
diff --git a/Lib/aifc.py b/Lib/aifc.py
index 7ebdbeb..692d0bf 100644
--- a/Lib/aifc.py
+++ b/Lib/aifc.py
@@ -257,6 +257,15 @@
_aifc_params = namedtuple('_aifc_params',
'nchannels sampwidth framerate nframes comptype compname')
+_aifc_params.nchannels.__doc__ = 'Number of audio channels (1 for mono, 2 for stereo)'
+_aifc_params.sampwidth.__doc__ = 'Sample width in bytes'
+_aifc_params.framerate.__doc__ = 'Sampling frequency'
+_aifc_params.nframes.__doc__ = 'Number of audio frames'
+_aifc_params.comptype.__doc__ = 'Compression type ("NONE" for AIFF files)'
+_aifc_params.compname.__doc__ = ("""\
+A human-readable version of the compression type
+('not compressed' for AIFF files)""")
+
class Aifc_read:
# Variables used in this class:
diff --git a/Lib/argparse.py b/Lib/argparse.py
index 9a06719..cc53841 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -118,10 +118,16 @@
def __repr__(self):
type_name = type(self).__name__
arg_strings = []
+ star_args = {}
for arg in self._get_args():
arg_strings.append(repr(arg))
for name, value in self._get_kwargs():
- arg_strings.append('%s=%r' % (name, value))
+ if name.isidentifier():
+ arg_strings.append('%s=%r' % (name, value))
+ else:
+ star_args[name] = value
+ if star_args:
+ arg_strings.append('**%s' % repr(star_args))
return '%s(%s)' % (type_name, ', '.join(arg_strings))
def _get_kwargs(self):
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index e8312a9..638a4ca 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -952,7 +952,7 @@
dict = kwargs.pop('dict')
import warnings
warnings.warn("Passing 'dict' as keyword argument is deprecated",
- PendingDeprecationWarning, stacklevel=2)
+ DeprecationWarning, stacklevel=2)
else:
dict = None
self.data = {}
diff --git a/Lib/crypt.py b/Lib/crypt.py
index 49ab96e..fbc5f4c 100644
--- a/Lib/crypt.py
+++ b/Lib/crypt.py
@@ -54,9 +54,8 @@
METHOD_SHA512 = _Method('SHA512', '6', 16, 106)
methods = []
-for _method in (METHOD_SHA512, METHOD_SHA256, METHOD_MD5):
+for _method in (METHOD_SHA512, METHOD_SHA256, METHOD_MD5, METHOD_CRYPT):
_result = crypt('', _method)
if _result and len(_result) == _method.total_size:
methods.append(_method)
-methods.append(METHOD_CRYPT)
del _result, _method
diff --git a/Lib/datetime.py b/Lib/datetime.py
index b9719cb..b734a74 100644
--- a/Lib/datetime.py
+++ b/Lib/datetime.py
@@ -316,6 +316,7 @@
return q
+
class timedelta:
"""Represent the difference between two datetime objects.
@@ -1912,6 +1913,8 @@
@staticmethod
def _name_from_offset(delta):
+ if not delta:
+ return 'UTC'
if delta < timedelta(0):
sign = '-'
delta = -delta
diff --git a/Lib/dis.py b/Lib/dis.py
index af37cdf..3540b47 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -162,6 +162,15 @@
_Instruction = collections.namedtuple("_Instruction",
"opname opcode arg argval argrepr offset starts_line is_jump_target")
+_Instruction.opname.__doc__ = "Human readable name for operation"
+_Instruction.opcode.__doc__ = "Numeric code for operation"
+_Instruction.arg.__doc__ = "Numeric argument to operation (if any), otherwise None"
+_Instruction.argval.__doc__ = "Resolved arg value (if known), otherwise same as arg"
+_Instruction.argrepr.__doc__ = "Human readable description of operation argument"
+_Instruction.offset.__doc__ = "Start index of operation within bytecode sequence"
+_Instruction.starts_line.__doc__ = "Line started by this opcode (if any), otherwise None"
+_Instruction.is_jump_target.__doc__ = "True if other code jumps to here, otherwise False"
+
class Instruction(_Instruction):
"""Details for a bytecode operation
diff --git a/Lib/distutils/core.py b/Lib/distutils/core.py
index f05b34b..d603d4a 100644
--- a/Lib/distutils/core.py
+++ b/Lib/distutils/core.py
@@ -204,16 +204,15 @@
global _setup_stop_after, _setup_distribution
_setup_stop_after = stop_after
- save_argv = sys.argv
+ save_argv = sys.argv.copy()
g = {'__file__': script_name}
- l = {}
try:
try:
sys.argv[0] = script_name
if script_args is not None:
sys.argv[1:] = script_args
with open(script_name, 'rb') as f:
- exec(f.read(), g, l)
+ exec(f.read(), g)
finally:
sys.argv = save_argv
_setup_stop_after = None
diff --git a/Lib/distutils/tests/test_core.py b/Lib/distutils/tests/test_core.py
index 41321f7..57856f1 100644
--- a/Lib/distutils/tests/test_core.py
+++ b/Lib/distutils/tests/test_core.py
@@ -28,6 +28,21 @@
setup()
"""
+setup_does_nothing = """\
+from distutils.core import setup
+setup()
+"""
+
+
+setup_defines_subclass = """\
+from distutils.core import setup
+from distutils.command.install import install as _install
+
+class install(_install):
+ sub_commands = _install.sub_commands + ['cmd']
+
+setup(cmdclass={'install': install})
+"""
class CoreTestCase(support.EnvironGuard, unittest.TestCase):
@@ -65,6 +80,21 @@
distutils.core.run_setup(
self.write_setup(setup_using___file__))
+ def test_run_setup_preserves_sys_argv(self):
+ # Make sure run_setup does not clobber sys.argv
+ argv_copy = sys.argv.copy()
+ distutils.core.run_setup(
+ self.write_setup(setup_does_nothing))
+ self.assertEqual(sys.argv, argv_copy)
+
+ def test_run_setup_defines_subclass(self):
+ # Make sure the script can use __file__; if that's missing, the test
+ # setup.py script will raise NameError.
+ dist = distutils.core.run_setup(
+ self.write_setup(setup_defines_subclass))
+ install = dist.get_command_obj('install')
+ self.assertIn('cmd', install.sub_commands)
+
def test_run_setup_uses_current_dir(self):
# This tests that the setup script is run with the current directory
# as its own current directory; this was temporarily broken by a
diff --git a/Lib/enum.py b/Lib/enum.py
index c28f345..8d04e2d 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -1,7 +1,13 @@
import sys
-from collections import OrderedDict
from types import MappingProxyType, DynamicClassAttribute
+# try _collections first to reduce startup cost
+try:
+ from _collections import OrderedDict
+except ImportError:
+ from collections import OrderedDict
+
+
__all__ = ['Enum', 'IntEnum', 'unique']
@@ -476,6 +482,9 @@
def __str__(self):
return "%s.%s" % (self.__class__.__name__, self._name_)
+ def __bool__(self):
+ return bool(self._value_)
+
def __dir__(self):
added_behavior = [
m
diff --git a/Lib/http/client.py b/Lib/http/client.py
index 80c80cf..155c2e3 100644
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -405,6 +405,7 @@
self.fp.flush()
def readable(self):
+ """Always returns True"""
return True
# End of "raw stream" methods
@@ -452,6 +453,10 @@
return s
def readinto(self, b):
+ """Read up to len(b) bytes into bytearray b and return the number
+ of bytes read.
+ """
+
if self.fp is None:
return 0
@@ -683,6 +688,17 @@
return self.fp.fileno()
def getheader(self, name, default=None):
+ '''Returns the value of the header matching *name*.
+
+ If there are multiple matching headers, the values are
+ combined into a single string separated by commas and spaces.
+
+ If no matching header is found, returns *default* or None if
+ the *default* is not specified.
+
+ If the headers are unknown, raises http.client.ResponseNotReady.
+
+ '''
if self.headers is None:
raise ResponseNotReady()
headers = self.headers.get_all(name) or default
@@ -705,12 +721,45 @@
# For compatibility with old-style urllib responses.
def info(self):
+ '''Returns an instance of the class mimetools.Message containing
+ meta-information associated with the URL.
+
+ When the method is HTTP, these headers are those returned by
+ the server at the head of the retrieved HTML page (including
+ Content-Length and Content-Type).
+
+ When the method is FTP, a Content-Length header will be
+ present if (as is now usual) the server passed back a file
+ length in response to the FTP retrieval request. A
+ Content-Type header will be present if the MIME type can be
+ guessed.
+
+ When the method is local-file, returned headers will include
+ a Date representing the file’s last-modified time, a
+ Content-Length giving file size, and a Content-Type
+ containing a guess at the file’s type. See also the
+ description of the mimetools module.
+
+ '''
return self.headers
def geturl(self):
+ '''Return the real URL of the page.
+
+ In some cases, the HTTP server redirects a client to another
+ URL. The urlopen() function handles this transparently, but in
+ some cases the caller needs to know which URL the client was
+ redirected to. The geturl() method can be used to get at this
+ redirected URL.
+
+ '''
return self.url
def getcode(self):
+ '''Return the HTTP status code that was sent with the response,
+ or None if the URL is not an HTTP URL.
+
+ '''
return self.status
class HTTPConnection:
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index d15ffab..2df89ec 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -1,6 +1,6 @@
-What's New in IDLE 3.5.1?
-=========================
-*Release date: 2015-09-13*
+What's New in IDLE 3.6.0a1?
+===========================
+*Release date: 2017?*
- Issue #24820: IDLE now has an 'IDLE Dark' built-in text color theme.
It is more or less IDLE Classic inverted, with a cobalt blue background.
@@ -256,6 +256,11 @@
- Use of 'filter' in keybindingDialog.py was causing custom key assignment to
fail. Patch 5707 amaury.forgeotdarc.
+
+What's New in IDLE 3.1a1?
+=========================
+*Release date: 07-Mar-09*
+
- Issue #4815: Offer conversion to UTF-8 if source files have
no encoding declaration and are not encoded in UTF-8.
@@ -295,6 +300,11 @@
- Issue #3549: On MacOS the preferences menu was not present
+
+What's New in IDLE 3.0?
+=======================
+*Release date: 03-Dec-2008*
+
- IDLE would print a "Unhandled server exception!" message when internal
debugging is enabled.
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index 616b17f..e0a1200 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -360,14 +360,6 @@
return mode
-def _verbose_message(message, *args, verbosity=1):
- """Print the message to stderr if -v/PYTHONVERBOSE is turned on."""
- if sys.flags.verbose >= verbosity:
- if not message.startswith(('#', 'import ')):
- message = '# ' + message
- print(message.format(*args), file=sys.stderr)
-
-
def _check_name(method):
"""Decorator to verify that the module being requested matches the one the
loader can handle.
@@ -437,15 +429,15 @@
raw_size = data[8:12]
if magic != MAGIC_NUMBER:
message = 'bad magic number in {!r}: {!r}'.format(name, magic)
- _verbose_message('{}', message)
+ _bootstrap._verbose_message('{}', message)
raise ImportError(message, **exc_details)
elif len(raw_timestamp) != 4:
message = 'reached EOF while reading timestamp in {!r}'.format(name)
- _verbose_message('{}', message)
+ _bootstrap._verbose_message('{}', message)
raise EOFError(message)
elif len(raw_size) != 4:
message = 'reached EOF while reading size of source in {!r}'.format(name)
- _verbose_message('{}', message)
+ _bootstrap._verbose_message('{}', message)
raise EOFError(message)
if source_stats is not None:
try:
@@ -455,7 +447,7 @@
else:
if _r_long(raw_timestamp) != source_mtime:
message = 'bytecode is stale for {!r}'.format(name)
- _verbose_message('{}', message)
+ _bootstrap._verbose_message('{}', message)
raise ImportError(message, **exc_details)
try:
source_size = source_stats['size'] & 0xFFFFFFFF
@@ -472,7 +464,7 @@
"""Compile bytecode as returned by _validate_bytecode_header()."""
code = marshal.loads(data)
if isinstance(code, _code_type):
- _verbose_message('code object from {!r}', bytecode_path)
+ _bootstrap._verbose_message('code object from {!r}', bytecode_path)
if source_path is not None:
_imp._fix_co_filename(code, source_path)
return code
@@ -755,21 +747,21 @@
except (ImportError, EOFError):
pass
else:
- _verbose_message('{} matches {}', bytecode_path,
- source_path)
+ _bootstrap._verbose_message('{} matches {}', bytecode_path,
+ source_path)
return _compile_bytecode(bytes_data, name=fullname,
bytecode_path=bytecode_path,
source_path=source_path)
source_bytes = self.get_data(source_path)
code_object = self.source_to_code(source_bytes, source_path)
- _verbose_message('code object from {}', source_path)
+ _bootstrap._verbose_message('code object from {}', source_path)
if (not sys.dont_write_bytecode and bytecode_path is not None and
source_mtime is not None):
data = _code_to_bytecode(code_object, source_mtime,
len(source_bytes))
try:
self._cache_bytecode(source_path, bytecode_path, data)
- _verbose_message('wrote {!r}', bytecode_path)
+ _bootstrap._verbose_message('wrote {!r}', bytecode_path)
except NotImplementedError:
pass
return code_object
@@ -849,14 +841,16 @@
except OSError as exc:
# Could be a permission error, read-only filesystem: just forget
# about writing the data.
- _verbose_message('could not create {!r}: {!r}', parent, exc)
+ _bootstrap._verbose_message('could not create {!r}: {!r}',
+ parent, exc)
return
try:
_write_atomic(path, data, _mode)
- _verbose_message('created {!r}', path)
+ _bootstrap._verbose_message('created {!r}', path)
except OSError as exc:
# Same as above: just don't write the bytecode.
- _verbose_message('could not create {!r}: {!r}', path, exc)
+ _bootstrap._verbose_message('could not create {!r}: {!r}', path,
+ exc)
class SourcelessFileLoader(FileLoader, _LoaderBasics):
@@ -901,14 +895,14 @@
"""Create an unitialized extension module"""
module = _bootstrap._call_with_frames_removed(
_imp.create_dynamic, spec)
- _verbose_message('extension module {!r} loaded from {!r}',
+ _bootstrap._verbose_message('extension module {!r} loaded from {!r}',
spec.name, self.path)
return module
def exec_module(self, module):
"""Initialize an extension module"""
_bootstrap._call_with_frames_removed(_imp.exec_dynamic, module)
- _verbose_message('extension module {!r} executed from {!r}',
+ _bootstrap._verbose_message('extension module {!r} executed from {!r}',
self.name, self.path)
def is_package(self, fullname):
@@ -1023,7 +1017,8 @@
"""
# The import system never calls this method.
- _verbose_message('namespace module loaded with path {!r}', self._path)
+ _bootstrap._verbose_message('namespace module loaded with path {!r}',
+ self._path)
return _bootstrap._load_module_shim(self, fullname)
@@ -1243,12 +1238,13 @@
# Check for a file w/ a proper suffix exists.
for suffix, loader_class in self._loaders:
full_path = _path_join(self.path, tail_module + suffix)
- _verbose_message('trying {}'.format(full_path), verbosity=2)
+ _bootstrap._verbose_message('trying {}', full_path, verbosity=2)
if cache_module + suffix in cache:
if _path_isfile(full_path):
- return self._get_spec(loader_class, fullname, full_path, None, target)
+ return self._get_spec(loader_class, fullname, full_path,
+ None, target)
if is_namespace:
- _verbose_message('possible namespace for {}'.format(base_path))
+ _bootstrap._verbose_message('possible namespace for {}', base_path)
spec = _bootstrap.ModuleSpec(fullname, None)
spec.submodule_search_locations = [base_path]
return spec
diff --git a/Lib/inspect.py b/Lib/inspect.py
index bf4f87d..a089be6 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -16,7 +16,7 @@
getmodule() - determine the module that an object came from
getclasstree() - arrange classes so as to represent their hierarchy
- getargspec(), getargvalues(), getcallargs() - get info about function arguments
+ getargvalues(), getcallargs() - get info about function arguments
getfullargspec() - same, with support for Python 3 features
formatargspec(), formatargvalues() - format an argument spec
getouterframes(), getinnerframes() - get info about frames
@@ -623,23 +623,6 @@
raise TypeError('{!r} is not a module, class, method, '
'function, traceback, frame, or code object'.format(object))
-ModuleInfo = namedtuple('ModuleInfo', 'name suffix mode module_type')
-
-def getmoduleinfo(path):
- """Get the module name, suffix, mode, and module type for a given file."""
- warnings.warn('inspect.getmoduleinfo() is deprecated', DeprecationWarning,
- 2)
- with warnings.catch_warnings():
- warnings.simplefilter('ignore', PendingDeprecationWarning)
- import imp
- filename = os.path.basename(path)
- suffixes = [(-len(suffix), suffix, mode, mtype)
- for suffix, mode, mtype in imp.get_suffixes()]
- suffixes.sort() # try longest suffixes first, in case they overlap
- for neglen, suffix, mode, mtype in suffixes:
- if filename[neglen:] == suffix:
- return ModuleInfo(filename[:neglen], suffix, mode, mtype)
-
def getmodulename(path):
"""Return the module name for a given file, or None."""
fname = os.path.basename(path)
@@ -1020,31 +1003,6 @@
varkw = co.co_varnames[nargs]
return args, varargs, kwonlyargs, varkw
-
-ArgSpec = namedtuple('ArgSpec', 'args varargs keywords defaults')
-
-def getargspec(func):
- """Get the names and default values of a function's arguments.
-
- A tuple of four things is returned: (args, varargs, keywords, defaults).
- 'args' is a list of the argument names, including keyword-only argument names.
- 'varargs' and 'keywords' are the names of the * and ** arguments or None.
- 'defaults' is an n-tuple of the default values of the last n arguments.
-
- Use the getfullargspec() API for Python 3 code, as annotations
- and keyword arguments are supported. getargspec() will raise ValueError
- if the func has either annotations or keyword arguments.
- """
- warnings.warn("inspect.getargspec() is deprecated, "
- "use inspect.signature() instead", DeprecationWarning,
- stacklevel=2)
- args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, ann = \
- getfullargspec(func)
- if kwonlyargs or ann:
- raise ValueError("Function has keyword-only arguments or annotations"
- ", use getfullargspec() API which can support them")
- return ArgSpec(args, varargs, varkw, defaults)
-
FullArgSpec = namedtuple('FullArgSpec',
'args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations')
@@ -1060,8 +1018,6 @@
'kwonlydefaults' is a dictionary mapping names from kwonlyargs to defaults.
'annotations' is a dictionary mapping argument names to annotations.
- The first four items in the tuple correspond to getargspec().
-
This function is deprecated, use inspect.signature() instead.
"""
@@ -1172,8 +1128,7 @@
formatvalue=lambda value: '=' + repr(value),
formatreturns=lambda text: ' -> ' + text,
formatannotation=formatannotation):
- """Format an argument spec from the values returned by getargspec
- or getfullargspec.
+ """Format an argument spec from the values returned by getfullargspec.
The first seven arguments are (args, varargs, varkw, defaults,
kwonlyargs, kwonlydefaults, annotations). The other five arguments
diff --git a/Lib/lib2to3/fixes/fix_types.py b/Lib/lib2to3/fixes/fix_types.py
index db34104..00327a7 100644
--- a/Lib/lib2to3/fixes/fix_types.py
+++ b/Lib/lib2to3/fixes/fix_types.py
@@ -42,7 +42,7 @@
'NotImplementedType' : 'type(NotImplemented)',
'SliceType' : 'slice',
'StringType': 'bytes', # XXX ?
- 'StringTypes' : 'str', # XXX ?
+ 'StringTypes' : '(str,)', # XXX ?
'TupleType': 'tuple',
'TypeType' : 'type',
'UnicodeType': 'str',
diff --git a/Lib/lib2to3/tests/test_fixers.py b/Lib/lib2to3/tests/test_fixers.py
index 06b0033..def9b0e 100644
--- a/Lib/lib2to3/tests/test_fixers.py
+++ b/Lib/lib2to3/tests/test_fixers.py
@@ -3322,6 +3322,10 @@
a = """type(None)"""
self.check(b, a)
+ b = "types.StringTypes"
+ a = "(str,)"
+ self.check(b, a)
+
class Test_idioms(FixerTestCase):
fixer = "idioms"
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 02a5fc1..54bee89 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -440,11 +440,11 @@
sres = os.fstat(self.stream.fileno())
self.dev, self.ino = sres[ST_DEV], sres[ST_INO]
- def emit(self, record):
+ def reopenIfNeeded(self):
"""
- Emit a record.
+ Reopen log file if needed.
- First check if the underlying file has changed, and if it
+ Checks if the underlying file has changed, and if it
has, close the old stream and reopen the file to get the
current stream.
"""
@@ -467,6 +467,15 @@
# open a new file handle and get new stat info from that fd
self.stream = self._open()
self._statstream()
+
+ def emit(self, record):
+ """
+ Emit a record.
+
+ If underlying file has changed, reopen the file before emitting the
+ record to it.
+ """
+ self.reopenIfNeeded()
logging.FileHandler.emit(self, record)
diff --git a/Lib/operator.py b/Lib/operator.py
index 0e2e53e..bc2a947 100644
--- a/Lib/operator.py
+++ b/Lib/operator.py
@@ -17,7 +17,7 @@
'is_', 'is_not', 'isub', 'itemgetter', 'itruediv', 'ixor', 'le',
'length_hint', 'lshift', 'lt', 'matmul', 'methodcaller', 'mod',
'mul', 'ne', 'neg', 'not_', 'or_', 'pos', 'pow', 'rshift',
- 'setitem', 'sub', 'truediv', 'truth', 'xor']
+ 'setitem', 'sub', 'subscript', 'truediv', 'truth', 'xor']
from builtins import abs as _abs
@@ -408,6 +408,32 @@
return a
+@object.__new__ # create a singleton instance
+class subscript:
+ """
+ A helper to turn subscript notation into indexing objects. This can be
+ used to create item access patterns ahead of time to pass them into
+ various subscriptable objects.
+
+ For example:
+ subscript[5] == 5
+ subscript[3:7:2] == slice(3, 7, 2)
+ subscript[5, 8] == (5, 8)
+ """
+ __slots__ = ()
+
+ def __new__(cls):
+ raise TypeError("cannot create '{}' instances".format(cls.__name__))
+
+ @staticmethod
+ def __getitem__(key):
+ return key
+
+ @staticmethod
+ def __reduce__():
+ return 'subscript'
+
+
try:
from _operator import *
except ImportError:
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
old mode 100755
new mode 100644
index ee558bf..f4f2530
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -209,6 +209,18 @@
results.append((name, kind, cls, value))
return results
+def sort_attributes(attrs, object):
+ 'Sort the attrs list in-place by _fields and then alphabetically by name'
+ # This allows data descriptors to be ordered according
+ # to a _fields attribute if present.
+ fields = getattr(object, '_fields', [])
+ try:
+ field_order = {name : i-len(fields) for (i, name) in enumerate(fields)}
+ except TypeError:
+ field_order = {}
+ keyfunc = lambda attr: (field_order.get(attr[0], 0), attr[0])
+ attrs.sort(key=keyfunc)
+
# ----------------------------------------------------- module manipulation
def ispackage(path):
@@ -867,8 +879,7 @@
object.__module__)
tag += ':<br>\n'
- # Sort attrs by name.
- attrs.sort(key=lambda t: t[0])
+ sort_attributes(attrs, object)
# Pump out the attrs, segregated by kind.
attrs = spill('Methods %s' % tag, attrs,
@@ -1286,8 +1297,8 @@
else:
tag = "inherited from %s" % classname(thisclass,
object.__module__)
- # Sort attrs by name.
- attrs.sort()
+
+ sort_attributes(attrs, object)
# Pump out the attrs, segregated by kind.
attrs = spill("Methods %s:\n" % tag, attrs,
diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py
index f66dd62..38857d2 100644
--- a/Lib/pydoc_data/topics.py
+++ b/Lib/pydoc_data/topics.py
@@ -1,12881 +1,79 @@
# -*- coding: utf-8 -*-
-# Autogenerated by Sphinx on Sat Sep 12 17:22:24 2015
-topics = {'assert': '\n'
- 'The "assert" statement\n'
- '**********************\n'
- '\n'
- 'Assert statements are a convenient way to insert debugging '
- 'assertions\n'
- 'into a program:\n'
- '\n'
- ' assert_stmt ::= "assert" expression ["," expression]\n'
- '\n'
- 'The simple form, "assert expression", is equivalent to\n'
- '\n'
- ' if __debug__:\n'
- ' if not expression: raise AssertionError\n'
- '\n'
- 'The extended form, "assert expression1, expression2", is '
- 'equivalent to\n'
- '\n'
- ' if __debug__:\n'
- ' if not expression1: raise AssertionError(expression2)\n'
- '\n'
- 'These equivalences assume that "__debug__" and "AssertionError" '
- 'refer\n'
- 'to the built-in variables with those names. In the current\n'
- 'implementation, the built-in variable "__debug__" is "True" '
- 'under\n'
- 'normal circumstances, "False" when optimization is requested '
- '(command\n'
- 'line option -O). The current code generator emits no code for '
- 'an\n'
- 'assert statement when optimization is requested at compile '
- 'time. Note\n'
- 'that it is unnecessary to include the source code for the '
- 'expression\n'
- 'that failed in the error message; it will be displayed as part '
- 'of the\n'
- 'stack trace.\n'
- '\n'
- 'Assignments to "__debug__" are illegal. The value for the '
- 'built-in\n'
- 'variable is determined when the interpreter starts.\n',
- 'assignment': '\n'
- 'Assignment statements\n'
- '*********************\n'
- '\n'
- 'Assignment statements are used to (re)bind names to values '
- 'and to\n'
- 'modify attributes or items of mutable objects:\n'
- '\n'
- ' assignment_stmt ::= (target_list "=")+ (expression_list | '
- 'yield_expression)\n'
- ' target_list ::= target ("," target)* [","]\n'
- ' target ::= identifier\n'
- ' | "(" target_list ")"\n'
- ' | "[" target_list "]"\n'
- ' | attributeref\n'
- ' | subscription\n'
- ' | slicing\n'
- ' | "*" target\n'
- '\n'
- '(See section *Primaries* for the syntax definitions for\n'
- '*attributeref*, *subscription*, and *slicing*.)\n'
- '\n'
- 'An assignment statement evaluates the expression list '
- '(remember that\n'
- 'this can be a single expression or a comma-separated list, '
- 'the latter\n'
- 'yielding a tuple) and assigns the single resulting object to '
- 'each of\n'
- 'the target lists, from left to right.\n'
- '\n'
- 'Assignment is defined recursively depending on the form of '
- 'the target\n'
- '(list). When a target is part of a mutable object (an '
- 'attribute\n'
- 'reference, subscription or slicing), the mutable object '
- 'must\n'
- 'ultimately perform the assignment and decide about its '
- 'validity, and\n'
- 'may raise an exception if the assignment is unacceptable. '
- 'The rules\n'
- 'observed by various types and the exceptions raised are '
- 'given with the\n'
- 'definition of the object types (see section *The standard '
- 'type\n'
- 'hierarchy*).\n'
- '\n'
- 'Assignment of an object to a target list, optionally '
- 'enclosed in\n'
- 'parentheses or square brackets, is recursively defined as '
- 'follows.\n'
- '\n'
- '* If the target list is a single target: The object is '
- 'assigned to\n'
- ' that target.\n'
- '\n'
- '* If the target list is a comma-separated list of targets: '
- 'The\n'
- ' object must be an iterable with the same number of items '
- 'as there\n'
- ' are targets in the target list, and the items are '
- 'assigned, from\n'
- ' left to right, to the corresponding targets.\n'
- '\n'
- ' * If the target list contains one target prefixed with an\n'
- ' asterisk, called a "starred" target: The object must be '
- 'a sequence\n'
- ' with at least as many items as there are targets in the '
- 'target\n'
- ' list, minus one. The first items of the sequence are '
- 'assigned,\n'
- ' from left to right, to the targets before the starred '
- 'target. The\n'
- ' final items of the sequence are assigned to the targets '
- 'after the\n'
- ' starred target. A list of the remaining items in the '
- 'sequence is\n'
- ' then assigned to the starred target (the list can be '
- 'empty).\n'
- '\n'
- ' * Else: The object must be a sequence with the same number '
- 'of\n'
- ' items as there are targets in the target list, and the '
- 'items are\n'
- ' assigned, from left to right, to the corresponding '
- 'targets.\n'
- '\n'
- 'Assignment of an object to a single target is recursively '
- 'defined as\n'
- 'follows.\n'
- '\n'
- '* If the target is an identifier (name):\n'
- '\n'
- ' * If the name does not occur in a "global" or "nonlocal" '
- 'statement\n'
- ' in the current code block: the name is bound to the '
- 'object in the\n'
- ' current local namespace.\n'
- '\n'
- ' * Otherwise: the name is bound to the object in the '
- 'global\n'
- ' namespace or the outer namespace determined by '
- '"nonlocal",\n'
- ' respectively.\n'
- '\n'
- ' The name is rebound if it was already bound. This may '
- 'cause the\n'
- ' reference count for the object previously bound to the '
- 'name to reach\n'
- ' zero, causing the object to be deallocated and its '
- 'destructor (if it\n'
- ' has one) to be called.\n'
- '\n'
- '* If the target is a target list enclosed in parentheses or '
- 'in\n'
- ' square brackets: The object must be an iterable with the '
- 'same number\n'
- ' of items as there are targets in the target list, and its '
- 'items are\n'
- ' assigned, from left to right, to the corresponding '
- 'targets.\n'
- '\n'
- '* If the target is an attribute reference: The primary '
- 'expression in\n'
- ' the reference is evaluated. It should yield an object '
- 'with\n'
- ' assignable attributes; if this is not the case, '
- '"TypeError" is\n'
- ' raised. That object is then asked to assign the assigned '
- 'object to\n'
- ' the given attribute; if it cannot perform the assignment, '
- 'it raises\n'
- ' an exception (usually but not necessarily '
- '"AttributeError").\n'
- '\n'
- ' Note: If the object is a class instance and the attribute '
- 'reference\n'
- ' occurs on both sides of the assignment operator, the RHS '
- 'expression,\n'
- ' "a.x" can access either an instance attribute or (if no '
- 'instance\n'
- ' attribute exists) a class attribute. The LHS target "a.x" '
- 'is always\n'
- ' set as an instance attribute, creating it if necessary. '
- 'Thus, the\n'
- ' two occurrences of "a.x" do not necessarily refer to the '
- 'same\n'
- ' attribute: if the RHS expression refers to a class '
- 'attribute, the\n'
- ' LHS creates a new instance attribute as the target of the\n'
- ' assignment:\n'
- '\n'
- ' class Cls:\n'
- ' x = 3 # class variable\n'
- ' inst = Cls()\n'
- ' inst.x = inst.x + 1 # writes inst.x as 4 leaving '
- 'Cls.x as 3\n'
- '\n'
- ' This description does not necessarily apply to descriptor\n'
- ' attributes, such as properties created with "property()".\n'
- '\n'
- '* If the target is a subscription: The primary expression in '
- 'the\n'
- ' reference is evaluated. It should yield either a mutable '
- 'sequence\n'
- ' object (such as a list) or a mapping object (such as a '
- 'dictionary).\n'
- ' Next, the subscript expression is evaluated.\n'
- '\n'
- ' If the primary is a mutable sequence object (such as a '
- 'list), the\n'
- ' subscript must yield an integer. If it is negative, the '
- "sequence's\n"
- ' length is added to it. The resulting value must be a '
- 'nonnegative\n'
- " integer less than the sequence's length, and the sequence "
- 'is asked\n'
- ' to assign the assigned object to its item with that '
- 'index. If the\n'
- ' index is out of range, "IndexError" is raised (assignment '
- 'to a\n'
- ' subscripted sequence cannot add new items to a list).\n'
- '\n'
- ' If the primary is a mapping object (such as a dictionary), '
- 'the\n'
- " subscript must have a type compatible with the mapping's "
- 'key type,\n'
- ' and the mapping is then asked to create a key/datum pair '
- 'which maps\n'
- ' the subscript to the assigned object. This can either '
- 'replace an\n'
- ' existing key/value pair with the same key value, or insert '
- 'a new\n'
- ' key/value pair (if no key with the same value existed).\n'
- '\n'
- ' For user-defined objects, the "__setitem__()" method is '
- 'called with\n'
- ' appropriate arguments.\n'
- '\n'
- '* If the target is a slicing: The primary expression in the\n'
- ' reference is evaluated. It should yield a mutable '
- 'sequence object\n'
- ' (such as a list). The assigned object should be a '
- 'sequence object\n'
- ' of the same type. Next, the lower and upper bound '
- 'expressions are\n'
- ' evaluated, insofar they are present; defaults are zero and '
- 'the\n'
- " sequence's length. The bounds should evaluate to "
- 'integers. If\n'
- " either bound is negative, the sequence's length is added "
- 'to it. The\n'
- ' resulting bounds are clipped to lie between zero and the '
- "sequence's\n"
- ' length, inclusive. Finally, the sequence object is asked '
- 'to replace\n'
- ' the slice with the items of the assigned sequence. The '
- 'length of\n'
- ' the slice may be different from the length of the assigned '
- 'sequence,\n'
- ' thus changing the length of the target sequence, if the '
- 'target\n'
- ' sequence allows it.\n'
- '\n'
- '**CPython implementation detail:** In the current '
- 'implementation, the\n'
- 'syntax for targets is taken to be the same as for '
- 'expressions, and\n'
- 'invalid syntax is rejected during the code generation phase, '
- 'causing\n'
- 'less detailed error messages.\n'
- '\n'
- 'Although the definition of assignment implies that overlaps '
- 'between\n'
- 'the left-hand side and the right-hand side are '
- "'simultanenous' (for\n"
- 'example "a, b = b, a" swaps two variables), overlaps '
- '*within* the\n'
- 'collection of assigned-to variables occur left-to-right, '
- 'sometimes\n'
- 'resulting in confusion. For instance, the following program '
- 'prints\n'
- '"[0, 2]":\n'
- '\n'
- ' x = [0, 1]\n'
- ' i = 0\n'
- ' i, x[i] = 1, 2 # i is updated, then x[i] is '
- 'updated\n'
- ' print(x)\n'
- '\n'
- 'See also: **PEP 3132** - Extended Iterable Unpacking\n'
- '\n'
- ' The specification for the "*target" feature.\n'
- '\n'
- '\n'
- 'Augmented assignment statements\n'
- '===============================\n'
- '\n'
- 'Augmented assignment is the combination, in a single '
- 'statement, of a\n'
- 'binary operation and an assignment statement:\n'
- '\n'
- ' augmented_assignment_stmt ::= augtarget augop '
- '(expression_list | yield_expression)\n'
- ' augtarget ::= identifier | attributeref | '
- 'subscription | slicing\n'
- ' augop ::= "+=" | "-=" | "*=" | "@=" | '
- '"/=" | "//=" | "%=" | "**="\n'
- ' | ">>=" | "<<=" | "&=" | "^=" | "|="\n'
- '\n'
- '(See section *Primaries* for the syntax definitions of the '
- 'last three\n'
- 'symbols.)\n'
- '\n'
- 'An augmented assignment evaluates the target (which, unlike '
- 'normal\n'
- 'assignment statements, cannot be an unpacking) and the '
- 'expression\n'
- 'list, performs the binary operation specific to the type of '
- 'assignment\n'
- 'on the two operands, and assigns the result to the original '
- 'target.\n'
- 'The target is only evaluated once.\n'
- '\n'
- 'An augmented assignment expression like "x += 1" can be '
- 'rewritten as\n'
- '"x = x + 1" to achieve a similar, but not exactly equal '
- 'effect. In the\n'
- 'augmented version, "x" is only evaluated once. Also, when '
- 'possible,\n'
- 'the actual operation is performed *in-place*, meaning that '
- 'rather than\n'
- 'creating a new object and assigning that to the target, the '
- 'old object\n'
- 'is modified instead.\n'
- '\n'
- 'Unlike normal assignments, augmented assignments evaluate '
- 'the left-\n'
- 'hand side *before* evaluating the right-hand side. For '
- 'example, "a[i]\n'
- '+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and '
- 'performs\n'
- 'the addition, and lastly, it writes the result back to '
- '"a[i]".\n'
- '\n'
- 'With the exception of assigning to tuples and multiple '
- 'targets in a\n'
- 'single statement, the assignment done by augmented '
- 'assignment\n'
- 'statements is handled the same way as normal assignments. '
- 'Similarly,\n'
- 'with the exception of the possible *in-place* behavior, the '
- 'binary\n'
- 'operation performed by augmented assignment is the same as '
- 'the normal\n'
- 'binary operations.\n'
- '\n'
- 'For targets which are attribute references, the same *caveat '
- 'about\n'
- 'class and instance attributes* applies as for regular '
- 'assignments.\n',
- 'atom-identifiers': '\n'
- 'Identifiers (Names)\n'
- '*******************\n'
- '\n'
- 'An identifier occurring as an atom is a name. See '
- 'section\n'
- '*Identifiers and keywords* for lexical definition and '
- 'section *Naming\n'
- 'and binding* for documentation of naming and binding.\n'
- '\n'
- 'When the name is bound to an object, evaluation of the '
- 'atom yields\n'
- 'that object. When a name is not bound, an attempt to '
- 'evaluate it\n'
- 'raises a "NameError" exception.\n'
- '\n'
- '**Private name mangling:** When an identifier that '
- 'textually occurs in\n'
- 'a class definition begins with two or more underscore '
- 'characters and\n'
- 'does not end in two or more underscores, it is '
- 'considered a *private\n'
- 'name* of that class. Private names are transformed to '
- 'a longer form\n'
- 'before code is generated for them. The transformation '
- 'inserts the\n'
- 'class name, with leading underscores removed and a '
- 'single underscore\n'
- 'inserted, in front of the name. For example, the '
- 'identifier "__spam"\n'
- 'occurring in a class named "Ham" will be transformed '
- 'to "_Ham__spam".\n'
- 'This transformation is independent of the syntactical '
- 'context in which\n'
- 'the identifier is used. If the transformed name is '
- 'extremely long\n'
- '(longer than 255 characters), implementation defined '
- 'truncation may\n'
- 'happen. If the class name consists only of '
- 'underscores, no\n'
- 'transformation is done.\n',
- 'atom-literals': '\n'
- 'Literals\n'
- '********\n'
- '\n'
- 'Python supports string and bytes literals and various '
- 'numeric\n'
- 'literals:\n'
- '\n'
- ' literal ::= stringliteral | bytesliteral\n'
- ' | integer | floatnumber | imagnumber\n'
- '\n'
- 'Evaluation of a literal yields an object of the given '
- 'type (string,\n'
- 'bytes, integer, floating point number, complex number) '
- 'with the given\n'
- 'value. The value may be approximated in the case of '
- 'floating point\n'
- 'and imaginary (complex) literals. See section *Literals* '
- 'for details.\n'
- '\n'
- 'All literals correspond to immutable data types, and '
- 'hence the\n'
- "object's identity is less important than its value. "
- 'Multiple\n'
- 'evaluations of literals with the same value (either the '
- 'same\n'
- 'occurrence in the program text or a different occurrence) '
- 'may obtain\n'
- 'the same object or a different object with the same '
- 'value.\n',
- 'attribute-access': '\n'
- 'Customizing attribute access\n'
- '****************************\n'
- '\n'
- 'The following methods can be defined to customize the '
- 'meaning of\n'
- 'attribute access (use of, assignment to, or deletion '
- 'of "x.name") for\n'
- 'class instances.\n'
- '\n'
- 'object.__getattr__(self, name)\n'
- '\n'
- ' Called when an attribute lookup has not found the '
- 'attribute in the\n'
- ' usual places (i.e. it is not an instance attribute '
- 'nor is it found\n'
- ' in the class tree for "self"). "name" is the '
- 'attribute name. This\n'
- ' method should return the (computed) attribute value '
- 'or raise an\n'
- ' "AttributeError" exception.\n'
- '\n'
- ' Note that if the attribute is found through the '
- 'normal mechanism,\n'
- ' "__getattr__()" is not called. (This is an '
- 'intentional asymmetry\n'
- ' between "__getattr__()" and "__setattr__()".) This '
- 'is done both for\n'
- ' efficiency reasons and because otherwise '
- '"__getattr__()" would have\n'
- ' no way to access other attributes of the instance. '
- 'Note that at\n'
- ' least for instance variables, you can fake total '
- 'control by not\n'
- ' inserting any values in the instance attribute '
- 'dictionary (but\n'
- ' instead inserting them in another object). See '
- 'the\n'
- ' "__getattribute__()" method below for a way to '
- 'actually get total\n'
- ' control over attribute access.\n'
- '\n'
- 'object.__getattribute__(self, name)\n'
- '\n'
- ' Called unconditionally to implement attribute '
- 'accesses for\n'
- ' instances of the class. If the class also defines '
- '"__getattr__()",\n'
- ' the latter will not be called unless '
- '"__getattribute__()" either\n'
- ' calls it explicitly or raises an "AttributeError". '
- 'This method\n'
- ' should return the (computed) attribute value or '
- 'raise an\n'
- ' "AttributeError" exception. In order to avoid '
- 'infinite recursion in\n'
- ' this method, its implementation should always call '
- 'the base class\n'
- ' method with the same name to access any attributes '
- 'it needs, for\n'
- ' example, "object.__getattribute__(self, name)".\n'
- '\n'
- ' Note: This method may still be bypassed when '
- 'looking up special\n'
- ' methods as the result of implicit invocation via '
- 'language syntax\n'
- ' or built-in functions. See *Special method '
- 'lookup*.\n'
- '\n'
- 'object.__setattr__(self, name, value)\n'
- '\n'
- ' Called when an attribute assignment is attempted. '
- 'This is called\n'
- ' instead of the normal mechanism (i.e. store the '
- 'value in the\n'
- ' instance dictionary). *name* is the attribute name, '
- '*value* is the\n'
- ' value to be assigned to it.\n'
- '\n'
- ' If "__setattr__()" wants to assign to an instance '
- 'attribute, it\n'
- ' should call the base class method with the same '
- 'name, for example,\n'
- ' "object.__setattr__(self, name, value)".\n'
- '\n'
- 'object.__delattr__(self, name)\n'
- '\n'
- ' Like "__setattr__()" but for attribute deletion '
- 'instead of\n'
- ' assignment. This should only be implemented if '
- '"del obj.name" is\n'
- ' meaningful for the object.\n'
- '\n'
- 'object.__dir__(self)\n'
- '\n'
- ' Called when "dir()" is called on the object. A '
- 'sequence must be\n'
- ' returned. "dir()" converts the returned sequence to '
- 'a list and\n'
- ' sorts it.\n'
- '\n'
- '\n'
- 'Implementing Descriptors\n'
- '========================\n'
- '\n'
- 'The following methods only apply when an instance of '
- 'the class\n'
- 'containing the method (a so-called *descriptor* class) '
- 'appears in an\n'
- '*owner* class (the descriptor must be in either the '
- "owner's class\n"
- 'dictionary or in the class dictionary for one of its '
- 'parents). In the\n'
- 'examples below, "the attribute" refers to the '
- 'attribute whose name is\n'
- "the key of the property in the owner class' "
- '"__dict__".\n'
- '\n'
- 'object.__get__(self, instance, owner)\n'
- '\n'
- ' Called to get the attribute of the owner class '
- '(class attribute\n'
- ' access) or of an instance of that class (instance '
- 'attribute\n'
- ' access). *owner* is always the owner class, while '
- '*instance* is the\n'
- ' instance that the attribute was accessed through, '
- 'or "None" when\n'
- ' the attribute is accessed through the *owner*. '
- 'This method should\n'
- ' return the (computed) attribute value or raise an '
- '"AttributeError"\n'
- ' exception.\n'
- '\n'
- 'object.__set__(self, instance, value)\n'
- '\n'
- ' Called to set the attribute on an instance '
- '*instance* of the owner\n'
- ' class to a new value, *value*.\n'
- '\n'
- 'object.__delete__(self, instance)\n'
- '\n'
- ' Called to delete the attribute on an instance '
- '*instance* of the\n'
- ' owner class.\n'
- '\n'
- 'The attribute "__objclass__" is interpreted by the '
- '"inspect" module as\n'
- 'specifying the class where this object was defined '
- '(setting this\n'
- 'appropriately can assist in runtime introspection of '
- 'dynamic class\n'
- 'attributes). For callables, it may indicate that an '
- 'instance of the\n'
- 'given type (or a subclass) is expected or required as '
- 'the first\n'
- 'positional argument (for example, CPython sets this '
- 'attribute for\n'
- 'unbound methods that are implemented in C).\n'
- '\n'
- '\n'
- 'Invoking Descriptors\n'
- '====================\n'
- '\n'
- 'In general, a descriptor is an object attribute with '
- '"binding\n'
- 'behavior", one whose attribute access has been '
- 'overridden by methods\n'
- 'in the descriptor protocol: "__get__()", "__set__()", '
- 'and\n'
- '"__delete__()". If any of those methods are defined '
- 'for an object, it\n'
- 'is said to be a descriptor.\n'
- '\n'
- 'The default behavior for attribute access is to get, '
- 'set, or delete\n'
- "the attribute from an object's dictionary. For "
- 'instance, "a.x" has a\n'
- 'lookup chain starting with "a.__dict__[\'x\']", then\n'
- '"type(a).__dict__[\'x\']", and continuing through the '
- 'base classes of\n'
- '"type(a)" excluding metaclasses.\n'
- '\n'
- 'However, if the looked-up value is an object defining '
- 'one of the\n'
- 'descriptor methods, then Python may override the '
- 'default behavior and\n'
- 'invoke the descriptor method instead. Where this '
- 'occurs in the\n'
- 'precedence chain depends on which descriptor methods '
- 'were defined and\n'
- 'how they were called.\n'
- '\n'
- 'The starting point for descriptor invocation is a '
- 'binding, "a.x". How\n'
- 'the arguments are assembled depends on "a":\n'
- '\n'
- 'Direct Call\n'
- ' The simplest and least common call is when user '
- 'code directly\n'
- ' invokes a descriptor method: "x.__get__(a)".\n'
- '\n'
- 'Instance Binding\n'
- ' If binding to an object instance, "a.x" is '
- 'transformed into the\n'
- ' call: "type(a).__dict__[\'x\'].__get__(a, '
- 'type(a))".\n'
- '\n'
- 'Class Binding\n'
- ' If binding to a class, "A.x" is transformed into '
- 'the call:\n'
- ' "A.__dict__[\'x\'].__get__(None, A)".\n'
- '\n'
- 'Super Binding\n'
- ' If "a" is an instance of "super", then the binding '
- '"super(B,\n'
- ' obj).m()" searches "obj.__class__.__mro__" for the '
- 'base class "A"\n'
- ' immediately preceding "B" and then invokes the '
- 'descriptor with the\n'
- ' call: "A.__dict__[\'m\'].__get__(obj, '
- 'obj.__class__)".\n'
- '\n'
- 'For instance bindings, the precedence of descriptor '
- 'invocation depends\n'
- 'on the which descriptor methods are defined. A '
- 'descriptor can define\n'
- 'any combination of "__get__()", "__set__()" and '
- '"__delete__()". If it\n'
- 'does not define "__get__()", then accessing the '
- 'attribute will return\n'
- 'the descriptor object itself unless there is a value '
- "in the object's\n"
- 'instance dictionary. If the descriptor defines '
- '"__set__()" and/or\n'
- '"__delete__()", it is a data descriptor; if it defines '
- 'neither, it is\n'
- 'a non-data descriptor. Normally, data descriptors '
- 'define both\n'
- '"__get__()" and "__set__()", while non-data '
- 'descriptors have just the\n'
- '"__get__()" method. Data descriptors with "__set__()" '
- 'and "__get__()"\n'
- 'defined always override a redefinition in an instance '
- 'dictionary. In\n'
- 'contrast, non-data descriptors can be overridden by '
- 'instances.\n'
- '\n'
- 'Python methods (including "staticmethod()" and '
- '"classmethod()") are\n'
- 'implemented as non-data descriptors. Accordingly, '
- 'instances can\n'
- 'redefine and override methods. This allows individual '
- 'instances to\n'
- 'acquire behaviors that differ from other instances of '
- 'the same class.\n'
- '\n'
- 'The "property()" function is implemented as a data '
- 'descriptor.\n'
- 'Accordingly, instances cannot override the behavior of '
- 'a property.\n'
- '\n'
- '\n'
- '__slots__\n'
- '=========\n'
- '\n'
- 'By default, instances of classes have a dictionary for '
- 'attribute\n'
- 'storage. This wastes space for objects having very '
- 'few instance\n'
- 'variables. The space consumption can become acute '
- 'when creating large\n'
- 'numbers of instances.\n'
- '\n'
- 'The default can be overridden by defining *__slots__* '
- 'in a class\n'
- 'definition. The *__slots__* declaration takes a '
- 'sequence of instance\n'
- 'variables and reserves just enough space in each '
- 'instance to hold a\n'
- 'value for each variable. Space is saved because '
- '*__dict__* is not\n'
- 'created for each instance.\n'
- '\n'
- 'object.__slots__\n'
- '\n'
- ' This class variable can be assigned a string, '
- 'iterable, or sequence\n'
- ' of strings with variable names used by instances. '
- '*__slots__*\n'
- ' reserves space for the declared variables and '
- 'prevents the\n'
- ' automatic creation of *__dict__* and *__weakref__* '
- 'for each\n'
- ' instance.\n'
- '\n'
- '\n'
- 'Notes on using *__slots__*\n'
- '--------------------------\n'
- '\n'
- '* When inheriting from a class without *__slots__*, '
- 'the *__dict__*\n'
- ' attribute of that class will always be accessible, '
- 'so a *__slots__*\n'
- ' definition in the subclass is meaningless.\n'
- '\n'
- '* Without a *__dict__* variable, instances cannot be '
- 'assigned new\n'
- ' variables not listed in the *__slots__* definition. '
- 'Attempts to\n'
- ' assign to an unlisted variable name raises '
- '"AttributeError". If\n'
- ' dynamic assignment of new variables is desired, then '
- 'add\n'
- ' "\'__dict__\'" to the sequence of strings in the '
- '*__slots__*\n'
- ' declaration.\n'
- '\n'
- '* Without a *__weakref__* variable for each instance, '
- 'classes\n'
- ' defining *__slots__* do not support weak references '
- 'to its\n'
- ' instances. If weak reference support is needed, then '
- 'add\n'
- ' "\'__weakref__\'" to the sequence of strings in the '
- '*__slots__*\n'
- ' declaration.\n'
- '\n'
- '* *__slots__* are implemented at the class level by '
- 'creating\n'
- ' descriptors (*Implementing Descriptors*) for each '
- 'variable name. As\n'
- ' a result, class attributes cannot be used to set '
- 'default values for\n'
- ' instance variables defined by *__slots__*; '
- 'otherwise, the class\n'
- ' attribute would overwrite the descriptor '
- 'assignment.\n'
- '\n'
- '* The action of a *__slots__* declaration is limited '
- 'to the class\n'
- ' where it is defined. As a result, subclasses will '
- 'have a *__dict__*\n'
- ' unless they also define *__slots__* (which must only '
- 'contain names\n'
- ' of any *additional* slots).\n'
- '\n'
- '* If a class defines a slot also defined in a base '
- 'class, the\n'
- ' instance variable defined by the base class slot is '
- 'inaccessible\n'
- ' (except by retrieving its descriptor directly from '
- 'the base class).\n'
- ' This renders the meaning of the program undefined. '
- 'In the future, a\n'
- ' check may be added to prevent this.\n'
- '\n'
- '* Nonempty *__slots__* does not work for classes '
- 'derived from\n'
- ' "variable-length" built-in types such as "int", '
- '"bytes" and "tuple".\n'
- '\n'
- '* Any non-string iterable may be assigned to '
- '*__slots__*. Mappings\n'
- ' may also be used; however, in the future, special '
- 'meaning may be\n'
- ' assigned to the values corresponding to each key.\n'
- '\n'
- '* *__class__* assignment works only if both classes '
- 'have the same\n'
- ' *__slots__*.\n',
- 'attribute-references': '\n'
- 'Attribute references\n'
- '********************\n'
- '\n'
- 'An attribute reference is a primary followed by a '
- 'period and a name:\n'
- '\n'
- ' attributeref ::= primary "." identifier\n'
- '\n'
- 'The primary must evaluate to an object of a type '
- 'that supports\n'
- 'attribute references, which most objects do. This '
- 'object is then\n'
- 'asked to produce the attribute whose name is the '
- 'identifier. This\n'
- 'production can be customized by overriding the '
- '"__getattr__()" method.\n'
- 'If this attribute is not available, the exception '
- '"AttributeError" is\n'
- 'raised. Otherwise, the type and value of the '
- 'object produced is\n'
- 'determined by the object. Multiple evaluations of '
- 'the same attribute\n'
- 'reference may yield different objects.\n',
- 'augassign': '\n'
- 'Augmented assignment statements\n'
- '*******************************\n'
- '\n'
- 'Augmented assignment is the combination, in a single '
- 'statement, of a\n'
- 'binary operation and an assignment statement:\n'
- '\n'
- ' augmented_assignment_stmt ::= augtarget augop '
- '(expression_list | yield_expression)\n'
- ' augtarget ::= identifier | attributeref | '
- 'subscription | slicing\n'
- ' augop ::= "+=" | "-=" | "*=" | "@=" | '
- '"/=" | "//=" | "%=" | "**="\n'
- ' | ">>=" | "<<=" | "&=" | "^=" | "|="\n'
- '\n'
- '(See section *Primaries* for the syntax definitions of the '
- 'last three\n'
- 'symbols.)\n'
- '\n'
- 'An augmented assignment evaluates the target (which, unlike '
- 'normal\n'
- 'assignment statements, cannot be an unpacking) and the '
- 'expression\n'
- 'list, performs the binary operation specific to the type of '
- 'assignment\n'
- 'on the two operands, and assigns the result to the original '
- 'target.\n'
- 'The target is only evaluated once.\n'
- '\n'
- 'An augmented assignment expression like "x += 1" can be '
- 'rewritten as\n'
- '"x = x + 1" to achieve a similar, but not exactly equal '
- 'effect. In the\n'
- 'augmented version, "x" is only evaluated once. Also, when '
- 'possible,\n'
- 'the actual operation is performed *in-place*, meaning that '
- 'rather than\n'
- 'creating a new object and assigning that to the target, the '
- 'old object\n'
- 'is modified instead.\n'
- '\n'
- 'Unlike normal assignments, augmented assignments evaluate the '
- 'left-\n'
- 'hand side *before* evaluating the right-hand side. For '
- 'example, "a[i]\n'
- '+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and '
- 'performs\n'
- 'the addition, and lastly, it writes the result back to '
- '"a[i]".\n'
- '\n'
- 'With the exception of assigning to tuples and multiple '
- 'targets in a\n'
- 'single statement, the assignment done by augmented '
- 'assignment\n'
- 'statements is handled the same way as normal assignments. '
- 'Similarly,\n'
- 'with the exception of the possible *in-place* behavior, the '
- 'binary\n'
- 'operation performed by augmented assignment is the same as '
- 'the normal\n'
- 'binary operations.\n'
- '\n'
- 'For targets which are attribute references, the same *caveat '
- 'about\n'
- 'class and instance attributes* applies as for regular '
- 'assignments.\n',
- 'binary': '\n'
- 'Binary arithmetic operations\n'
- '****************************\n'
- '\n'
- 'The binary arithmetic operations have the conventional priority\n'
- 'levels. Note that some of these operations also apply to '
- 'certain non-\n'
- 'numeric types. Apart from the power operator, there are only '
- 'two\n'
- 'levels, one for multiplicative operators and one for additive\n'
- 'operators:\n'
- '\n'
- ' m_expr ::= u_expr | m_expr "*" u_expr | m_expr "@" m_expr |\n'
- ' m_expr "//" u_expr| m_expr "/" u_expr |\n'
- ' m_expr "%" u_expr\n'
- ' a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr\n'
- '\n'
- 'The "*" (multiplication) operator yields the product of its '
- 'arguments.\n'
- 'The arguments must either both be numbers, or one argument must '
- 'be an\n'
- 'integer and the other must be a sequence. In the former case, '
- 'the\n'
- 'numbers are converted to a common type and then multiplied '
- 'together.\n'
- 'In the latter case, sequence repetition is performed; a '
- 'negative\n'
- 'repetition factor yields an empty sequence.\n'
- '\n'
- 'The "@" (at) operator is intended to be used for matrix\n'
- 'multiplication. No builtin Python types implement this '
- 'operator.\n'
- '\n'
- 'New in version 3.5.\n'
- '\n'
- 'The "/" (division) and "//" (floor division) operators yield '
- 'the\n'
- 'quotient of their arguments. The numeric arguments are first\n'
- 'converted to a common type. Division of integers yields a float, '
- 'while\n'
- 'floor division of integers results in an integer; the result is '
- 'that\n'
- "of mathematical division with the 'floor' function applied to "
- 'the\n'
- 'result. Division by zero raises the "ZeroDivisionError" '
- 'exception.\n'
- '\n'
- 'The "%" (modulo) operator yields the remainder from the division '
- 'of\n'
- 'the first argument by the second. The numeric arguments are '
- 'first\n'
- 'converted to a common type. A zero right argument raises the\n'
- '"ZeroDivisionError" exception. The arguments may be floating '
- 'point\n'
- 'numbers, e.g., "3.14%0.7" equals "0.34" (since "3.14" equals '
- '"4*0.7 +\n'
- '0.34".) The modulo operator always yields a result with the '
- 'same sign\n'
- 'as its second operand (or zero); the absolute value of the '
- 'result is\n'
- 'strictly smaller than the absolute value of the second operand '
- '[1].\n'
- '\n'
- 'The floor division and modulo operators are connected by the '
- 'following\n'
- 'identity: "x == (x//y)*y + (x%y)". Floor division and modulo '
- 'are also\n'
- 'connected with the built-in function "divmod()": "divmod(x, y) '
- '==\n'
- '(x//y, x%y)". [2].\n'
- '\n'
- 'In addition to performing the modulo operation on numbers, the '
- '"%"\n'
- 'operator is also overloaded by string objects to perform '
- 'old-style\n'
- 'string formatting (also known as interpolation). The syntax '
- 'for\n'
- 'string formatting is described in the Python Library Reference,\n'
- 'section *printf-style String Formatting*.\n'
- '\n'
- 'The floor division operator, the modulo operator, and the '
- '"divmod()"\n'
- 'function are not defined for complex numbers. Instead, convert '
- 'to a\n'
- 'floating point number using the "abs()" function if '
- 'appropriate.\n'
- '\n'
- 'The "+" (addition) operator yields the sum of its arguments. '
- 'The\n'
- 'arguments must either both be numbers or both be sequences of '
- 'the same\n'
- 'type. In the former case, the numbers are converted to a common '
- 'type\n'
- 'and then added together. In the latter case, the sequences are\n'
- 'concatenated.\n'
- '\n'
- 'The "-" (subtraction) operator yields the difference of its '
- 'arguments.\n'
- 'The numeric arguments are first converted to a common type.\n',
- 'bitwise': '\n'
- 'Binary bitwise operations\n'
- '*************************\n'
- '\n'
- 'Each of the three bitwise operations has a different priority '
- 'level:\n'
- '\n'
- ' and_expr ::= shift_expr | and_expr "&" shift_expr\n'
- ' xor_expr ::= and_expr | xor_expr "^" and_expr\n'
- ' or_expr ::= xor_expr | or_expr "|" xor_expr\n'
- '\n'
- 'The "&" operator yields the bitwise AND of its arguments, which '
- 'must\n'
- 'be integers.\n'
- '\n'
- 'The "^" operator yields the bitwise XOR (exclusive OR) of its\n'
- 'arguments, which must be integers.\n'
- '\n'
- 'The "|" operator yields the bitwise (inclusive) OR of its '
- 'arguments,\n'
- 'which must be integers.\n',
- 'bltin-code-objects': '\n'
- 'Code Objects\n'
- '************\n'
- '\n'
- 'Code objects are used by the implementation to '
- 'represent "pseudo-\n'
- 'compiled" executable Python code such as a function '
- 'body. They differ\n'
- "from function objects because they don't contain a "
- 'reference to their\n'
- 'global execution environment. Code objects are '
- 'returned by the built-\n'
- 'in "compile()" function and can be extracted from '
- 'function objects\n'
- 'through their "__code__" attribute. See also the '
- '"code" module.\n'
- '\n'
- 'A code object can be executed or evaluated by '
- 'passing it (instead of a\n'
- 'source string) to the "exec()" or "eval()" built-in '
- 'functions.\n'
- '\n'
- 'See *The standard type hierarchy* for more '
- 'information.\n',
- 'bltin-ellipsis-object': '\n'
- 'The Ellipsis Object\n'
- '*******************\n'
- '\n'
- 'This object is commonly used by slicing (see '
- '*Slicings*). It supports\n'
- 'no special operations. There is exactly one '
- 'ellipsis object, named\n'
- '"Ellipsis" (a built-in name). "type(Ellipsis)()" '
- 'produces the\n'
- '"Ellipsis" singleton.\n'
- '\n'
- 'It is written as "Ellipsis" or "...".\n',
- 'bltin-null-object': '\n'
- 'The Null Object\n'
- '***************\n'
- '\n'
- "This object is returned by functions that don't "
- 'explicitly return a\n'
- 'value. It supports no special operations. There is '
- 'exactly one null\n'
- 'object, named "None" (a built-in name). '
- '"type(None)()" produces the\n'
- 'same singleton.\n'
- '\n'
- 'It is written as "None".\n',
- 'bltin-type-objects': '\n'
- 'Type Objects\n'
- '************\n'
- '\n'
- 'Type objects represent the various object types. An '
- "object's type is\n"
- 'accessed by the built-in function "type()". There '
- 'are no special\n'
- 'operations on types. The standard module "types" '
- 'defines names for\n'
- 'all standard built-in types.\n'
- '\n'
- 'Types are written like this: "<class \'int\'>".\n',
- 'booleans': '\n'
- 'Boolean operations\n'
- '******************\n'
- '\n'
- ' or_test ::= and_test | or_test "or" and_test\n'
- ' and_test ::= not_test | and_test "and" not_test\n'
- ' not_test ::= comparison | "not" not_test\n'
- '\n'
- 'In the context of Boolean operations, and also when '
- 'expressions are\n'
- 'used by control flow statements, the following values are '
- 'interpreted\n'
- 'as false: "False", "None", numeric zero of all types, and '
- 'empty\n'
- 'strings and containers (including strings, tuples, lists,\n'
- 'dictionaries, sets and frozensets). All other values are '
- 'interpreted\n'
- 'as true. User-defined objects can customize their truth value '
- 'by\n'
- 'providing a "__bool__()" method.\n'
- '\n'
- 'The operator "not" yields "True" if its argument is false, '
- '"False"\n'
- 'otherwise.\n'
- '\n'
- 'The expression "x and y" first evaluates *x*; if *x* is false, '
- 'its\n'
- 'value is returned; otherwise, *y* is evaluated and the '
- 'resulting value\n'
- 'is returned.\n'
- '\n'
- 'The expression "x or y" first evaluates *x*; if *x* is true, '
- 'its value\n'
- 'is returned; otherwise, *y* is evaluated and the resulting '
- 'value is\n'
- 'returned.\n'
- '\n'
- '(Note that neither "and" nor "or" restrict the value and type '
- 'they\n'
- 'return to "False" and "True", but rather return the last '
- 'evaluated\n'
- 'argument. This is sometimes useful, e.g., if "s" is a string '
- 'that\n'
- 'should be replaced by a default value if it is empty, the '
- 'expression\n'
- '"s or \'foo\'" yields the desired value. Because "not" has to '
- 'create a\n'
- 'new value, it returns a boolean value regardless of the type '
- 'of its\n'
- 'argument (for example, "not \'foo\'" produces "False" rather '
- 'than "\'\'".)\n',
- 'break': '\n'
- 'The "break" statement\n'
- '*********************\n'
- '\n'
- ' break_stmt ::= "break"\n'
- '\n'
- '"break" may only occur syntactically nested in a "for" or '
- '"while"\n'
- 'loop, but not nested in a function or class definition within '
- 'that\n'
- 'loop.\n'
- '\n'
- 'It terminates the nearest enclosing loop, skipping the optional '
- '"else"\n'
- 'clause if the loop has one.\n'
- '\n'
- 'If a "for" loop is terminated by "break", the loop control '
- 'target\n'
- 'keeps its current value.\n'
- '\n'
- 'When "break" passes control out of a "try" statement with a '
- '"finally"\n'
- 'clause, that "finally" clause is executed before really leaving '
- 'the\n'
- 'loop.\n',
- 'callable-types': '\n'
- 'Emulating callable objects\n'
- '**************************\n'
- '\n'
- 'object.__call__(self[, args...])\n'
- '\n'
- ' Called when the instance is "called" as a function; '
- 'if this method\n'
- ' is defined, "x(arg1, arg2, ...)" is a shorthand for\n'
- ' "x.__call__(arg1, arg2, ...)".\n',
- 'calls': '\n'
- 'Calls\n'
- '*****\n'
- '\n'
- 'A call calls a callable object (e.g., a *function*) with a '
- 'possibly\n'
- 'empty series of *arguments*:\n'
- '\n'
- ' call ::= primary "(" [argument_list [","] | '
- 'comprehension] ")"\n'
- ' argument_list ::= positional_arguments ["," '
- 'keyword_arguments]\n'
- ' ["," "*" expression] ["," '
- 'keyword_arguments]\n'
- ' ["," "**" expression]\n'
- ' | keyword_arguments ["," "*" expression]\n'
- ' ["," keyword_arguments] ["," "**" '
- 'expression]\n'
- ' | "*" expression ["," keyword_arguments] '
- '["," "**" expression]\n'
- ' | "**" expression\n'
- ' positional_arguments ::= expression ("," expression)*\n'
- ' keyword_arguments ::= keyword_item ("," keyword_item)*\n'
- ' keyword_item ::= identifier "=" expression\n'
- '\n'
- 'An optional trailing comma may be present after the positional '
- 'and\n'
- 'keyword arguments but does not affect the semantics.\n'
- '\n'
- 'The primary must evaluate to a callable object (user-defined\n'
- 'functions, built-in functions, methods of built-in objects, '
- 'class\n'
- 'objects, methods of class instances, and all objects having a\n'
- '"__call__()" method are callable). All argument expressions are\n'
- 'evaluated before the call is attempted. Please refer to section\n'
- '*Function definitions* for the syntax of formal *parameter* '
- 'lists.\n'
- '\n'
- 'If keyword arguments are present, they are first converted to\n'
- 'positional arguments, as follows. First, a list of unfilled '
- 'slots is\n'
- 'created for the formal parameters. If there are N positional\n'
- 'arguments, they are placed in the first N slots. Next, for each\n'
- 'keyword argument, the identifier is used to determine the\n'
- 'corresponding slot (if the identifier is the same as the first '
- 'formal\n'
- 'parameter name, the first slot is used, and so on). If the slot '
- 'is\n'
- 'already filled, a "TypeError" exception is raised. Otherwise, '
- 'the\n'
- 'value of the argument is placed in the slot, filling it (even if '
- 'the\n'
- 'expression is "None", it fills the slot). When all arguments '
- 'have\n'
- 'been processed, the slots that are still unfilled are filled with '
- 'the\n'
- 'corresponding default value from the function definition. '
- '(Default\n'
- 'values are calculated, once, when the function is defined; thus, '
- 'a\n'
- 'mutable object such as a list or dictionary used as default value '
- 'will\n'
- "be shared by all calls that don't specify an argument value for "
- 'the\n'
- 'corresponding slot; this should usually be avoided.) If there '
- 'are any\n'
- 'unfilled slots for which no default value is specified, a '
- '"TypeError"\n'
- 'exception is raised. Otherwise, the list of filled slots is used '
- 'as\n'
- 'the argument list for the call.\n'
- '\n'
- '**CPython implementation detail:** An implementation may provide\n'
- 'built-in functions whose positional parameters do not have names, '
- 'even\n'
- "if they are 'named' for the purpose of documentation, and which\n"
- 'therefore cannot be supplied by keyword. In CPython, this is the '
- 'case\n'
- 'for functions implemented in C that use "PyArg_ParseTuple()" to '
- 'parse\n'
- 'their arguments.\n'
- '\n'
- 'If there are more positional arguments than there are formal '
- 'parameter\n'
- 'slots, a "TypeError" exception is raised, unless a formal '
- 'parameter\n'
- 'using the syntax "*identifier" is present; in this case, that '
- 'formal\n'
- 'parameter receives a tuple containing the excess positional '
- 'arguments\n'
- '(or an empty tuple if there were no excess positional '
- 'arguments).\n'
- '\n'
- 'If any keyword argument does not correspond to a formal '
- 'parameter\n'
- 'name, a "TypeError" exception is raised, unless a formal '
- 'parameter\n'
- 'using the syntax "**identifier" is present; in this case, that '
- 'formal\n'
- 'parameter receives a dictionary containing the excess keyword\n'
- 'arguments (using the keywords as keys and the argument values as\n'
- 'corresponding values), or a (new) empty dictionary if there were '
- 'no\n'
- 'excess keyword arguments.\n'
- '\n'
- 'If the syntax "*expression" appears in the function call, '
- '"expression"\n'
- 'must evaluate to an iterable. Elements from this iterable are '
- 'treated\n'
- 'as if they were additional positional arguments; if there are\n'
- 'positional arguments *x1*, ..., *xN*, and "expression" evaluates '
- 'to a\n'
- 'sequence *y1*, ..., *yM*, this is equivalent to a call with M+N\n'
- 'positional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n'
- '\n'
- 'A consequence of this is that although the "*expression" syntax '
- 'may\n'
- 'appear *after* some keyword arguments, it is processed *before* '
- 'the\n'
- 'keyword arguments (and the "**expression" argument, if any -- '
- 'see\n'
- 'below). So:\n'
- '\n'
- ' >>> def f(a, b):\n'
- ' ... print(a, b)\n'
- ' ...\n'
- ' >>> f(b=1, *(2,))\n'
- ' 2 1\n'
- ' >>> f(a=1, *(2,))\n'
- ' Traceback (most recent call last):\n'
- ' File "<stdin>", line 1, in ?\n'
- " TypeError: f() got multiple values for keyword argument 'a'\n"
- ' >>> f(1, *(2,))\n'
- ' 1 2\n'
- '\n'
- 'It is unusual for both keyword arguments and the "*expression" '
- 'syntax\n'
- 'to be used in the same call, so in practice this confusion does '
- 'not\n'
- 'arise.\n'
- '\n'
- 'If the syntax "**expression" appears in the function call,\n'
- '"expression" must evaluate to a mapping, the contents of which '
- 'are\n'
- 'treated as additional keyword arguments. In the case of a '
- 'keyword\n'
- 'appearing in both "expression" and as an explicit keyword '
- 'argument, a\n'
- '"TypeError" exception is raised.\n'
- '\n'
- 'Formal parameters using the syntax "*identifier" or '
- '"**identifier"\n'
- 'cannot be used as positional argument slots or as keyword '
- 'argument\n'
- 'names.\n'
- '\n'
- 'A call always returns some value, possibly "None", unless it '
- 'raises an\n'
- 'exception. How this value is computed depends on the type of '
- 'the\n'
- 'callable object.\n'
- '\n'
- 'If it is---\n'
- '\n'
- 'a user-defined function:\n'
- ' The code block for the function is executed, passing it the\n'
- ' argument list. The first thing the code block will do is bind '
- 'the\n'
- ' formal parameters to the arguments; this is described in '
- 'section\n'
- ' *Function definitions*. When the code block executes a '
- '"return"\n'
- ' statement, this specifies the return value of the function '
- 'call.\n'
- '\n'
- 'a built-in function or method:\n'
- ' The result is up to the interpreter; see *Built-in Functions* '
- 'for\n'
- ' the descriptions of built-in functions and methods.\n'
- '\n'
- 'a class object:\n'
- ' A new instance of that class is returned.\n'
- '\n'
- 'a class instance method:\n'
- ' The corresponding user-defined function is called, with an '
- 'argument\n'
- ' list that is one longer than the argument list of the call: '
- 'the\n'
- ' instance becomes the first argument.\n'
- '\n'
- 'a class instance:\n'
- ' The class must define a "__call__()" method; the effect is '
- 'then the\n'
- ' same as if that method was called.\n',
- 'class': '\n'
- 'Class definitions\n'
- '*****************\n'
- '\n'
- 'A class definition defines a class object (see section *The '
- 'standard\n'
- 'type hierarchy*):\n'
- '\n'
- ' classdef ::= [decorators] "class" classname [inheritance] '
- '":" suite\n'
- ' inheritance ::= "(" [parameter_list] ")"\n'
- ' classname ::= identifier\n'
- '\n'
- 'A class definition is an executable statement. The inheritance '
- 'list\n'
- 'usually gives a list of base classes (see *Customizing class '
- 'creation*\n'
- 'for more advanced uses), so each item in the list should evaluate '
- 'to a\n'
- 'class object which allows subclassing. Classes without an '
- 'inheritance\n'
- 'list inherit, by default, from the base class "object"; hence,\n'
- '\n'
- ' class Foo:\n'
- ' pass\n'
- '\n'
- 'is equivalent to\n'
- '\n'
- ' class Foo(object):\n'
- ' pass\n'
- '\n'
- "The class's suite is then executed in a new execution frame (see\n"
- '*Naming and binding*), using a newly created local namespace and '
- 'the\n'
- 'original global namespace. (Usually, the suite contains mostly\n'
- "function definitions.) When the class's suite finishes "
- 'execution, its\n'
- 'execution frame is discarded but its local namespace is saved. '
- '[4] A\n'
- 'class object is then created using the inheritance list for the '
- 'base\n'
- 'classes and the saved local namespace for the attribute '
- 'dictionary.\n'
- 'The class name is bound to this class object in the original '
- 'local\n'
- 'namespace.\n'
- '\n'
- 'Class creation can be customized heavily using *metaclasses*.\n'
- '\n'
- 'Classes can also be decorated: just like when decorating '
- 'functions,\n'
- '\n'
- ' @f1(arg)\n'
- ' @f2\n'
- ' class Foo: pass\n'
- '\n'
- 'is equivalent to\n'
- '\n'
- ' class Foo: pass\n'
- ' Foo = f1(arg)(f2(Foo))\n'
- '\n'
- 'The evaluation rules for the decorator expressions are the same '
- 'as for\n'
- 'function decorators. The result must be a class object, which is '
- 'then\n'
- 'bound to the class name.\n'
- '\n'
- "**Programmer's note:** Variables defined in the class definition "
- 'are\n'
- 'class attributes; they are shared by instances. Instance '
- 'attributes\n'
- 'can be set in a method with "self.name = value". Both class and\n'
- 'instance attributes are accessible through the notation '
- '""self.name"",\n'
- 'and an instance attribute hides a class attribute with the same '
- 'name\n'
- 'when accessed in this way. Class attributes can be used as '
- 'defaults\n'
- 'for instance attributes, but using mutable values there can lead '
- 'to\n'
- 'unexpected results. *Descriptors* can be used to create '
- 'instance\n'
- 'variables with different implementation details.\n'
- '\n'
- 'See also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** -\n'
- ' Class Decorators\n',
- 'comparisons': '\n'
- 'Comparisons\n'
- '***********\n'
- '\n'
- 'Unlike C, all comparison operations in Python have the same '
- 'priority,\n'
- 'which is lower than that of any arithmetic, shifting or '
- 'bitwise\n'
- 'operation. Also unlike C, expressions like "a < b < c" '
- 'have the\n'
- 'interpretation that is conventional in mathematics:\n'
- '\n'
- ' comparison ::= or_expr ( comp_operator or_expr )*\n'
- ' comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n'
- ' | "is" ["not"] | ["not"] "in"\n'
- '\n'
- 'Comparisons yield boolean values: "True" or "False".\n'
- '\n'
- 'Comparisons can be chained arbitrarily, e.g., "x < y <= z" '
- 'is\n'
- 'equivalent to "x < y and y <= z", except that "y" is '
- 'evaluated only\n'
- 'once (but in both cases "z" is not evaluated at all when "x '
- '< y" is\n'
- 'found to be false).\n'
- '\n'
- 'Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions '
- 'and *op1*,\n'
- '*op2*, ..., *opN* are comparison operators, then "a op1 b '
- 'op2 c ... y\n'
- 'opN z" is equivalent to "a op1 b and b op2 c and ... y opN '
- 'z", except\n'
- 'that each expression is evaluated at most once.\n'
- '\n'
- 'Note that "a op1 b op2 c" doesn\'t imply any kind of '
- 'comparison between\n'
- '*a* and *c*, so that, e.g., "x < y > z" is perfectly legal '
- '(though\n'
- 'perhaps not pretty).\n'
- '\n'
- 'The operators "<", ">", "==", ">=", "<=", and "!=" compare '
- 'the values\n'
- 'of two objects. The objects need not have the same type. '
- 'If both are\n'
- 'numbers, they are converted to a common type. Otherwise, '
- 'the "==" and\n'
- '"!=" operators *always* consider objects of different types '
- 'to be\n'
- 'unequal, while the "<", ">", ">=" and "<=" operators raise '
- 'a\n'
- '"TypeError" when comparing objects of different types that '
- 'do not\n'
- 'implement these operators for the given pair of types. You '
- 'can\n'
- 'control comparison behavior of objects of non-built-in '
- 'types by\n'
- 'defining rich comparison methods like "__gt__()", described '
- 'in section\n'
- '*Basic customization*.\n'
- '\n'
- 'Comparison of objects of the same type depends on the '
- 'type:\n'
- '\n'
- '* Numbers are compared arithmetically.\n'
- '\n'
- '* The values "float(\'NaN\')" and "Decimal(\'NaN\')" are '
- 'special. They\n'
- ' are identical to themselves, "x is x" but are not equal '
- 'to\n'
- ' themselves, "x != x". Additionally, comparing any value '
- 'to a\n'
- ' not-a-number value will return "False". For example, '
- 'both "3 <\n'
- ' float(\'NaN\')" and "float(\'NaN\') < 3" will return '
- '"False".\n'
- '\n'
- '* Bytes objects are compared lexicographically using the '
- 'numeric\n'
- ' values of their elements.\n'
- '\n'
- '* Strings are compared lexicographically using the numeric\n'
- ' equivalents (the result of the built-in function "ord()") '
- 'of their\n'
- " characters. [3] String and bytes object can't be "
- 'compared!\n'
- '\n'
- '* Tuples and lists are compared lexicographically using '
- 'comparison\n'
- ' of corresponding elements. This means that to compare '
- 'equal, each\n'
- ' element must compare equal and the two sequences must be '
- 'of the same\n'
- ' type and have the same length.\n'
- '\n'
- ' If not equal, the sequences are ordered the same as their '
- 'first\n'
- ' differing elements. For example, "[1,2,x] <= [1,2,y]" '
- 'has the same\n'
- ' value as "x <= y". If the corresponding element does not '
- 'exist, the\n'
- ' shorter sequence is ordered first (for example, "[1,2] < '
- '[1,2,3]").\n'
- '\n'
- '* Mappings (dictionaries) compare equal if and only if they '
- 'have the\n'
- ' same "(key, value)" pairs. Order comparisons "(\'<\', '
- "'<=', '>=',\n"
- ' \'>\')" raise "TypeError".\n'
- '\n'
- '* Sets and frozensets define comparison operators to mean '
- 'subset and\n'
- ' superset tests. Those relations do not define total '
- 'orderings (the\n'
- ' two sets "{1,2}" and "{2,3}" are not equal, nor subsets '
- 'of one\n'
- ' another, nor supersets of one another). Accordingly, '
- 'sets are not\n'
- ' appropriate arguments for functions which depend on total '
- 'ordering.\n'
- ' For example, "min()", "max()", and "sorted()" produce '
- 'undefined\n'
- ' results given a list of sets as inputs.\n'
- '\n'
- '* Most other objects of built-in types compare unequal '
- 'unless they\n'
- ' are the same object; the choice whether one object is '
- 'considered\n'
- ' smaller or larger than another one is made arbitrarily '
- 'but\n'
- ' consistently within one execution of a program.\n'
- '\n'
- 'Comparison of objects of differing types depends on whether '
- 'either of\n'
- 'the types provide explicit support for the comparison. '
- 'Most numeric\n'
- 'types can be compared with one another. When cross-type '
- 'comparison is\n'
- 'not supported, the comparison method returns '
- '"NotImplemented".\n'
- '\n'
- 'The operators "in" and "not in" test for membership. "x in '
- 's"\n'
- 'evaluates to true if *x* is a member of *s*, and false '
- 'otherwise. "x\n'
- 'not in s" returns the negation of "x in s". All built-in '
- 'sequences\n'
- 'and set types support this as well as dictionary, for which '
- '"in" tests\n'
- 'whether the dictionary has a given key. For container types '
- 'such as\n'
- 'list, tuple, set, frozenset, dict, or collections.deque, '
- 'the\n'
- 'expression "x in y" is equivalent to "any(x is e or x == e '
- 'for e in\n'
- 'y)".\n'
- '\n'
- 'For the string and bytes types, "x in y" is true if and '
- 'only if *x* is\n'
- 'a substring of *y*. An equivalent test is "y.find(x) != '
- '-1". Empty\n'
- 'strings are always considered to be a substring of any '
- 'other string,\n'
- 'so """ in "abc"" will return "True".\n'
- '\n'
- 'For user-defined classes which define the "__contains__()" '
- 'method, "x\n'
- 'in y" is true if and only if "y.__contains__(x)" is true.\n'
- '\n'
- 'For user-defined classes which do not define '
- '"__contains__()" but do\n'
- 'define "__iter__()", "x in y" is true if some value "z" '
- 'with "x == z"\n'
- 'is produced while iterating over "y". If an exception is '
- 'raised\n'
- 'during the iteration, it is as if "in" raised that '
- 'exception.\n'
- '\n'
- 'Lastly, the old-style iteration protocol is tried: if a '
- 'class defines\n'
- '"__getitem__()", "x in y" is true if and only if there is a '
- 'non-\n'
- 'negative integer index *i* such that "x == y[i]", and all '
- 'lower\n'
- 'integer indices do not raise "IndexError" exception. (If '
- 'any other\n'
- 'exception is raised, it is as if "in" raised that '
- 'exception).\n'
- '\n'
- 'The operator "not in" is defined to have the inverse true '
- 'value of\n'
- '"in".\n'
- '\n'
- 'The operators "is" and "is not" test for object identity: '
- '"x is y" is\n'
- 'true if and only if *x* and *y* are the same object. "x is '
- 'not y"\n'
- 'yields the inverse truth value. [4]\n',
- 'compound': '\n'
- 'Compound statements\n'
- '*******************\n'
- '\n'
- 'Compound statements contain (groups of) other statements; they '
- 'affect\n'
- 'or control the execution of those other statements in some '
- 'way. In\n'
- 'general, compound statements span multiple lines, although in '
- 'simple\n'
- 'incarnations a whole compound statement may be contained in '
- 'one line.\n'
- '\n'
- 'The "if", "while" and "for" statements implement traditional '
- 'control\n'
- 'flow constructs. "try" specifies exception handlers and/or '
- 'cleanup\n'
- 'code for a group of statements, while the "with" statement '
- 'allows the\n'
- 'execution of initialization and finalization code around a '
- 'block of\n'
- 'code. Function and class definitions are also syntactically '
- 'compound\n'
- 'statements.\n'
- '\n'
- "A compound statement consists of one or more 'clauses.' A "
- 'clause\n'
- "consists of a header and a 'suite.' The clause headers of a\n"
- 'particular compound statement are all at the same indentation '
- 'level.\n'
- 'Each clause header begins with a uniquely identifying keyword '
- 'and ends\n'
- 'with a colon. A suite is a group of statements controlled by '
- 'a\n'
- 'clause. A suite can be one or more semicolon-separated '
- 'simple\n'
- 'statements on the same line as the header, following the '
- "header's\n"
- 'colon, or it can be one or more indented statements on '
- 'subsequent\n'
- 'lines. Only the latter form of a suite can contain nested '
- 'compound\n'
- 'statements; the following is illegal, mostly because it '
- "wouldn't be\n"
- 'clear to which "if" clause a following "else" clause would '
- 'belong:\n'
- '\n'
- ' if test1: if test2: print(x)\n'
- '\n'
- 'Also note that the semicolon binds tighter than the colon in '
- 'this\n'
- 'context, so that in the following example, either all or none '
- 'of the\n'
- '"print()" calls are executed:\n'
- '\n'
- ' if x < y < z: print(x); print(y); print(z)\n'
- '\n'
- 'Summarizing:\n'
- '\n'
- ' compound_stmt ::= if_stmt\n'
- ' | while_stmt\n'
- ' | for_stmt\n'
- ' | try_stmt\n'
- ' | with_stmt\n'
- ' | funcdef\n'
- ' | classdef\n'
- ' | async_with_stmt\n'
- ' | async_for_stmt\n'
- ' | async_funcdef\n'
- ' suite ::= stmt_list NEWLINE | NEWLINE INDENT '
- 'statement+ DEDENT\n'
- ' statement ::= stmt_list NEWLINE | compound_stmt\n'
- ' stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n'
- '\n'
- 'Note that statements always end in a "NEWLINE" possibly '
- 'followed by a\n'
- '"DEDENT". Also note that optional continuation clauses always '
- 'begin\n'
- 'with a keyword that cannot start a statement, thus there are '
- 'no\n'
- 'ambiguities (the \'dangling "else"\' problem is solved in '
- 'Python by\n'
- 'requiring nested "if" statements to be indented).\n'
- '\n'
- 'The formatting of the grammar rules in the following sections '
- 'places\n'
- 'each clause on a separate line for clarity.\n'
- '\n'
- '\n'
- 'The "if" statement\n'
- '==================\n'
- '\n'
- 'The "if" statement is used for conditional execution:\n'
- '\n'
- ' if_stmt ::= "if" expression ":" suite\n'
- ' ( "elif" expression ":" suite )*\n'
- ' ["else" ":" suite]\n'
- '\n'
- 'It selects exactly one of the suites by evaluating the '
- 'expressions one\n'
- 'by one until one is found to be true (see section *Boolean '
- 'operations*\n'
- 'for the definition of true and false); then that suite is '
- 'executed\n'
- '(and no other part of the "if" statement is executed or '
- 'evaluated).\n'
- 'If all expressions are false, the suite of the "else" clause, '
- 'if\n'
- 'present, is executed.\n'
- '\n'
- '\n'
- 'The "while" statement\n'
- '=====================\n'
- '\n'
- 'The "while" statement is used for repeated execution as long '
- 'as an\n'
- 'expression is true:\n'
- '\n'
- ' while_stmt ::= "while" expression ":" suite\n'
- ' ["else" ":" suite]\n'
- '\n'
- 'This repeatedly tests the expression and, if it is true, '
- 'executes the\n'
- 'first suite; if the expression is false (which may be the '
- 'first time\n'
- 'it is tested) the suite of the "else" clause, if present, is '
- 'executed\n'
- 'and the loop terminates.\n'
- '\n'
- 'A "break" statement executed in the first suite terminates the '
- 'loop\n'
- 'without executing the "else" clause\'s suite. A "continue" '
- 'statement\n'
- 'executed in the first suite skips the rest of the suite and '
- 'goes back\n'
- 'to testing the expression.\n'
- '\n'
- '\n'
- 'The "for" statement\n'
- '===================\n'
- '\n'
- 'The "for" statement is used to iterate over the elements of a '
- 'sequence\n'
- '(such as a string, tuple or list) or other iterable object:\n'
- '\n'
- ' for_stmt ::= "for" target_list "in" expression_list ":" '
- 'suite\n'
- ' ["else" ":" suite]\n'
- '\n'
- 'The expression list is evaluated once; it should yield an '
- 'iterable\n'
- 'object. An iterator is created for the result of the\n'
- '"expression_list". The suite is then executed once for each '
- 'item\n'
- 'provided by the iterator, in the order returned by the '
- 'iterator. Each\n'
- 'item in turn is assigned to the target list using the standard '
- 'rules\n'
- 'for assignments (see *Assignment statements*), and then the '
- 'suite is\n'
- 'executed. When the items are exhausted (which is immediately '
- 'when the\n'
- 'sequence is empty or an iterator raises a "StopIteration" '
- 'exception),\n'
- 'the suite in the "else" clause, if present, is executed, and '
- 'the loop\n'
- 'terminates.\n'
- '\n'
- 'A "break" statement executed in the first suite terminates the '
- 'loop\n'
- 'without executing the "else" clause\'s suite. A "continue" '
- 'statement\n'
- 'executed in the first suite skips the rest of the suite and '
- 'continues\n'
- 'with the next item, or with the "else" clause if there is no '
- 'next\n'
- 'item.\n'
- '\n'
- 'The for-loop makes assignments to the variables(s) in the '
- 'target list.\n'
- 'This overwrites all previous assignments to those variables '
- 'including\n'
- 'those made in the suite of the for-loop:\n'
- '\n'
- ' for i in range(10):\n'
- ' print(i)\n'
- ' i = 5 # this will not affect the for-loop\n'
- ' # because i will be overwritten with '
- 'the next\n'
- ' # index in the range\n'
- '\n'
- 'Names in the target list are not deleted when the loop is '
- 'finished,\n'
- 'but if the sequence is empty, they will not have been assigned '
- 'to at\n'
- 'all by the loop. Hint: the built-in function "range()" '
- 'returns an\n'
- 'iterator of integers suitable to emulate the effect of '
- 'Pascal\'s "for i\n'
- ':= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, '
- '2]".\n'
- '\n'
- 'Note: There is a subtlety when the sequence is being modified '
- 'by the\n'
- ' loop (this can only occur for mutable sequences, i.e. '
- 'lists). An\n'
- ' internal counter is used to keep track of which item is used '
- 'next,\n'
- ' and this is incremented on each iteration. When this '
- 'counter has\n'
- ' reached the length of the sequence the loop terminates. '
- 'This means\n'
- ' that if the suite deletes the current (or a previous) item '
- 'from the\n'
- ' sequence, the next item will be skipped (since it gets the '
- 'index of\n'
- ' the current item which has already been treated). Likewise, '
- 'if the\n'
- ' suite inserts an item in the sequence before the current '
- 'item, the\n'
- ' current item will be treated again the next time through the '
- 'loop.\n'
- ' This can lead to nasty bugs that can be avoided by making a\n'
- ' temporary copy using a slice of the whole sequence, e.g.,\n'
- '\n'
- ' for x in a[:]:\n'
- ' if x < 0: a.remove(x)\n'
- '\n'
- '\n'
- 'The "try" statement\n'
- '===================\n'
- '\n'
- 'The "try" statement specifies exception handlers and/or '
- 'cleanup code\n'
- 'for a group of statements:\n'
- '\n'
- ' try_stmt ::= try1_stmt | try2_stmt\n'
- ' try1_stmt ::= "try" ":" suite\n'
- ' ("except" [expression ["as" identifier]] ":" '
- 'suite)+\n'
- ' ["else" ":" suite]\n'
- ' ["finally" ":" suite]\n'
- ' try2_stmt ::= "try" ":" suite\n'
- ' "finally" ":" suite\n'
- '\n'
- 'The "except" clause(s) specify one or more exception handlers. '
- 'When no\n'
- 'exception occurs in the "try" clause, no exception handler is\n'
- 'executed. When an exception occurs in the "try" suite, a '
- 'search for an\n'
- 'exception handler is started. This search inspects the except '
- 'clauses\n'
- 'in turn until one is found that matches the exception. An '
- 'expression-\n'
- 'less except clause, if present, must be last; it matches any\n'
- 'exception. For an except clause with an expression, that '
- 'expression\n'
- 'is evaluated, and the clause matches the exception if the '
- 'resulting\n'
- 'object is "compatible" with the exception. An object is '
- 'compatible\n'
- 'with an exception if it is the class or a base class of the '
- 'exception\n'
- 'object or a tuple containing an item compatible with the '
- 'exception.\n'
- '\n'
- 'If no except clause matches the exception, the search for an '
- 'exception\n'
- 'handler continues in the surrounding code and on the '
- 'invocation stack.\n'
- '[1]\n'
- '\n'
- 'If the evaluation of an expression in the header of an except '
- 'clause\n'
- 'raises an exception, the original search for a handler is '
- 'canceled and\n'
- 'a search starts for the new exception in the surrounding code '
- 'and on\n'
- 'the call stack (it is treated as if the entire "try" statement '
- 'raised\n'
- 'the exception).\n'
- '\n'
- 'When a matching except clause is found, the exception is '
- 'assigned to\n'
- 'the target specified after the "as" keyword in that except '
- 'clause, if\n'
- "present, and the except clause's suite is executed. All "
- 'except\n'
- 'clauses must have an executable block. When the end of this '
- 'block is\n'
- 'reached, execution continues normally after the entire try '
- 'statement.\n'
- '(This means that if two nested handlers exist for the same '
- 'exception,\n'
- 'and the exception occurs in the try clause of the inner '
- 'handler, the\n'
- 'outer handler will not handle the exception.)\n'
- '\n'
- 'When an exception has been assigned using "as target", it is '
- 'cleared\n'
- 'at the end of the except clause. This is as if\n'
- '\n'
- ' except E as N:\n'
- ' foo\n'
- '\n'
- 'was translated to\n'
- '\n'
- ' except E as N:\n'
- ' try:\n'
- ' foo\n'
- ' finally:\n'
- ' del N\n'
- '\n'
- 'This means the exception must be assigned to a different name '
- 'to be\n'
- 'able to refer to it after the except clause. Exceptions are '
- 'cleared\n'
- 'because with the traceback attached to them, they form a '
- 'reference\n'
- 'cycle with the stack frame, keeping all locals in that frame '
- 'alive\n'
- 'until the next garbage collection occurs.\n'
- '\n'
- "Before an except clause's suite is executed, details about "
- 'the\n'
- 'exception are stored in the "sys" module and can be accessed '
- 'via\n'
- '"sys.exc_info()". "sys.exc_info()" returns a 3-tuple '
- 'consisting of the\n'
- 'exception class, the exception instance and a traceback object '
- '(see\n'
- 'section *The standard type hierarchy*) identifying the point '
- 'in the\n'
- 'program where the exception occurred. "sys.exc_info()" values '
- 'are\n'
- 'restored to their previous values (before the call) when '
- 'returning\n'
- 'from a function that handled an exception.\n'
- '\n'
- 'The optional "else" clause is executed if and when control '
- 'flows off\n'
- 'the end of the "try" clause. [2] Exceptions in the "else" '
- 'clause are\n'
- 'not handled by the preceding "except" clauses.\n'
- '\n'
- 'If "finally" is present, it specifies a \'cleanup\' handler. '
- 'The "try"\n'
- 'clause is executed, including any "except" and "else" '
- 'clauses. If an\n'
- 'exception occurs in any of the clauses and is not handled, '
- 'the\n'
- 'exception is temporarily saved. The "finally" clause is '
- 'executed. If\n'
- 'there is a saved exception it is re-raised at the end of the '
- '"finally"\n'
- 'clause. If the "finally" clause raises another exception, the '
- 'saved\n'
- 'exception is set as the context of the new exception. If the '
- '"finally"\n'
- 'clause executes a "return" or "break" statement, the saved '
- 'exception\n'
- 'is discarded:\n'
- '\n'
- ' >>> def f():\n'
- ' ... try:\n'
- ' ... 1/0\n'
- ' ... finally:\n'
- ' ... return 42\n'
- ' ...\n'
- ' >>> f()\n'
- ' 42\n'
- '\n'
- 'The exception information is not available to the program '
- 'during\n'
- 'execution of the "finally" clause.\n'
- '\n'
- 'When a "return", "break" or "continue" statement is executed '
- 'in the\n'
- '"try" suite of a "try"..."finally" statement, the "finally" '
- 'clause is\n'
- 'also executed \'on the way out.\' A "continue" statement is '
- 'illegal in\n'
- 'the "finally" clause. (The reason is a problem with the '
- 'current\n'
- 'implementation --- this restriction may be lifted in the '
- 'future).\n'
- '\n'
- 'The return value of a function is determined by the last '
- '"return"\n'
- 'statement executed. Since the "finally" clause always '
- 'executes, a\n'
- '"return" statement executed in the "finally" clause will '
- 'always be the\n'
- 'last one executed:\n'
- '\n'
- ' >>> def foo():\n'
- ' ... try:\n'
- " ... return 'try'\n"
- ' ... finally:\n'
- " ... return 'finally'\n"
- ' ...\n'
- ' >>> foo()\n'
- " 'finally'\n"
- '\n'
- 'Additional information on exceptions can be found in section\n'
- '*Exceptions*, and information on using the "raise" statement '
- 'to\n'
- 'generate exceptions may be found in section *The raise '
- 'statement*.\n'
- '\n'
- '\n'
- 'The "with" statement\n'
- '====================\n'
- '\n'
- 'The "with" statement is used to wrap the execution of a block '
- 'with\n'
- 'methods defined by a context manager (see section *With '
- 'Statement\n'
- 'Context Managers*). This allows common '
- '"try"..."except"..."finally"\n'
- 'usage patterns to be encapsulated for convenient reuse.\n'
- '\n'
- ' with_stmt ::= "with" with_item ("," with_item)* ":" suite\n'
- ' with_item ::= expression ["as" target]\n'
- '\n'
- 'The execution of the "with" statement with one "item" proceeds '
- 'as\n'
- 'follows:\n'
- '\n'
- '1. The context expression (the expression given in the '
- '"with_item")\n'
- ' is evaluated to obtain a context manager.\n'
- '\n'
- '2. The context manager\'s "__exit__()" is loaded for later '
- 'use.\n'
- '\n'
- '3. The context manager\'s "__enter__()" method is invoked.\n'
- '\n'
- '4. If a target was included in the "with" statement, the '
- 'return\n'
- ' value from "__enter__()" is assigned to it.\n'
- '\n'
- ' Note: The "with" statement guarantees that if the '
- '"__enter__()"\n'
- ' method returns without an error, then "__exit__()" will '
- 'always be\n'
- ' called. Thus, if an error occurs during the assignment to '
- 'the\n'
- ' target list, it will be treated the same as an error '
- 'occurring\n'
- ' within the suite would be. See step 6 below.\n'
- '\n'
- '5. The suite is executed.\n'
- '\n'
- '6. The context manager\'s "__exit__()" method is invoked. If '
- 'an\n'
- ' exception caused the suite to be exited, its type, value, '
- 'and\n'
- ' traceback are passed as arguments to "__exit__()". '
- 'Otherwise, three\n'
- ' "None" arguments are supplied.\n'
- '\n'
- ' If the suite was exited due to an exception, and the return '
- 'value\n'
- ' from the "__exit__()" method was false, the exception is '
- 'reraised.\n'
- ' If the return value was true, the exception is suppressed, '
- 'and\n'
- ' execution continues with the statement following the '
- '"with"\n'
- ' statement.\n'
- '\n'
- ' If the suite was exited for any reason other than an '
- 'exception, the\n'
- ' return value from "__exit__()" is ignored, and execution '
- 'proceeds\n'
- ' at the normal location for the kind of exit that was '
- 'taken.\n'
- '\n'
- 'With more than one item, the context managers are processed as '
- 'if\n'
- 'multiple "with" statements were nested:\n'
- '\n'
- ' with A() as a, B() as b:\n'
- ' suite\n'
- '\n'
- 'is equivalent to\n'
- '\n'
- ' with A() as a:\n'
- ' with B() as b:\n'
- ' suite\n'
- '\n'
- 'Changed in version 3.1: Support for multiple context '
- 'expressions.\n'
- '\n'
- 'See also: **PEP 0343** - The "with" statement\n'
- '\n'
- ' The specification, background, and examples for the '
- 'Python "with"\n'
- ' statement.\n'
- '\n'
- '\n'
- 'Function definitions\n'
- '====================\n'
- '\n'
- 'A function definition defines a user-defined function object '
- '(see\n'
- 'section *The standard type hierarchy*):\n'
- '\n'
- ' funcdef ::= [decorators] "def" funcname "(" '
- '[parameter_list] ")" ["->" expression] ":" suite\n'
- ' decorators ::= decorator+\n'
- ' decorator ::= "@" dotted_name ["(" [parameter_list '
- '[","]] ")"] NEWLINE\n'
- ' dotted_name ::= identifier ("." identifier)*\n'
- ' parameter_list ::= (defparameter ",")*\n'
- ' | "*" [parameter] ("," defparameter)* '
- '["," "**" parameter]\n'
- ' | "**" parameter\n'
- ' | defparameter [","] )\n'
- ' parameter ::= identifier [":" expression]\n'
- ' defparameter ::= parameter ["=" expression]\n'
- ' funcname ::= identifier\n'
- '\n'
- 'A function definition is an executable statement. Its '
- 'execution binds\n'
- 'the function name in the current local namespace to a function '
- 'object\n'
- '(a wrapper around the executable code for the function). '
- 'This\n'
- 'function object contains a reference to the current global '
- 'namespace\n'
- 'as the global namespace to be used when the function is '
- 'called.\n'
- '\n'
- 'The function definition does not execute the function body; '
- 'this gets\n'
- 'executed only when the function is called. [3]\n'
- '\n'
- 'A function definition may be wrapped by one or more '
- '*decorator*\n'
- 'expressions. Decorator expressions are evaluated when the '
- 'function is\n'
- 'defined, in the scope that contains the function definition. '
- 'The\n'
- 'result must be a callable, which is invoked with the function '
- 'object\n'
- 'as the only argument. The returned value is bound to the '
- 'function name\n'
- 'instead of the function object. Multiple decorators are '
- 'applied in\n'
- 'nested fashion. For example, the following code\n'
- '\n'
- ' @f1(arg)\n'
- ' @f2\n'
- ' def func(): pass\n'
- '\n'
- 'is equivalent to\n'
- '\n'
- ' def func(): pass\n'
- ' func = f1(arg)(f2(func))\n'
- '\n'
- 'When one or more *parameters* have the form *parameter* "="\n'
- '*expression*, the function is said to have "default parameter '
- 'values."\n'
- 'For a parameter with a default value, the corresponding '
- '*argument* may\n'
- "be omitted from a call, in which case the parameter's default "
- 'value is\n'
- 'substituted. If a parameter has a default value, all '
- 'following\n'
- 'parameters up until the ""*"" must also have a default value '
- '--- this\n'
- 'is a syntactic restriction that is not expressed by the '
- 'grammar.\n'
- '\n'
- '**Default parameter values are evaluated from left to right '
- 'when the\n'
- 'function definition is executed.** This means that the '
- 'expression is\n'
- 'evaluated once, when the function is defined, and that the '
- 'same "pre-\n'
- 'computed" value is used for each call. This is especially '
- 'important\n'
- 'to understand when a default parameter is a mutable object, '
- 'such as a\n'
- 'list or a dictionary: if the function modifies the object '
- '(e.g. by\n'
- 'appending an item to a list), the default value is in effect '
- 'modified.\n'
- 'This is generally not what was intended. A way around this is '
- 'to use\n'
- '"None" as the default, and explicitly test for it in the body '
- 'of the\n'
- 'function, e.g.:\n'
- '\n'
- ' def whats_on_the_telly(penguin=None):\n'
- ' if penguin is None:\n'
- ' penguin = []\n'
- ' penguin.append("property of the zoo")\n'
- ' return penguin\n'
- '\n'
- 'Function call semantics are described in more detail in '
- 'section\n'
- '*Calls*. A function call always assigns values to all '
- 'parameters\n'
- 'mentioned in the parameter list, either from position '
- 'arguments, from\n'
- 'keyword arguments, or from default values. If the form\n'
- '""*identifier"" is present, it is initialized to a tuple '
- 'receiving any\n'
- 'excess positional parameters, defaulting to the empty tuple. '
- 'If the\n'
- 'form ""**identifier"" is present, it is initialized to a new\n'
- 'dictionary receiving any excess keyword arguments, defaulting '
- 'to a new\n'
- 'empty dictionary. Parameters after ""*"" or ""*identifier"" '
- 'are\n'
- 'keyword-only parameters and may only be passed used keyword '
- 'arguments.\n'
- '\n'
- 'Parameters may have annotations of the form "": expression"" '
- 'following\n'
- 'the parameter name. Any parameter may have an annotation even '
- 'those\n'
- 'of the form "*identifier" or "**identifier". Functions may '
- 'have\n'
- '"return" annotation of the form ""-> expression"" after the '
- 'parameter\n'
- 'list. These annotations can be any valid Python expression '
- 'and are\n'
- 'evaluated when the function definition is executed. '
- 'Annotations may\n'
- 'be evaluated in a different order than they appear in the '
- 'source code.\n'
- 'The presence of annotations does not change the semantics of '
- 'a\n'
- 'function. The annotation values are available as values of a\n'
- "dictionary keyed by the parameters' names in the "
- '"__annotations__"\n'
- 'attribute of the function object.\n'
- '\n'
- 'It is also possible to create anonymous functions (functions '
- 'not bound\n'
- 'to a name), for immediate use in expressions. This uses '
- 'lambda\n'
- 'expressions, described in section *Lambdas*. Note that the '
- 'lambda\n'
- 'expression is merely a shorthand for a simplified function '
- 'definition;\n'
- 'a function defined in a ""def"" statement can be passed around '
- 'or\n'
- 'assigned to another name just like a function defined by a '
- 'lambda\n'
- 'expression. The ""def"" form is actually more powerful since '
- 'it\n'
- 'allows the execution of multiple statements and annotations.\n'
- '\n'
- "**Programmer's note:** Functions are first-class objects. A "
- '""def""\n'
- 'statement executed inside a function definition defines a '
- 'local\n'
- 'function that can be returned or passed around. Free '
- 'variables used\n'
- 'in the nested function can access the local variables of the '
- 'function\n'
- 'containing the def. See section *Naming and binding* for '
- 'details.\n'
- '\n'
- 'See also: **PEP 3107** - Function Annotations\n'
- '\n'
- ' The original specification for function annotations.\n'
- '\n'
- '\n'
- 'Class definitions\n'
- '=================\n'
- '\n'
- 'A class definition defines a class object (see section *The '
- 'standard\n'
- 'type hierarchy*):\n'
- '\n'
- ' classdef ::= [decorators] "class" classname '
- '[inheritance] ":" suite\n'
- ' inheritance ::= "(" [parameter_list] ")"\n'
- ' classname ::= identifier\n'
- '\n'
- 'A class definition is an executable statement. The '
- 'inheritance list\n'
- 'usually gives a list of base classes (see *Customizing class '
- 'creation*\n'
- 'for more advanced uses), so each item in the list should '
- 'evaluate to a\n'
- 'class object which allows subclassing. Classes without an '
- 'inheritance\n'
- 'list inherit, by default, from the base class "object"; '
- 'hence,\n'
- '\n'
- ' class Foo:\n'
- ' pass\n'
- '\n'
- 'is equivalent to\n'
- '\n'
- ' class Foo(object):\n'
- ' pass\n'
- '\n'
- "The class's suite is then executed in a new execution frame "
- '(see\n'
- '*Naming and binding*), using a newly created local namespace '
- 'and the\n'
- 'original global namespace. (Usually, the suite contains '
- 'mostly\n'
- "function definitions.) When the class's suite finishes "
- 'execution, its\n'
- 'execution frame is discarded but its local namespace is saved. '
- '[4] A\n'
- 'class object is then created using the inheritance list for '
- 'the base\n'
- 'classes and the saved local namespace for the attribute '
- 'dictionary.\n'
- 'The class name is bound to this class object in the original '
- 'local\n'
- 'namespace.\n'
- '\n'
- 'Class creation can be customized heavily using *metaclasses*.\n'
- '\n'
- 'Classes can also be decorated: just like when decorating '
- 'functions,\n'
- '\n'
- ' @f1(arg)\n'
- ' @f2\n'
- ' class Foo: pass\n'
- '\n'
- 'is equivalent to\n'
- '\n'
- ' class Foo: pass\n'
- ' Foo = f1(arg)(f2(Foo))\n'
- '\n'
- 'The evaluation rules for the decorator expressions are the '
- 'same as for\n'
- 'function decorators. The result must be a class object, which '
- 'is then\n'
- 'bound to the class name.\n'
- '\n'
- "**Programmer's note:** Variables defined in the class "
- 'definition are\n'
- 'class attributes; they are shared by instances. Instance '
- 'attributes\n'
- 'can be set in a method with "self.name = value". Both class '
- 'and\n'
- 'instance attributes are accessible through the notation '
- '""self.name"",\n'
- 'and an instance attribute hides a class attribute with the '
- 'same name\n'
- 'when accessed in this way. Class attributes can be used as '
- 'defaults\n'
- 'for instance attributes, but using mutable values there can '
- 'lead to\n'
- 'unexpected results. *Descriptors* can be used to create '
- 'instance\n'
- 'variables with different implementation details.\n'
- '\n'
- 'See also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** '
- '-\n'
- ' Class Decorators\n'
- '\n'
- '\n'
- 'Coroutines\n'
- '==========\n'
- '\n'
- 'New in version 3.5.\n'
- '\n'
- '\n'
- 'Coroutine function definition\n'
- '-----------------------------\n'
- '\n'
- ' async_funcdef ::= [decorators] "async" "def" funcname "(" '
- '[parameter_list] ")" ["->" expression] ":" suite\n'
- '\n'
- 'Execution of Python coroutines can be suspended and resumed at '
- 'many\n'
- 'points (see *coroutine*). In the body of a coroutine, any '
- '"await" and\n'
- '"async" identifiers become reserved keywords; "await" '
- 'expressions,\n'
- '"async for" and "async with" can only be used in coroutine '
- 'bodies.\n'
- '\n'
- 'Functions defined with "async def" syntax are always '
- 'coroutine\n'
- 'functions, even if they do not contain "await" or "async" '
- 'keywords.\n'
- '\n'
- 'It is a "SyntaxError" to use "yield" expressions in "async '
- 'def"\n'
- 'coroutines.\n'
- '\n'
- 'An example of a coroutine function:\n'
- '\n'
- ' async def func(param1, param2):\n'
- ' do_stuff()\n'
- ' await some_coroutine()\n'
- '\n'
- '\n'
- 'The "async for" statement\n'
- '-------------------------\n'
- '\n'
- ' async_for_stmt ::= "async" for_stmt\n'
- '\n'
- 'An *asynchronous iterable* is able to call asynchronous code '
- 'in its\n'
- '*iter* implementation, and *asynchronous iterator* can call\n'
- 'asynchronous code in its *next* method.\n'
- '\n'
- 'The "async for" statement allows convenient iteration over\n'
- 'asynchronous iterators.\n'
- '\n'
- 'The following code:\n'
- '\n'
- ' async for TARGET in ITER:\n'
- ' BLOCK\n'
- ' else:\n'
- ' BLOCK2\n'
- '\n'
- 'Is semantically equivalent to:\n'
- '\n'
- ' iter = (ITER)\n'
- ' iter = await type(iter).__aiter__(iter)\n'
- ' running = True\n'
- ' while running:\n'
- ' try:\n'
- ' TARGET = await type(iter).__anext__(iter)\n'
- ' except StopAsyncIteration:\n'
- ' running = False\n'
- ' else:\n'
- ' BLOCK\n'
- ' else:\n'
- ' BLOCK2\n'
- '\n'
- 'See also "__aiter__()" and "__anext__()" for details.\n'
- '\n'
- 'It is a "SyntaxError" to use "async for" statement outside of '
- 'an\n'
- '"async def" function.\n'
- '\n'
- '\n'
- 'The "async with" statement\n'
- '--------------------------\n'
- '\n'
- ' async_with_stmt ::= "async" with_stmt\n'
- '\n'
- 'An *asynchronous context manager* is a *context manager* that '
- 'is able\n'
- 'to suspend execution in its *enter* and *exit* methods.\n'
- '\n'
- 'The following code:\n'
- '\n'
- ' async with EXPR as VAR:\n'
- ' BLOCK\n'
- '\n'
- 'Is semantically equivalent to:\n'
- '\n'
- ' mgr = (EXPR)\n'
- ' aexit = type(mgr).__aexit__\n'
- ' aenter = type(mgr).__aenter__(mgr)\n'
- ' exc = True\n'
- '\n'
- ' VAR = await aenter\n'
- ' try:\n'
- ' BLOCK\n'
- ' except:\n'
- ' if not await aexit(mgr, *sys.exc_info()):\n'
- ' raise\n'
- ' else:\n'
- ' await aexit(mgr, None, None, None)\n'
- '\n'
- 'See also "__aenter__()" and "__aexit__()" for details.\n'
- '\n'
- 'It is a "SyntaxError" to use "async with" statement outside of '
- 'an\n'
- '"async def" function.\n'
- '\n'
- 'See also: **PEP 492** - Coroutines with async and await '
- 'syntax\n'
- '\n'
- '-[ Footnotes ]-\n'
- '\n'
- '[1] The exception is propagated to the invocation stack '
- 'unless\n'
- ' there is a "finally" clause which happens to raise '
- 'another\n'
- ' exception. That new exception causes the old one to be '
- 'lost.\n'
- '\n'
- '[2] Currently, control "flows off the end" except in the case '
- 'of\n'
- ' an exception or the execution of a "return", "continue", '
- 'or\n'
- ' "break" statement.\n'
- '\n'
- '[3] A string literal appearing as the first statement in the\n'
- " function body is transformed into the function's "
- '"__doc__"\n'
- " attribute and therefore the function's *docstring*.\n"
- '\n'
- '[4] A string literal appearing as the first statement in the '
- 'class\n'
- ' body is transformed into the namespace\'s "__doc__" item '
- 'and\n'
- " therefore the class's *docstring*.\n",
- 'context-managers': '\n'
- 'With Statement Context Managers\n'
- '*******************************\n'
- '\n'
- 'A *context manager* is an object that defines the '
- 'runtime context to\n'
- 'be established when executing a "with" statement. The '
- 'context manager\n'
- 'handles the entry into, and the exit from, the desired '
- 'runtime context\n'
- 'for the execution of the block of code. Context '
- 'managers are normally\n'
- 'invoked using the "with" statement (described in '
- 'section *The with\n'
- 'statement*), but can also be used by directly invoking '
- 'their methods.\n'
- '\n'
- 'Typical uses of context managers include saving and '
- 'restoring various\n'
- 'kinds of global state, locking and unlocking '
- 'resources, closing opened\n'
- 'files, etc.\n'
- '\n'
- 'For more information on context managers, see *Context '
- 'Manager Types*.\n'
- '\n'
- 'object.__enter__(self)\n'
- '\n'
- ' Enter the runtime context related to this object. '
- 'The "with"\n'
- " statement will bind this method's return value to "
- 'the target(s)\n'
- ' specified in the "as" clause of the statement, if '
- 'any.\n'
- '\n'
- 'object.__exit__(self, exc_type, exc_value, traceback)\n'
- '\n'
- ' Exit the runtime context related to this object. '
- 'The parameters\n'
- ' describe the exception that caused the context to '
- 'be exited. If the\n'
- ' context was exited without an exception, all three '
- 'arguments will\n'
- ' be "None".\n'
- '\n'
- ' If an exception is supplied, and the method wishes '
- 'to suppress the\n'
- ' exception (i.e., prevent it from being propagated), '
- 'it should\n'
- ' return a true value. Otherwise, the exception will '
- 'be processed\n'
- ' normally upon exit from this method.\n'
- '\n'
- ' Note that "__exit__()" methods should not reraise '
- 'the passed-in\n'
- " exception; this is the caller's responsibility.\n"
- '\n'
- 'See also: **PEP 0343** - The "with" statement\n'
- '\n'
- ' The specification, background, and examples for '
- 'the Python "with"\n'
- ' statement.\n',
- 'continue': '\n'
- 'The "continue" statement\n'
- '************************\n'
- '\n'
- ' continue_stmt ::= "continue"\n'
- '\n'
- '"continue" may only occur syntactically nested in a "for" or '
- '"while"\n'
- 'loop, but not nested in a function or class definition or '
- '"finally"\n'
- 'clause within that loop. It continues with the next cycle of '
- 'the\n'
- 'nearest enclosing loop.\n'
- '\n'
- 'When "continue" passes control out of a "try" statement with '
- 'a\n'
- '"finally" clause, that "finally" clause is executed before '
- 'really\n'
- 'starting the next loop cycle.\n',
- 'conversions': '\n'
- 'Arithmetic conversions\n'
- '**********************\n'
- '\n'
- 'When a description of an arithmetic operator below uses the '
- 'phrase\n'
- '"the numeric arguments are converted to a common type," '
- 'this means\n'
- 'that the operator implementation for built-in types works '
- 'as follows:\n'
- '\n'
- '* If either argument is a complex number, the other is '
- 'converted to\n'
- ' complex;\n'
- '\n'
- '* otherwise, if either argument is a floating point number, '
- 'the\n'
- ' other is converted to floating point;\n'
- '\n'
- '* otherwise, both must be integers and no conversion is '
- 'necessary.\n'
- '\n'
- 'Some additional rules apply for certain operators (e.g., a '
- 'string as a\n'
- "left argument to the '%' operator). Extensions must define "
- 'their own\n'
- 'conversion behavior.\n',
- 'customization': '\n'
- 'Basic customization\n'
- '*******************\n'
- '\n'
- 'object.__new__(cls[, ...])\n'
- '\n'
- ' Called to create a new instance of class *cls*. '
- '"__new__()" is a\n'
- ' static method (special-cased so you need not declare '
- 'it as such)\n'
- ' that takes the class of which an instance was '
- 'requested as its\n'
- ' first argument. The remaining arguments are those '
- 'passed to the\n'
- ' object constructor expression (the call to the '
- 'class). The return\n'
- ' value of "__new__()" should be the new object instance '
- '(usually an\n'
- ' instance of *cls*).\n'
- '\n'
- ' Typical implementations create a new instance of the '
- 'class by\n'
- ' invoking the superclass\'s "__new__()" method using\n'
- ' "super(currentclass, cls).__new__(cls[, ...])" with '
- 'appropriate\n'
- ' arguments and then modifying the newly-created '
- 'instance as\n'
- ' necessary before returning it.\n'
- '\n'
- ' If "__new__()" returns an instance of *cls*, then the '
- 'new\n'
- ' instance\'s "__init__()" method will be invoked like\n'
- ' "__init__(self[, ...])", where *self* is the new '
- 'instance and the\n'
- ' remaining arguments are the same as were passed to '
- '"__new__()".\n'
- '\n'
- ' If "__new__()" does not return an instance of *cls*, '
- 'then the new\n'
- ' instance\'s "__init__()" method will not be invoked.\n'
- '\n'
- ' "__new__()" is intended mainly to allow subclasses of '
- 'immutable\n'
- ' types (like int, str, or tuple) to customize instance '
- 'creation. It\n'
- ' is also commonly overridden in custom metaclasses in '
- 'order to\n'
- ' customize class creation.\n'
- '\n'
- 'object.__init__(self[, ...])\n'
- '\n'
- ' Called after the instance has been created (by '
- '"__new__()"), but\n'
- ' before it is returned to the caller. The arguments '
- 'are those\n'
- ' passed to the class constructor expression. If a base '
- 'class has an\n'
- ' "__init__()" method, the derived class\'s "__init__()" '
- 'method, if\n'
- ' any, must explicitly call it to ensure proper '
- 'initialization of the\n'
- ' base class part of the instance; for example:\n'
- ' "BaseClass.__init__(self, [args...])".\n'
- '\n'
- ' Because "__new__()" and "__init__()" work together in '
- 'constructing\n'
- ' objects ("__new__()" to create it, and "__init__()" to '
- 'customise\n'
- ' it), no non-"None" value may be returned by '
- '"__init__()"; doing so\n'
- ' will cause a "TypeError" to be raised at runtime.\n'
- '\n'
- 'object.__del__(self)\n'
- '\n'
- ' Called when the instance is about to be destroyed. '
- 'This is also\n'
- ' called a destructor. If a base class has a '
- '"__del__()" method, the\n'
- ' derived class\'s "__del__()" method, if any, must '
- 'explicitly call it\n'
- ' to ensure proper deletion of the base class part of '
- 'the instance.\n'
- ' Note that it is possible (though not recommended!) for '
- 'the\n'
- ' "__del__()" method to postpone destruction of the '
- 'instance by\n'
- ' creating a new reference to it. It may then be called '
- 'at a later\n'
- ' time when this new reference is deleted. It is not '
- 'guaranteed that\n'
- ' "__del__()" methods are called for objects that still '
- 'exist when\n'
- ' the interpreter exits.\n'
- '\n'
- ' Note: "del x" doesn\'t directly call "x.__del__()" --- '
- 'the former\n'
- ' decrements the reference count for "x" by one, and '
- 'the latter is\n'
- ' only called when "x"\'s reference count reaches '
- 'zero. Some common\n'
- ' situations that may prevent the reference count of '
- 'an object from\n'
- ' going to zero include: circular references between '
- 'objects (e.g.,\n'
- ' a doubly-linked list or a tree data structure with '
- 'parent and\n'
- ' child pointers); a reference to the object on the '
- 'stack frame of\n'
- ' a function that caught an exception (the traceback '
- 'stored in\n'
- ' "sys.exc_info()[2]" keeps the stack frame alive); or '
- 'a reference\n'
- ' to the object on the stack frame that raised an '
- 'unhandled\n'
- ' exception in interactive mode (the traceback stored '
- 'in\n'
- ' "sys.last_traceback" keeps the stack frame alive). '
- 'The first\n'
- ' situation can only be remedied by explicitly '
- 'breaking the cycles;\n'
- ' the second can be resolved by freeing the reference '
- 'to the\n'
- ' traceback object when it is no longer useful, and '
- 'the third can\n'
- ' be resolved by storing "None" in '
- '"sys.last_traceback". Circular\n'
- ' references which are garbage are detected and '
- 'cleaned up when the\n'
- " cyclic garbage collector is enabled (it's on by "
- 'default). Refer\n'
- ' to the documentation for the "gc" module for more '
- 'information\n'
- ' about this topic.\n'
- '\n'
- ' Warning: Due to the precarious circumstances under '
- 'which\n'
- ' "__del__()" methods are invoked, exceptions that '
- 'occur during\n'
- ' their execution are ignored, and a warning is '
- 'printed to\n'
- ' "sys.stderr" instead. Also, when "__del__()" is '
- 'invoked in\n'
- ' response to a module being deleted (e.g., when '
- 'execution of the\n'
- ' program is done), other globals referenced by the '
- '"__del__()"\n'
- ' method may already have been deleted or in the '
- 'process of being\n'
- ' torn down (e.g. the import machinery shutting '
- 'down). For this\n'
- ' reason, "__del__()" methods should do the absolute '
- 'minimum needed\n'
- ' to maintain external invariants. Starting with '
- 'version 1.5,\n'
- ' Python guarantees that globals whose name begins '
- 'with a single\n'
- ' underscore are deleted from their module before '
- 'other globals are\n'
- ' deleted; if no other references to such globals '
- 'exist, this may\n'
- ' help in assuring that imported modules are still '
- 'available at the\n'
- ' time when the "__del__()" method is called.\n'
- '\n'
- 'object.__repr__(self)\n'
- '\n'
- ' Called by the "repr()" built-in function to compute '
- 'the "official"\n'
- ' string representation of an object. If at all '
- 'possible, this\n'
- ' should look like a valid Python expression that could '
- 'be used to\n'
- ' recreate an object with the same value (given an '
- 'appropriate\n'
- ' environment). If this is not possible, a string of '
- 'the form\n'
- ' "<...some useful description...>" should be returned. '
- 'The return\n'
- ' value must be a string object. If a class defines '
- '"__repr__()" but\n'
- ' not "__str__()", then "__repr__()" is also used when '
- 'an "informal"\n'
- ' string representation of instances of that class is '
- 'required.\n'
- '\n'
- ' This is typically used for debugging, so it is '
- 'important that the\n'
- ' representation is information-rich and unambiguous.\n'
- '\n'
- 'object.__str__(self)\n'
- '\n'
- ' Called by "str(object)" and the built-in functions '
- '"format()" and\n'
- ' "print()" to compute the "informal" or nicely '
- 'printable string\n'
- ' representation of an object. The return value must be '
- 'a *string*\n'
- ' object.\n'
- '\n'
- ' This method differs from "object.__repr__()" in that '
- 'there is no\n'
- ' expectation that "__str__()" return a valid Python '
- 'expression: a\n'
- ' more convenient or concise representation can be '
- 'used.\n'
- '\n'
- ' The default implementation defined by the built-in '
- 'type "object"\n'
- ' calls "object.__repr__()".\n'
- '\n'
- 'object.__bytes__(self)\n'
- '\n'
- ' Called by "bytes()" to compute a byte-string '
- 'representation of an\n'
- ' object. This should return a "bytes" object.\n'
- '\n'
- 'object.__format__(self, format_spec)\n'
- '\n'
- ' Called by the "format()" built-in function (and by '
- 'extension, the\n'
- ' "str.format()" method of class "str") to produce a '
- '"formatted"\n'
- ' string representation of an object. The "format_spec" '
- 'argument is a\n'
- ' string that contains a description of the formatting '
- 'options\n'
- ' desired. The interpretation of the "format_spec" '
- 'argument is up to\n'
- ' the type implementing "__format__()", however most '
- 'classes will\n'
- ' either delegate formatting to one of the built-in '
- 'types, or use a\n'
- ' similar formatting option syntax.\n'
- '\n'
- ' See *Format Specification Mini-Language* for a '
- 'description of the\n'
- ' standard formatting syntax.\n'
- '\n'
- ' The return value must be a string object.\n'
- '\n'
- ' Changed in version 3.4: The __format__ method of '
- '"object" itself\n'
- ' raises a "TypeError" if passed any non-empty string.\n'
- '\n'
- 'object.__lt__(self, other)\n'
- 'object.__le__(self, other)\n'
- 'object.__eq__(self, other)\n'
- 'object.__ne__(self, other)\n'
- 'object.__gt__(self, other)\n'
- 'object.__ge__(self, other)\n'
- '\n'
- ' These are the so-called "rich comparison" methods. '
- 'The\n'
- ' correspondence between operator symbols and method '
- 'names is as\n'
- ' follows: "x<y" calls "x.__lt__(y)", "x<=y" calls '
- '"x.__le__(y)",\n'
- ' "x==y" calls "x.__eq__(y)", "x!=y" calls '
- '"x.__ne__(y)", "x>y" calls\n'
- ' "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n'
- '\n'
- ' A rich comparison method may return the singleton '
- '"NotImplemented"\n'
- ' if it does not implement the operation for a given '
- 'pair of\n'
- ' arguments. By convention, "False" and "True" are '
- 'returned for a\n'
- ' successful comparison. However, these methods can '
- 'return any value,\n'
- ' so if the comparison operator is used in a Boolean '
- 'context (e.g.,\n'
- ' in the condition of an "if" statement), Python will '
- 'call "bool()"\n'
- ' on the value to determine if the result is true or '
- 'false.\n'
- '\n'
- ' By default, "__ne__()" delegates to "__eq__()" and '
- 'inverts the\n'
- ' result unless it is "NotImplemented". There are no '
- 'other implied\n'
- ' relationships among the comparison operators, for '
- 'example, the\n'
- ' truth of "(x<y or x==y)" does not imply "x<=y". To '
- 'automatically\n'
- ' generate ordering operations from a single root '
- 'operation, see\n'
- ' "functools.total_ordering()".\n'
- '\n'
- ' See the paragraph on "__hash__()" for some important '
- 'notes on\n'
- ' creating *hashable* objects which support custom '
- 'comparison\n'
- ' operations and are usable as dictionary keys.\n'
- '\n'
- ' There are no swapped-argument versions of these '
- 'methods (to be used\n'
- ' when the left argument does not support the operation '
- 'but the right\n'
- ' argument does); rather, "__lt__()" and "__gt__()" are '
- "each other's\n"
- ' reflection, "__le__()" and "__ge__()" are each '
- "other's reflection,\n"
- ' and "__eq__()" and "__ne__()" are their own '
- 'reflection. If the\n'
- " operands are of different types, and right operand's "
- 'type is a\n'
- " direct or indirect subclass of the left operand's "
- 'type, the\n'
- ' reflected method of the right operand has priority, '
- 'otherwise the\n'
- " left operand's method has priority. Virtual "
- 'subclassing is not\n'
- ' considered.\n'
- '\n'
- 'object.__hash__(self)\n'
- '\n'
- ' Called by built-in function "hash()" and for '
- 'operations on members\n'
- ' of hashed collections including "set", "frozenset", '
- 'and "dict".\n'
- ' "__hash__()" should return an integer. The only '
- 'required property\n'
- ' is that objects which compare equal have the same hash '
- 'value; it is\n'
- ' advised to somehow mix together (e.g. using exclusive '
- 'or) the hash\n'
- ' values for the components of the object that also play '
- 'a part in\n'
- ' comparison of objects.\n'
- '\n'
- ' Note: "hash()" truncates the value returned from an '
- "object's\n"
- ' custom "__hash__()" method to the size of a '
- '"Py_ssize_t". This\n'
- ' is typically 8 bytes on 64-bit builds and 4 bytes on '
- '32-bit\n'
- ' builds. If an object\'s "__hash__()" must '
- 'interoperate on builds\n'
- ' of different bit sizes, be sure to check the width '
- 'on all\n'
- ' supported builds. An easy way to do this is with '
- '"python -c\n'
- ' "import sys; print(sys.hash_info.width)""\n'
- '\n'
- ' If a class does not define an "__eq__()" method it '
- 'should not\n'
- ' define a "__hash__()" operation either; if it defines '
- '"__eq__()"\n'
- ' but not "__hash__()", its instances will not be usable '
- 'as items in\n'
- ' hashable collections. If a class defines mutable '
- 'objects and\n'
- ' implements an "__eq__()" method, it should not '
- 'implement\n'
- ' "__hash__()", since the implementation of hashable '
- 'collections\n'
- " requires that a key's hash value is immutable (if the "
- "object's hash\n"
- ' value changes, it will be in the wrong hash bucket).\n'
- '\n'
- ' User-defined classes have "__eq__()" and "__hash__()" '
- 'methods by\n'
- ' default; with them, all objects compare unequal '
- '(except with\n'
- ' themselves) and "x.__hash__()" returns an appropriate '
- 'value such\n'
- ' that "x == y" implies both that "x is y" and "hash(x) '
- '== hash(y)".\n'
- '\n'
- ' A class that overrides "__eq__()" and does not define '
- '"__hash__()"\n'
- ' will have its "__hash__()" implicitly set to "None". '
- 'When the\n'
- ' "__hash__()" method of a class is "None", instances of '
- 'the class\n'
- ' will raise an appropriate "TypeError" when a program '
- 'attempts to\n'
- ' retrieve their hash value, and will also be correctly '
- 'identified as\n'
- ' unhashable when checking "isinstance(obj, '
- 'collections.Hashable").\n'
- '\n'
- ' If a class that overrides "__eq__()" needs to retain '
- 'the\n'
- ' implementation of "__hash__()" from a parent class, '
- 'the interpreter\n'
- ' must be told this explicitly by setting "__hash__ =\n'
- ' <ParentClass>.__hash__".\n'
- '\n'
- ' If a class that does not override "__eq__()" wishes to '
- 'suppress\n'
- ' hash support, it should include "__hash__ = None" in '
- 'the class\n'
- ' definition. A class which defines its own "__hash__()" '
- 'that\n'
- ' explicitly raises a "TypeError" would be incorrectly '
- 'identified as\n'
- ' hashable by an "isinstance(obj, collections.Hashable)" '
- 'call.\n'
- '\n'
- ' Note: By default, the "__hash__()" values of str, '
- 'bytes and\n'
- ' datetime objects are "salted" with an unpredictable '
- 'random value.\n'
- ' Although they remain constant within an individual '
- 'Python\n'
- ' process, they are not predictable between repeated '
- 'invocations of\n'
- ' Python.This is intended to provide protection '
- 'against a denial-\n'
- ' of-service caused by carefully-chosen inputs that '
- 'exploit the\n'
- ' worst case performance of a dict insertion, O(n^2) '
- 'complexity.\n'
- ' See '
- 'http://www.ocert.org/advisories/ocert-2011-003.html for\n'
- ' details.Changing hash values affects the iteration '
- 'order of\n'
- ' dicts, sets and other mappings. Python has never '
- 'made guarantees\n'
- ' about this ordering (and it typically varies between '
- '32-bit and\n'
- ' 64-bit builds).See also "PYTHONHASHSEED".\n'
- '\n'
- ' Changed in version 3.3: Hash randomization is enabled '
- 'by default.\n'
- '\n'
- 'object.__bool__(self)\n'
- '\n'
- ' Called to implement truth value testing and the '
- 'built-in operation\n'
- ' "bool()"; should return "False" or "True". When this '
- 'method is not\n'
- ' defined, "__len__()" is called, if it is defined, and '
- 'the object is\n'
- ' considered true if its result is nonzero. If a class '
- 'defines\n'
- ' neither "__len__()" nor "__bool__()", all its '
- 'instances are\n'
- ' considered true.\n',
- 'debugger': '\n'
- '"pdb" --- The Python Debugger\n'
- '*****************************\n'
- '\n'
- '**Source code:** Lib/pdb.py\n'
- '\n'
- '======================================================================\n'
- '\n'
- 'The module "pdb" defines an interactive source code debugger '
- 'for\n'
- 'Python programs. It supports setting (conditional) '
- 'breakpoints and\n'
- 'single stepping at the source line level, inspection of stack '
- 'frames,\n'
- 'source code listing, and evaluation of arbitrary Python code '
- 'in the\n'
- 'context of any stack frame. It also supports post-mortem '
- 'debugging\n'
- 'and can be called under program control.\n'
- '\n'
- 'The debugger is extensible -- it is actually defined as the '
- 'class\n'
- '"Pdb". This is currently undocumented but easily understood by '
- 'reading\n'
- 'the source. The extension interface uses the modules "bdb" '
- 'and "cmd".\n'
- '\n'
- 'The debugger\'s prompt is "(Pdb)". Typical usage to run a '
- 'program under\n'
- 'control of the debugger is:\n'
- '\n'
- ' >>> import pdb\n'
- ' >>> import mymodule\n'
- " >>> pdb.run('mymodule.test()')\n"
- ' > <string>(0)?()\n'
- ' (Pdb) continue\n'
- ' > <string>(1)?()\n'
- ' (Pdb) continue\n'
- " NameError: 'spam'\n"
- ' > <string>(1)?()\n'
- ' (Pdb)\n'
- '\n'
- 'Changed in version 3.3: Tab-completion via the "readline" '
- 'module is\n'
- 'available for commands and command arguments, e.g. the current '
- 'global\n'
- 'and local names are offered as arguments of the "p" command.\n'
- '\n'
- '"pdb.py" can also be invoked as a script to debug other '
- 'scripts. For\n'
- 'example:\n'
- '\n'
- ' python3 -m pdb myscript.py\n'
- '\n'
- 'When invoked as a script, pdb will automatically enter '
- 'post-mortem\n'
- 'debugging if the program being debugged exits abnormally. '
- 'After post-\n'
- 'mortem debugging (or after normal exit of the program), pdb '
- 'will\n'
- "restart the program. Automatic restarting preserves pdb's "
- 'state (such\n'
- 'as breakpoints) and in most cases is more useful than quitting '
- 'the\n'
- "debugger upon program's exit.\n"
- '\n'
- 'New in version 3.2: "pdb.py" now accepts a "-c" option that '
- 'executes\n'
- 'commands as if given in a ".pdbrc" file, see *Debugger '
- 'Commands*.\n'
- '\n'
- 'The typical usage to break into the debugger from a running '
- 'program is\n'
- 'to insert\n'
- '\n'
- ' import pdb; pdb.set_trace()\n'
- '\n'
- 'at the location you want to break into the debugger. You can '
- 'then\n'
- 'step through the code following this statement, and continue '
- 'running\n'
- 'without the debugger using the "continue" command.\n'
- '\n'
- 'The typical usage to inspect a crashed program is:\n'
- '\n'
- ' >>> import pdb\n'
- ' >>> import mymodule\n'
- ' >>> mymodule.test()\n'
- ' Traceback (most recent call last):\n'
- ' File "<stdin>", line 1, in ?\n'
- ' File "./mymodule.py", line 4, in test\n'
- ' test2()\n'
- ' File "./mymodule.py", line 3, in test2\n'
- ' print(spam)\n'
- ' NameError: spam\n'
- ' >>> pdb.pm()\n'
- ' > ./mymodule.py(3)test2()\n'
- ' -> print(spam)\n'
- ' (Pdb)\n'
- '\n'
- 'The module defines the following functions; each enters the '
- 'debugger\n'
- 'in a slightly different way:\n'
- '\n'
- 'pdb.run(statement, globals=None, locals=None)\n'
- '\n'
- ' Execute the *statement* (given as a string or a code '
- 'object) under\n'
- ' debugger control. The debugger prompt appears before any '
- 'code is\n'
- ' executed; you can set breakpoints and type "continue", or '
- 'you can\n'
- ' step through the statement using "step" or "next" (all '
- 'these\n'
- ' commands are explained below). The optional *globals* and '
- '*locals*\n'
- ' arguments specify the environment in which the code is '
- 'executed; by\n'
- ' default the dictionary of the module "__main__" is used. '
- '(See the\n'
- ' explanation of the built-in "exec()" or "eval()" '
- 'functions.)\n'
- '\n'
- 'pdb.runeval(expression, globals=None, locals=None)\n'
- '\n'
- ' Evaluate the *expression* (given as a string or a code '
- 'object)\n'
- ' under debugger control. When "runeval()" returns, it '
- 'returns the\n'
- ' value of the expression. Otherwise this function is '
- 'similar to\n'
- ' "run()".\n'
- '\n'
- 'pdb.runcall(function, *args, **kwds)\n'
- '\n'
- ' Call the *function* (a function or method object, not a '
- 'string)\n'
- ' with the given arguments. When "runcall()" returns, it '
- 'returns\n'
- ' whatever the function call returned. The debugger prompt '
- 'appears\n'
- ' as soon as the function is entered.\n'
- '\n'
- 'pdb.set_trace()\n'
- '\n'
- ' Enter the debugger at the calling stack frame. This is '
- 'useful to\n'
- ' hard-code a breakpoint at a given point in a program, even '
- 'if the\n'
- ' code is not otherwise being debugged (e.g. when an '
- 'assertion\n'
- ' fails).\n'
- '\n'
- 'pdb.post_mortem(traceback=None)\n'
- '\n'
- ' Enter post-mortem debugging of the given *traceback* '
- 'object. If no\n'
- ' *traceback* is given, it uses the one of the exception that '
- 'is\n'
- ' currently being handled (an exception must be being handled '
- 'if the\n'
- ' default is to be used).\n'
- '\n'
- 'pdb.pm()\n'
- '\n'
- ' Enter post-mortem debugging of the traceback found in\n'
- ' "sys.last_traceback".\n'
- '\n'
- 'The "run*" functions and "set_trace()" are aliases for '
- 'instantiating\n'
- 'the "Pdb" class and calling the method of the same name. If '
- 'you want\n'
- 'to access further features, you have to do this yourself:\n'
- '\n'
- "class class pdb.Pdb(completekey='tab', stdin=None, "
- 'stdout=None, skip=None, nosigint=False)\n'
- '\n'
- ' "Pdb" is the debugger class.\n'
- '\n'
- ' The *completekey*, *stdin* and *stdout* arguments are '
- 'passed to the\n'
- ' underlying "cmd.Cmd" class; see the description there.\n'
- '\n'
- ' The *skip* argument, if given, must be an iterable of '
- 'glob-style\n'
- ' module name patterns. The debugger will not step into '
- 'frames that\n'
- ' originate in a module that matches one of these patterns. '
- '[1]\n'
- '\n'
- ' By default, Pdb sets a handler for the SIGINT signal (which '
- 'is sent\n'
- ' when the user presses Ctrl-C on the console) when you give '
- 'a\n'
- ' "continue" command. This allows you to break into the '
- 'debugger\n'
- ' again by pressing Ctrl-C. If you want Pdb not to touch the '
- 'SIGINT\n'
- ' handler, set *nosigint* tot true.\n'
- '\n'
- ' Example call to enable tracing with *skip*:\n'
- '\n'
- " import pdb; pdb.Pdb(skip=['django.*']).set_trace()\n"
- '\n'
- ' New in version 3.1: The *skip* argument.\n'
- '\n'
- ' New in version 3.2: The *nosigint* argument. Previously, a '
- 'SIGINT\n'
- ' handler was never set by Pdb.\n'
- '\n'
- ' run(statement, globals=None, locals=None)\n'
- ' runeval(expression, globals=None, locals=None)\n'
- ' runcall(function, *args, **kwds)\n'
- ' set_trace()\n'
- '\n'
- ' See the documentation for the functions explained '
- 'above.\n'
- '\n'
- '\n'
- 'Debugger Commands\n'
- '=================\n'
- '\n'
- 'The commands recognized by the debugger are listed below. '
- 'Most\n'
- 'commands can be abbreviated to one or two letters as '
- 'indicated; e.g.\n'
- '"h(elp)" means that either "h" or "help" can be used to enter '
- 'the help\n'
- 'command (but not "he" or "hel", nor "H" or "Help" or "HELP").\n'
- 'Arguments to commands must be separated by whitespace (spaces '
- 'or\n'
- 'tabs). Optional arguments are enclosed in square brackets '
- '("[]") in\n'
- 'the command syntax; the square brackets must not be typed.\n'
- 'Alternatives in the command syntax are separated by a vertical '
- 'bar\n'
- '("|").\n'
- '\n'
- 'Entering a blank line repeats the last command entered. '
- 'Exception: if\n'
- 'the last command was a "list" command, the next 11 lines are '
- 'listed.\n'
- '\n'
- "Commands that the debugger doesn't recognize are assumed to be "
- 'Python\n'
- 'statements and are executed in the context of the program '
- 'being\n'
- 'debugged. Python statements can also be prefixed with an '
- 'exclamation\n'
- 'point ("!"). This is a powerful way to inspect the program '
- 'being\n'
- 'debugged; it is even possible to change a variable or call a '
- 'function.\n'
- 'When an exception occurs in such a statement, the exception '
- 'name is\n'
- "printed but the debugger's state is not changed.\n"
- '\n'
- 'The debugger supports *aliases*. Aliases can have parameters '
- 'which\n'
- 'allows one a certain level of adaptability to the context '
- 'under\n'
- 'examination.\n'
- '\n'
- 'Multiple commands may be entered on a single line, separated '
- 'by ";;".\n'
- '(A single ";" is not used as it is the separator for multiple '
- 'commands\n'
- 'in a line that is passed to the Python parser.) No '
- 'intelligence is\n'
- 'applied to separating the commands; the input is split at the '
- 'first\n'
- '";;" pair, even if it is in the middle of a quoted string.\n'
- '\n'
- 'If a file ".pdbrc" exists in the user\'s home directory or in '
- 'the\n'
- 'current directory, it is read in and executed as if it had '
- 'been typed\n'
- 'at the debugger prompt. This is particularly useful for '
- 'aliases. If\n'
- 'both files exist, the one in the home directory is read first '
- 'and\n'
- 'aliases defined there can be overridden by the local file.\n'
- '\n'
- 'Changed in version 3.2: ".pdbrc" can now contain commands '
- 'that\n'
- 'continue debugging, such as "continue" or "next". Previously, '
- 'these\n'
- 'commands had no effect.\n'
- '\n'
- 'h(elp) [command]\n'
- '\n'
- ' Without argument, print the list of available commands. '
- 'With a\n'
- ' *command* as argument, print help about that command. '
- '"help pdb"\n'
- ' displays the full documentation (the docstring of the '
- '"pdb"\n'
- ' module). Since the *command* argument must be an '
- 'identifier, "help\n'
- ' exec" must be entered to get help on the "!" command.\n'
- '\n'
- 'w(here)\n'
- '\n'
- ' Print a stack trace, with the most recent frame at the '
- 'bottom. An\n'
- ' arrow indicates the current frame, which determines the '
- 'context of\n'
- ' most commands.\n'
- '\n'
- 'd(own) [count]\n'
- '\n'
- ' Move the current frame *count* (default one) levels down in '
- 'the\n'
- ' stack trace (to a newer frame).\n'
- '\n'
- 'u(p) [count]\n'
- '\n'
- ' Move the current frame *count* (default one) levels up in '
- 'the stack\n'
- ' trace (to an older frame).\n'
- '\n'
- 'b(reak) [([filename:]lineno | function) [, condition]]\n'
- '\n'
- ' With a *lineno* argument, set a break there in the current '
- 'file.\n'
- ' With a *function* argument, set a break at the first '
- 'executable\n'
- ' statement within that function. The line number may be '
- 'prefixed\n'
- ' with a filename and a colon, to specify a breakpoint in '
- 'another\n'
- " file (probably one that hasn't been loaded yet). The file "
- 'is\n'
- ' searched on "sys.path". Note that each breakpoint is '
- 'assigned a\n'
- ' number to which all the other breakpoint commands refer.\n'
- '\n'
- ' If a second argument is present, it is an expression which '
- 'must\n'
- ' evaluate to true before the breakpoint is honored.\n'
- '\n'
- ' Without argument, list all breaks, including for each '
- 'breakpoint,\n'
- ' the number of times that breakpoint has been hit, the '
- 'current\n'
- ' ignore count, and the associated condition if any.\n'
- '\n'
- 'tbreak [([filename:]lineno | function) [, condition]]\n'
- '\n'
- ' Temporary breakpoint, which is removed automatically when '
- 'it is\n'
- ' first hit. The arguments are the same as for "break".\n'
- '\n'
- 'cl(ear) [filename:lineno | bpnumber [bpnumber ...]]\n'
- '\n'
- ' With a *filename:lineno* argument, clear all the '
- 'breakpoints at\n'
- ' this line. With a space separated list of breakpoint '
- 'numbers, clear\n'
- ' those breakpoints. Without argument, clear all breaks (but '
- 'first\n'
- ' ask confirmation).\n'
- '\n'
- 'disable [bpnumber [bpnumber ...]]\n'
- '\n'
- ' Disable the breakpoints given as a space separated list of\n'
- ' breakpoint numbers. Disabling a breakpoint means it cannot '
- 'cause\n'
- ' the program to stop execution, but unlike clearing a '
- 'breakpoint, it\n'
- ' remains in the list of breakpoints and can be '
- '(re-)enabled.\n'
- '\n'
- 'enable [bpnumber [bpnumber ...]]\n'
- '\n'
- ' Enable the breakpoints specified.\n'
- '\n'
- 'ignore bpnumber [count]\n'
- '\n'
- ' Set the ignore count for the given breakpoint number. If '
- 'count is\n'
- ' omitted, the ignore count is set to 0. A breakpoint '
- 'becomes active\n'
- ' when the ignore count is zero. When non-zero, the count '
- 'is\n'
- ' decremented each time the breakpoint is reached and the '
- 'breakpoint\n'
- ' is not disabled and any associated condition evaluates to '
- 'true.\n'
- '\n'
- 'condition bpnumber [condition]\n'
- '\n'
- ' Set a new *condition* for the breakpoint, an expression '
- 'which must\n'
- ' evaluate to true before the breakpoint is honored. If '
- '*condition*\n'
- ' is absent, any existing condition is removed; i.e., the '
- 'breakpoint\n'
- ' is made unconditional.\n'
- '\n'
- 'commands [bpnumber]\n'
- '\n'
- ' Specify a list of commands for breakpoint number '
- '*bpnumber*. The\n'
- ' commands themselves appear on the following lines. Type a '
- 'line\n'
- ' containing just "end" to terminate the commands. An '
- 'example:\n'
- '\n'
- ' (Pdb) commands 1\n'
- ' (com) p some_variable\n'
- ' (com) end\n'
- ' (Pdb)\n'
- '\n'
- ' To remove all commands from a breakpoint, type commands and '
- 'follow\n'
- ' it immediately with "end"; that is, give no commands.\n'
- '\n'
- ' With no *bpnumber* argument, commands refers to the last '
- 'breakpoint\n'
- ' set.\n'
- '\n'
- ' You can use breakpoint commands to start your program up '
- 'again.\n'
- ' Simply use the continue command, or step, or any other '
- 'command that\n'
- ' resumes execution.\n'
- '\n'
- ' Specifying any command resuming execution (currently '
- 'continue,\n'
- ' step, next, return, jump, quit and their abbreviations) '
- 'terminates\n'
- ' the command list (as if that command was immediately '
- 'followed by\n'
- ' end). This is because any time you resume execution (even '
- 'with a\n'
- ' simple next or step), you may encounter another '
- 'breakpoint--which\n'
- ' could have its own command list, leading to ambiguities '
- 'about which\n'
- ' list to execute.\n'
- '\n'
- " If you use the 'silent' command in the command list, the "
- 'usual\n'
- ' message about stopping at a breakpoint is not printed. '
- 'This may be\n'
- ' desirable for breakpoints that are to print a specific '
- 'message and\n'
- ' then continue. If none of the other commands print '
- 'anything, you\n'
- ' see no sign that the breakpoint was reached.\n'
- '\n'
- 's(tep)\n'
- '\n'
- ' Execute the current line, stop at the first possible '
- 'occasion\n'
- ' (either in a function that is called or on the next line in '
- 'the\n'
- ' current function).\n'
- '\n'
- 'n(ext)\n'
- '\n'
- ' Continue execution until the next line in the current '
- 'function is\n'
- ' reached or it returns. (The difference between "next" and '
- '"step"\n'
- ' is that "step" stops inside a called function, while '
- '"next"\n'
- ' executes called functions at (nearly) full speed, only '
- 'stopping at\n'
- ' the next line in the current function.)\n'
- '\n'
- 'unt(il) [lineno]\n'
- '\n'
- ' Without argument, continue execution until the line with a '
- 'number\n'
- ' greater than the current one is reached.\n'
- '\n'
- ' With a line number, continue execution until a line with a '
- 'number\n'
- ' greater or equal to that is reached. In both cases, also '
- 'stop when\n'
- ' the current frame returns.\n'
- '\n'
- ' Changed in version 3.2: Allow giving an explicit line '
- 'number.\n'
- '\n'
- 'r(eturn)\n'
- '\n'
- ' Continue execution until the current function returns.\n'
- '\n'
- 'c(ont(inue))\n'
- '\n'
- ' Continue execution, only stop when a breakpoint is '
- 'encountered.\n'
- '\n'
- 'j(ump) lineno\n'
- '\n'
- ' Set the next line that will be executed. Only available in '
- 'the\n'
- ' bottom-most frame. This lets you jump back and execute '
- 'code again,\n'
- " or jump forward to skip code that you don't want to run.\n"
- '\n'
- ' It should be noted that not all jumps are allowed -- for '
- 'instance\n'
- ' it is not possible to jump into the middle of a "for" loop '
- 'or out\n'
- ' of a "finally" clause.\n'
- '\n'
- 'l(ist) [first[, last]]\n'
- '\n'
- ' List source code for the current file. Without arguments, '
- 'list 11\n'
- ' lines around the current line or continue the previous '
- 'listing.\n'
- ' With "." as argument, list 11 lines around the current '
- 'line. With\n'
- ' one argument, list 11 lines around at that line. With two\n'
- ' arguments, list the given range; if the second argument is '
- 'less\n'
- ' than the first, it is interpreted as a count.\n'
- '\n'
- ' The current line in the current frame is indicated by '
- '"->". If an\n'
- ' exception is being debugged, the line where the exception '
- 'was\n'
- ' originally raised or propagated is indicated by ">>", if it '
- 'differs\n'
- ' from the current line.\n'
- '\n'
- ' New in version 3.2: The ">>" marker.\n'
- '\n'
- 'll | longlist\n'
- '\n'
- ' List all source code for the current function or frame.\n'
- ' Interesting lines are marked as for "list".\n'
- '\n'
- ' New in version 3.2.\n'
- '\n'
- 'a(rgs)\n'
- '\n'
- ' Print the argument list of the current function.\n'
- '\n'
- 'p expression\n'
- '\n'
- ' Evaluate the *expression* in the current context and print '
- 'its\n'
- ' value.\n'
- '\n'
- ' Note: "print()" can also be used, but is not a debugger '
- 'command\n'
- ' --- this executes the Python "print()" function.\n'
- '\n'
- 'pp expression\n'
- '\n'
- ' Like the "p" command, except the value of the expression is '
- 'pretty-\n'
- ' printed using the "pprint" module.\n'
- '\n'
- 'whatis expression\n'
- '\n'
- ' Print the type of the *expression*.\n'
- '\n'
- 'source expression\n'
- '\n'
- ' Try to get source code for the given object and display '
- 'it.\n'
- '\n'
- ' New in version 3.2.\n'
- '\n'
- 'display [expression]\n'
- '\n'
- ' Display the value of the expression if it changed, each '
- 'time\n'
- ' execution stops in the current frame.\n'
- '\n'
- ' Without expression, list all display expressions for the '
- 'current\n'
- ' frame.\n'
- '\n'
- ' New in version 3.2.\n'
- '\n'
- 'undisplay [expression]\n'
- '\n'
- ' Do not display the expression any more in the current '
- 'frame.\n'
- ' Without expression, clear all display expressions for the '
- 'current\n'
- ' frame.\n'
- '\n'
- ' New in version 3.2.\n'
- '\n'
- 'interact\n'
- '\n'
- ' Start an interative interpreter (using the "code" module) '
- 'whose\n'
- ' global namespace contains all the (global and local) names '
- 'found in\n'
- ' the current scope.\n'
- '\n'
- ' New in version 3.2.\n'
- '\n'
- 'alias [name [command]]\n'
- '\n'
- ' Create an alias called *name* that executes *command*. The '
- 'command\n'
- ' must *not* be enclosed in quotes. Replaceable parameters '
- 'can be\n'
- ' indicated by "%1", "%2", and so on, while "%*" is replaced '
- 'by all\n'
- ' the parameters. If no command is given, the current alias '
- 'for\n'
- ' *name* is shown. If no arguments are given, all aliases are '
- 'listed.\n'
- '\n'
- ' Aliases may be nested and can contain anything that can be '
- 'legally\n'
- ' typed at the pdb prompt. Note that internal pdb commands '
- '*can* be\n'
- ' overridden by aliases. Such a command is then hidden until '
- 'the\n'
- ' alias is removed. Aliasing is recursively applied to the '
- 'first\n'
- ' word of the command line; all other words in the line are '
- 'left\n'
- ' alone.\n'
- '\n'
- ' As an example, here are two useful aliases (especially when '
- 'placed\n'
- ' in the ".pdbrc" file):\n'
- '\n'
- ' # Print instance variables (usage "pi classInst")\n'
- ' alias pi for k in %1.__dict__.keys(): '
- 'print("%1.",k,"=",%1.__dict__[k])\n'
- ' # Print instance variables in self\n'
- ' alias ps pi self\n'
- '\n'
- 'unalias name\n'
- '\n'
- ' Delete the specified alias.\n'
- '\n'
- '! statement\n'
- '\n'
- ' Execute the (one-line) *statement* in the context of the '
- 'current\n'
- ' stack frame. The exclamation point can be omitted unless '
- 'the first\n'
- ' word of the statement resembles a debugger command. To set '
- 'a\n'
- ' global variable, you can prefix the assignment command with '
- 'a\n'
- ' "global" statement on the same line, e.g.:\n'
- '\n'
- " (Pdb) global list_options; list_options = ['-l']\n"
- ' (Pdb)\n'
- '\n'
- 'run [args ...]\n'
- 'restart [args ...]\n'
- '\n'
- ' Restart the debugged Python program. If an argument is '
- 'supplied,\n'
- ' it is split with "shlex" and the result is used as the new\n'
- ' "sys.argv". History, breakpoints, actions and debugger '
- 'options are\n'
- ' preserved. "restart" is an alias for "run".\n'
- '\n'
- 'q(uit)\n'
- '\n'
- ' Quit from the debugger. The program being executed is '
- 'aborted.\n'
- '\n'
- '-[ Footnotes ]-\n'
- '\n'
- '[1] Whether a frame is considered to originate in a certain '
- 'module\n'
- ' is determined by the "__name__" in the frame globals.\n',
- 'del': '\n'
- 'The "del" statement\n'
- '*******************\n'
- '\n'
- ' del_stmt ::= "del" target_list\n'
- '\n'
- 'Deletion is recursively defined very similar to the way assignment '
- 'is\n'
- 'defined. Rather than spelling it out in full details, here are '
- 'some\n'
- 'hints.\n'
- '\n'
- 'Deletion of a target list recursively deletes each target, from '
- 'left\n'
- 'to right.\n'
- '\n'
- 'Deletion of a name removes the binding of that name from the local '
- 'or\n'
- 'global namespace, depending on whether the name occurs in a '
- '"global"\n'
- 'statement in the same code block. If the name is unbound, a\n'
- '"NameError" exception will be raised.\n'
- '\n'
- 'Deletion of attribute references, subscriptions and slicings is '
- 'passed\n'
- 'to the primary object involved; deletion of a slicing is in '
- 'general\n'
- 'equivalent to assignment of an empty slice of the right type (but '
- 'even\n'
- 'this is determined by the sliced object).\n'
- '\n'
- 'Changed in version 3.2: Previously it was illegal to delete a name\n'
- 'from the local namespace if it occurs as a free variable in a '
- 'nested\n'
- 'block.\n',
- 'dict': '\n'
- 'Dictionary displays\n'
- '*******************\n'
- '\n'
- 'A dictionary display is a possibly empty series of key/datum '
- 'pairs\n'
- 'enclosed in curly braces:\n'
- '\n'
- ' dict_display ::= "{" [key_datum_list | '
- 'dict_comprehension] "}"\n'
- ' key_datum_list ::= key_datum ("," key_datum)* [","]\n'
- ' key_datum ::= expression ":" expression\n'
- ' dict_comprehension ::= expression ":" expression comp_for\n'
- '\n'
- 'A dictionary display yields a new dictionary object.\n'
- '\n'
- 'If a comma-separated sequence of key/datum pairs is given, they '
- 'are\n'
- 'evaluated from left to right to define the entries of the '
- 'dictionary:\n'
- 'each key object is used as a key into the dictionary to store the\n'
- 'corresponding datum. This means that you can specify the same '
- 'key\n'
- "multiple times in the key/datum list, and the final dictionary's "
- 'value\n'
- 'for that key will be the last one given.\n'
- '\n'
- 'A dict comprehension, in contrast to list and set comprehensions,\n'
- 'needs two expressions separated with a colon followed by the '
- 'usual\n'
- '"for" and "if" clauses. When the comprehension is run, the '
- 'resulting\n'
- 'key and value elements are inserted in the new dictionary in the '
- 'order\n'
- 'they are produced.\n'
- '\n'
- 'Restrictions on the types of the key values are listed earlier in\n'
- 'section *The standard type hierarchy*. (To summarize, the key '
- 'type\n'
- 'should be *hashable*, which excludes all mutable objects.) '
- 'Clashes\n'
- 'between duplicate keys are not detected; the last datum '
- '(textually\n'
- 'rightmost in the display) stored for a given key value prevails.\n',
- 'dynamic-features': '\n'
- 'Interaction with dynamic features\n'
- '*********************************\n'
- '\n'
- 'Name resolution of free variables occurs at runtime, '
- 'not at compile\n'
- 'time. This means that the following code will print '
- '42:\n'
- '\n'
- ' i = 10\n'
- ' def f():\n'
- ' print(i)\n'
- ' i = 42\n'
- ' f()\n'
- '\n'
- 'There are several cases where Python statements are '
- 'illegal when used\n'
- 'in conjunction with nested scopes that contain free '
- 'variables.\n'
- '\n'
- 'If a variable is referenced in an enclosing scope, it '
- 'is illegal to\n'
- 'delete the name. An error will be reported at compile '
- 'time.\n'
- '\n'
- 'The "eval()" and "exec()" functions do not have access '
- 'to the full\n'
- 'environment for resolving names. Names may be '
- 'resolved in the local\n'
- 'and global namespaces of the caller. Free variables '
- 'are not resolved\n'
- 'in the nearest enclosing namespace, but in the global '
- 'namespace. [1]\n'
- 'The "exec()" and "eval()" functions have optional '
- 'arguments to\n'
- 'override the global and local namespace. If only one '
- 'namespace is\n'
- 'specified, it is used for both.\n',
- 'else': '\n'
- 'The "if" statement\n'
- '******************\n'
- '\n'
- 'The "if" statement is used for conditional execution:\n'
- '\n'
- ' if_stmt ::= "if" expression ":" suite\n'
- ' ( "elif" expression ":" suite )*\n'
- ' ["else" ":" suite]\n'
- '\n'
- 'It selects exactly one of the suites by evaluating the expressions '
- 'one\n'
- 'by one until one is found to be true (see section *Boolean '
- 'operations*\n'
- 'for the definition of true and false); then that suite is '
- 'executed\n'
- '(and no other part of the "if" statement is executed or '
- 'evaluated).\n'
- 'If all expressions are false, the suite of the "else" clause, if\n'
- 'present, is executed.\n',
- 'exceptions': '\n'
- 'Exceptions\n'
- '**********\n'
- '\n'
- 'Exceptions are a means of breaking out of the normal flow of '
- 'control\n'
- 'of a code block in order to handle errors or other '
- 'exceptional\n'
- 'conditions. An exception is *raised* at the point where the '
- 'error is\n'
- 'detected; it may be *handled* by the surrounding code block '
- 'or by any\n'
- 'code block that directly or indirectly invoked the code '
- 'block where\n'
- 'the error occurred.\n'
- '\n'
- 'The Python interpreter raises an exception when it detects a '
- 'run-time\n'
- 'error (such as division by zero). A Python program can '
- 'also\n'
- 'explicitly raise an exception with the "raise" statement. '
- 'Exception\n'
- 'handlers are specified with the "try" ... "except" '
- 'statement. The\n'
- '"finally" clause of such a statement can be used to specify '
- 'cleanup\n'
- 'code which does not handle the exception, but is executed '
- 'whether an\n'
- 'exception occurred or not in the preceding code.\n'
- '\n'
- 'Python uses the "termination" model of error handling: an '
- 'exception\n'
- 'handler can find out what happened and continue execution at '
- 'an outer\n'
- 'level, but it cannot repair the cause of the error and retry '
- 'the\n'
- 'failing operation (except by re-entering the offending piece '
- 'of code\n'
- 'from the top).\n'
- '\n'
- 'When an exception is not handled at all, the interpreter '
- 'terminates\n'
- 'execution of the program, or returns to its interactive main '
- 'loop. In\n'
- 'either case, it prints a stack backtrace, except when the '
- 'exception is\n'
- '"SystemExit".\n'
- '\n'
- 'Exceptions are identified by class instances. The "except" '
- 'clause is\n'
- 'selected depending on the class of the instance: it must '
- 'reference the\n'
- 'class of the instance or a base class thereof. The instance '
- 'can be\n'
- 'received by the handler and can carry additional information '
- 'about the\n'
- 'exceptional condition.\n'
- '\n'
- 'Note: Exception messages are not part of the Python API. '
- 'Their\n'
- ' contents may change from one version of Python to the next '
- 'without\n'
- ' warning and should not be relied on by code which will run '
- 'under\n'
- ' multiple versions of the interpreter.\n'
- '\n'
- 'See also the description of the "try" statement in section '
- '*The try\n'
- 'statement* and "raise" statement in section *The raise '
- 'statement*.\n'
- '\n'
- '-[ Footnotes ]-\n'
- '\n'
- '[1] This limitation occurs because the code that is executed '
- 'by\n'
- ' these operations is not available at the time the module '
- 'is\n'
- ' compiled.\n',
- 'execmodel': '\n'
- 'Execution model\n'
- '***************\n'
- '\n'
- '\n'
- 'Structure of a programm\n'
- '=======================\n'
- '\n'
- 'A Python program is constructed from code blocks. A *block* '
- 'is a piece\n'
- 'of Python program text that is executed as a unit. The '
- 'following are\n'
- 'blocks: a module, a function body, and a class definition. '
- 'Each\n'
- 'command typed interactively is a block. A script file (a '
- 'file given\n'
- 'as standard input to the interpreter or specified as a '
- 'command line\n'
- 'argument to the interpreter) is a code block. A script '
- 'command (a\n'
- 'command specified on the interpreter command line with the '
- "'**-c**'\n"
- 'option) is a code block. The string argument passed to the '
- 'built-in\n'
- 'functions "eval()" and "exec()" is a code block.\n'
- '\n'
- 'A code block is executed in an *execution frame*. A frame '
- 'contains\n'
- 'some administrative information (used for debugging) and '
- 'determines\n'
- "where and how execution continues after the code block's "
- 'execution has\n'
- 'completed.\n'
- '\n'
- '\n'
- 'Naming and binding\n'
- '==================\n'
- '\n'
- '\n'
- 'Binding of names\n'
- '----------------\n'
- '\n'
- '*Names* refer to objects. Names are introduced by name '
- 'binding\n'
- 'operations.\n'
- '\n'
- 'The following constructs bind names: formal parameters to '
- 'functions,\n'
- '"import" statements, class and function definitions (these '
- 'bind the\n'
- 'class or function name in the defining block), and targets '
- 'that are\n'
- 'identifiers if occurring in an assignment, "for" loop header, '
- 'or after\n'
- '"as" in a "with" statement or "except" clause. The "import" '
- 'statement\n'
- 'of the form "from ... import *" binds all names defined in '
- 'the\n'
- 'imported module, except those beginning with an underscore. '
- 'This form\n'
- 'may only be used at the module level.\n'
- '\n'
- 'A target occurring in a "del" statement is also considered '
- 'bound for\n'
- 'this purpose (though the actual semantics are to unbind the '
- 'name).\n'
- '\n'
- 'Each assignment or import statement occurs within a block '
- 'defined by a\n'
- 'class or function definition or at the module level (the '
- 'top-level\n'
- 'code block).\n'
- '\n'
- 'If a name is bound in a block, it is a local variable of that '
- 'block,\n'
- 'unless declared as "nonlocal" or "global". If a name is '
- 'bound at the\n'
- 'module level, it is a global variable. (The variables of the '
- 'module\n'
- 'code block are local and global.) If a variable is used in a '
- 'code\n'
- 'block but not defined there, it is a *free variable*.\n'
- '\n'
- 'Each occurrence of a name in the program text refers to the '
- '*binding*\n'
- 'of that name established by the following name resolution '
- 'rules.\n'
- '\n'
- '\n'
- 'Resolution of names\n'
- '-------------------\n'
- '\n'
- 'A *scope* defines the visibility of a name within a block. '
- 'If a local\n'
- 'variable is defined in a block, its scope includes that '
- 'block. If the\n'
- 'definition occurs in a function block, the scope extends to '
- 'any blocks\n'
- 'contained within the defining one, unless a contained block '
- 'introduces\n'
- 'a different binding for the name.\n'
- '\n'
- 'When a name is used in a code block, it is resolved using the '
- 'nearest\n'
- 'enclosing scope. The set of all such scopes visible to a '
- 'code block\n'
- "is called the block's *environment*.\n"
- '\n'
- 'When a name is not found at all, a "NameError" exception is '
- 'raised. If\n'
- 'the current scope is a function scope, and the name refers to '
- 'a local\n'
- 'variable that has not yet been bound to a value at the point '
- 'where the\n'
- 'name is used, an "UnboundLocalError" exception is raised.\n'
- '"UnboundLocalError" is a subclass of "NameError".\n'
- '\n'
- 'If a name binding operation occurs anywhere within a code '
- 'block, all\n'
- 'uses of the name within the block are treated as references '
- 'to the\n'
- 'current block. This can lead to errors when a name is used '
- 'within a\n'
- 'block before it is bound. This rule is subtle. Python '
- 'lacks\n'
- 'declarations and allows name binding operations to occur '
- 'anywhere\n'
- 'within a code block. The local variables of a code block can '
- 'be\n'
- 'determined by scanning the entire text of the block for name '
- 'binding\n'
- 'operations.\n'
- '\n'
- 'If the "global" statement occurs within a block, all uses of '
- 'the name\n'
- 'specified in the statement refer to the binding of that name '
- 'in the\n'
- 'top-level namespace. Names are resolved in the top-level '
- 'namespace by\n'
- 'searching the global namespace, i.e. the namespace of the '
- 'module\n'
- 'containing the code block, and the builtins namespace, the '
- 'namespace\n'
- 'of the module "builtins". The global namespace is searched '
- 'first. If\n'
- 'the name is not found there, the builtins namespace is '
- 'searched. The\n'
- '"global" statement must precede all uses of the name.\n'
- '\n'
- 'The "global" statement has the same scope as a name binding '
- 'operation\n'
- 'in the same block. If the nearest enclosing scope for a free '
- 'variable\n'
- 'contains a global statement, the free variable is treated as '
- 'a global.\n'
- '\n'
- 'The "nonlocal" statement causes corresponding names to refer '
- 'to\n'
- 'previously bound variables in the nearest enclosing function '
- 'scope.\n'
- '"SyntaxError" is raised at compile time if the given name '
- 'does not\n'
- 'exist in any enclosing function scope.\n'
- '\n'
- 'The namespace for a module is automatically created the first '
- 'time a\n'
- 'module is imported. The main module for a script is always '
- 'called\n'
- '"__main__".\n'
- '\n'
- 'Class definition blocks and arguments to "exec()" and '
- '"eval()" are\n'
- 'special in the context of name resolution. A class definition '
- 'is an\n'
- 'executable statement that may use and define names. These '
- 'references\n'
- 'follow the normal rules for name resolution with an exception '
- 'that\n'
- 'unbound local variables are looked up in the global '
- 'namespace. The\n'
- 'namespace of the class definition becomes the attribute '
- 'dictionary of\n'
- 'the class. The scope of names defined in a class block is '
- 'limited to\n'
- 'the class block; it does not extend to the code blocks of '
- 'methods --\n'
- 'this includes comprehensions and generator expressions since '
- 'they are\n'
- 'implemented using a function scope. This means that the '
- 'following\n'
- 'will fail:\n'
- '\n'
- ' class A:\n'
- ' a = 42\n'
- ' b = list(a + i for i in range(10))\n'
- '\n'
- '\n'
- 'Builtins and restricted execution\n'
- '---------------------------------\n'
- '\n'
- 'The builtins namespace associated with the execution of a '
- 'code block\n'
- 'is actually found by looking up the name "__builtins__" in '
- 'its global\n'
- 'namespace; this should be a dictionary or a module (in the '
- 'latter case\n'
- "the module's dictionary is used). By default, when in the "
- '"__main__"\n'
- 'module, "__builtins__" is the built-in module "builtins"; '
- 'when in any\n'
- 'other module, "__builtins__" is an alias for the dictionary '
- 'of the\n'
- '"builtins" module itself. "__builtins__" can be set to a '
- 'user-created\n'
- 'dictionary to create a weak form of restricted execution.\n'
- '\n'
- '**CPython implementation detail:** Users should not touch\n'
- '"__builtins__"; it is strictly an implementation detail. '
- 'Users\n'
- 'wanting to override values in the builtins namespace should '
- '"import"\n'
- 'the "builtins" module and modify its attributes '
- 'appropriately.\n'
- '\n'
- '\n'
- 'Interaction with dynamic features\n'
- '---------------------------------\n'
- '\n'
- 'Name resolution of free variables occurs at runtime, not at '
- 'compile\n'
- 'time. This means that the following code will print 42:\n'
- '\n'
- ' i = 10\n'
- ' def f():\n'
- ' print(i)\n'
- ' i = 42\n'
- ' f()\n'
- '\n'
- 'There are several cases where Python statements are illegal '
- 'when used\n'
- 'in conjunction with nested scopes that contain free '
- 'variables.\n'
- '\n'
- 'If a variable is referenced in an enclosing scope, it is '
- 'illegal to\n'
- 'delete the name. An error will be reported at compile time.\n'
- '\n'
- 'The "eval()" and "exec()" functions do not have access to the '
- 'full\n'
- 'environment for resolving names. Names may be resolved in '
- 'the local\n'
- 'and global namespaces of the caller. Free variables are not '
- 'resolved\n'
- 'in the nearest enclosing namespace, but in the global '
- 'namespace. [1]\n'
- 'The "exec()" and "eval()" functions have optional arguments '
- 'to\n'
- 'override the global and local namespace. If only one '
- 'namespace is\n'
- 'specified, it is used for both.\n'
- '\n'
- '\n'
- 'Exceptions\n'
- '==========\n'
- '\n'
- 'Exceptions are a means of breaking out of the normal flow of '
- 'control\n'
- 'of a code block in order to handle errors or other '
- 'exceptional\n'
- 'conditions. An exception is *raised* at the point where the '
- 'error is\n'
- 'detected; it may be *handled* by the surrounding code block '
- 'or by any\n'
- 'code block that directly or indirectly invoked the code block '
- 'where\n'
- 'the error occurred.\n'
- '\n'
- 'The Python interpreter raises an exception when it detects a '
- 'run-time\n'
- 'error (such as division by zero). A Python program can also\n'
- 'explicitly raise an exception with the "raise" statement. '
- 'Exception\n'
- 'handlers are specified with the "try" ... "except" '
- 'statement. The\n'
- '"finally" clause of such a statement can be used to specify '
- 'cleanup\n'
- 'code which does not handle the exception, but is executed '
- 'whether an\n'
- 'exception occurred or not in the preceding code.\n'
- '\n'
- 'Python uses the "termination" model of error handling: an '
- 'exception\n'
- 'handler can find out what happened and continue execution at '
- 'an outer\n'
- 'level, but it cannot repair the cause of the error and retry '
- 'the\n'
- 'failing operation (except by re-entering the offending piece '
- 'of code\n'
- 'from the top).\n'
- '\n'
- 'When an exception is not handled at all, the interpreter '
- 'terminates\n'
- 'execution of the program, or returns to its interactive main '
- 'loop. In\n'
- 'either case, it prints a stack backtrace, except when the '
- 'exception is\n'
- '"SystemExit".\n'
- '\n'
- 'Exceptions are identified by class instances. The "except" '
- 'clause is\n'
- 'selected depending on the class of the instance: it must '
- 'reference the\n'
- 'class of the instance or a base class thereof. The instance '
- 'can be\n'
- 'received by the handler and can carry additional information '
- 'about the\n'
- 'exceptional condition.\n'
- '\n'
- 'Note: Exception messages are not part of the Python API. '
- 'Their\n'
- ' contents may change from one version of Python to the next '
- 'without\n'
- ' warning and should not be relied on by code which will run '
- 'under\n'
- ' multiple versions of the interpreter.\n'
- '\n'
- 'See also the description of the "try" statement in section '
- '*The try\n'
- 'statement* and "raise" statement in section *The raise '
- 'statement*.\n'
- '\n'
- '-[ Footnotes ]-\n'
- '\n'
- '[1] This limitation occurs because the code that is executed '
- 'by\n'
- ' these operations is not available at the time the module '
- 'is\n'
- ' compiled.\n',
- 'exprlists': '\n'
- 'Expression lists\n'
- '****************\n'
- '\n'
- ' expression_list ::= expression ( "," expression )* [","]\n'
- '\n'
- 'An expression list containing at least one comma yields a '
- 'tuple. The\n'
- 'length of the tuple is the number of expressions in the '
- 'list. The\n'
- 'expressions are evaluated from left to right.\n'
- '\n'
- 'The trailing comma is required only to create a single tuple '
- '(a.k.a. a\n'
- '*singleton*); it is optional in all other cases. A single '
- 'expression\n'
- "without a trailing comma doesn't create a tuple, but rather "
- 'yields the\n'
- 'value of that expression. (To create an empty tuple, use an '
- 'empty pair\n'
- 'of parentheses: "()".)\n',
- 'floating': '\n'
- 'Floating point literals\n'
- '***********************\n'
- '\n'
- 'Floating point literals are described by the following '
- 'lexical\n'
- 'definitions:\n'
- '\n'
- ' floatnumber ::= pointfloat | exponentfloat\n'
- ' pointfloat ::= [intpart] fraction | intpart "."\n'
- ' exponentfloat ::= (intpart | pointfloat) exponent\n'
- ' intpart ::= digit+\n'
- ' fraction ::= "." digit+\n'
- ' exponent ::= ("e" | "E") ["+" | "-"] digit+\n'
- '\n'
- 'Note that the integer and exponent parts are always '
- 'interpreted using\n'
- 'radix 10. For example, "077e010" is legal, and denotes the '
- 'same number\n'
- 'as "77e10". The allowed range of floating point literals is\n'
- 'implementation-dependent. Some examples of floating point '
- 'literals:\n'
- '\n'
- ' 3.14 10. .001 1e100 3.14e-10 0e0\n'
- '\n'
- 'Note that numeric literals do not include a sign; a phrase '
- 'like "-1"\n'
- 'is actually an expression composed of the unary operator "-" '
- 'and the\n'
- 'literal "1".\n',
- 'for': '\n'
- 'The "for" statement\n'
- '*******************\n'
- '\n'
- 'The "for" statement is used to iterate over the elements of a '
- 'sequence\n'
- '(such as a string, tuple or list) or other iterable object:\n'
- '\n'
- ' for_stmt ::= "for" target_list "in" expression_list ":" suite\n'
- ' ["else" ":" suite]\n'
- '\n'
- 'The expression list is evaluated once; it should yield an iterable\n'
- 'object. An iterator is created for the result of the\n'
- '"expression_list". The suite is then executed once for each item\n'
- 'provided by the iterator, in the order returned by the iterator. '
- 'Each\n'
- 'item in turn is assigned to the target list using the standard '
- 'rules\n'
- 'for assignments (see *Assignment statements*), and then the suite '
- 'is\n'
- 'executed. When the items are exhausted (which is immediately when '
- 'the\n'
- 'sequence is empty or an iterator raises a "StopIteration" '
- 'exception),\n'
- 'the suite in the "else" clause, if present, is executed, and the '
- 'loop\n'
- 'terminates.\n'
- '\n'
- 'A "break" statement executed in the first suite terminates the '
- 'loop\n'
- 'without executing the "else" clause\'s suite. A "continue" '
- 'statement\n'
- 'executed in the first suite skips the rest of the suite and '
- 'continues\n'
- 'with the next item, or with the "else" clause if there is no next\n'
- 'item.\n'
- '\n'
- 'The for-loop makes assignments to the variables(s) in the target '
- 'list.\n'
- 'This overwrites all previous assignments to those variables '
- 'including\n'
- 'those made in the suite of the for-loop:\n'
- '\n'
- ' for i in range(10):\n'
- ' print(i)\n'
- ' i = 5 # this will not affect the for-loop\n'
- ' # because i will be overwritten with the '
- 'next\n'
- ' # index in the range\n'
- '\n'
- 'Names in the target list are not deleted when the loop is '
- 'finished,\n'
- 'but if the sequence is empty, they will not have been assigned to '
- 'at\n'
- 'all by the loop. Hint: the built-in function "range()" returns an\n'
- "iterator of integers suitable to emulate the effect of Pascal's "
- '"for i\n'
- ':= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, '
- '2]".\n'
- '\n'
- 'Note: There is a subtlety when the sequence is being modified by '
- 'the\n'
- ' loop (this can only occur for mutable sequences, i.e. lists). '
- 'An\n'
- ' internal counter is used to keep track of which item is used '
- 'next,\n'
- ' and this is incremented on each iteration. When this counter '
- 'has\n'
- ' reached the length of the sequence the loop terminates. This '
- 'means\n'
- ' that if the suite deletes the current (or a previous) item from '
- 'the\n'
- ' sequence, the next item will be skipped (since it gets the index '
- 'of\n'
- ' the current item which has already been treated). Likewise, if '
- 'the\n'
- ' suite inserts an item in the sequence before the current item, '
- 'the\n'
- ' current item will be treated again the next time through the '
- 'loop.\n'
- ' This can lead to nasty bugs that can be avoided by making a\n'
- ' temporary copy using a slice of the whole sequence, e.g.,\n'
- '\n'
- ' for x in a[:]:\n'
- ' if x < 0: a.remove(x)\n',
- 'formatstrings': '\n'
- 'Format String Syntax\n'
- '********************\n'
- '\n'
- 'The "str.format()" method and the "Formatter" class share '
- 'the same\n'
- 'syntax for format strings (although in the case of '
- '"Formatter",\n'
- 'subclasses can define their own format string syntax).\n'
- '\n'
- 'Format strings contain "replacement fields" surrounded by '
- 'curly braces\n'
- '"{}". Anything that is not contained in braces is '
- 'considered literal\n'
- 'text, which is copied unchanged to the output. If you '
- 'need to include\n'
- 'a brace character in the literal text, it can be escaped '
- 'by doubling:\n'
- '"{{" and "}}".\n'
- '\n'
- 'The grammar for a replacement field is as follows:\n'
- '\n'
- ' replacement_field ::= "{" [field_name] ["!" '
- 'conversion] [":" format_spec] "}"\n'
- ' field_name ::= arg_name ("." attribute_name '
- '| "[" element_index "]")*\n'
- ' arg_name ::= [identifier | integer]\n'
- ' attribute_name ::= identifier\n'
- ' element_index ::= integer | index_string\n'
- ' index_string ::= <any source character except '
- '"]"> +\n'
- ' conversion ::= "r" | "s" | "a"\n'
- ' format_spec ::= <described in the next '
- 'section>\n'
- '\n'
- 'In less formal terms, the replacement field can start '
- 'with a\n'
- '*field_name* that specifies the object whose value is to '
- 'be formatted\n'
- 'and inserted into the output instead of the replacement '
- 'field. The\n'
- '*field_name* is optionally followed by a *conversion* '
- 'field, which is\n'
- 'preceded by an exclamation point "\'!\'", and a '
- '*format_spec*, which is\n'
- 'preceded by a colon "\':\'". These specify a non-default '
- 'format for the\n'
- 'replacement value.\n'
- '\n'
- 'See also the *Format Specification Mini-Language* '
- 'section.\n'
- '\n'
- 'The *field_name* itself begins with an *arg_name* that is '
- 'either a\n'
- "number or a keyword. If it's a number, it refers to a "
- 'positional\n'
- "argument, and if it's a keyword, it refers to a named "
- 'keyword\n'
- 'argument. If the numerical arg_names in a format string '
- 'are 0, 1, 2,\n'
- '... in sequence, they can all be omitted (not just some) '
- 'and the\n'
- 'numbers 0, 1, 2, ... will be automatically inserted in '
- 'that order.\n'
- 'Because *arg_name* is not quote-delimited, it is not '
- 'possible to\n'
- 'specify arbitrary dictionary keys (e.g., the strings '
- '"\'10\'" or\n'
- '"\':-]\'") within a format string. The *arg_name* can be '
- 'followed by any\n'
- 'number of index or attribute expressions. An expression '
- 'of the form\n'
- '"\'.name\'" selects the named attribute using '
- '"getattr()", while an\n'
- 'expression of the form "\'[index]\'" does an index lookup '
- 'using\n'
- '"__getitem__()".\n'
- '\n'
- 'Changed in version 3.1: The positional argument '
- 'specifiers can be\n'
- 'omitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n'
- '\n'
- 'Some simple format string examples:\n'
- '\n'
- ' "First, thou shalt count to {0}" # References first '
- 'positional argument\n'
- ' "Bring me a {}" # Implicitly '
- 'references the first positional argument\n'
- ' "From {} to {}" # Same as "From {0} '
- 'to {1}"\n'
- ' "My quest is {name}" # References keyword '
- "argument 'name'\n"
- ' "Weight in tons {0.weight}" # \'weight\' '
- 'attribute of first positional arg\n'
- ' "Units destroyed: {players[0]}" # First element of '
- "keyword argument 'players'.\n"
- '\n'
- 'The *conversion* field causes a type coercion before '
- 'formatting.\n'
- 'Normally, the job of formatting a value is done by the '
- '"__format__()"\n'
- 'method of the value itself. However, in some cases it is '
- 'desirable to\n'
- 'force a type to be formatted as a string, overriding its '
- 'own\n'
- 'definition of formatting. By converting the value to a '
- 'string before\n'
- 'calling "__format__()", the normal formatting logic is '
- 'bypassed.\n'
- '\n'
- 'Three conversion flags are currently supported: "\'!s\'" '
- 'which calls\n'
- '"str()" on the value, "\'!r\'" which calls "repr()" and '
- '"\'!a\'" which\n'
- 'calls "ascii()".\n'
- '\n'
- 'Some examples:\n'
- '\n'
- ' "Harold\'s a clever {0!s}" # Calls str() on the '
- 'argument first\n'
- ' "Bring out the holy {name!r}" # Calls repr() on the '
- 'argument first\n'
- ' "More {!a}" # Calls ascii() on '
- 'the argument first\n'
- '\n'
- 'The *format_spec* field contains a specification of how '
- 'the value\n'
- 'should be presented, including such details as field '
- 'width, alignment,\n'
- 'padding, decimal precision and so on. Each value type '
- 'can define its\n'
- 'own "formatting mini-language" or interpretation of the '
- '*format_spec*.\n'
- '\n'
- 'Most built-in types support a common formatting '
- 'mini-language, which\n'
- 'is described in the next section.\n'
- '\n'
- 'A *format_spec* field can also include nested replacement '
- 'fields\n'
- 'within it. These nested replacement fields can contain '
- 'only a field\n'
- 'name; conversion flags and format specifications are not '
- 'allowed. The\n'
- 'replacement fields within the format_spec are substituted '
- 'before the\n'
- '*format_spec* string is interpreted. This allows the '
- 'formatting of a\n'
- 'value to be dynamically specified.\n'
- '\n'
- 'See the *Format examples* section for some examples.\n'
- '\n'
- '\n'
- 'Format Specification Mini-Language\n'
- '==================================\n'
- '\n'
- '"Format specifications" are used within replacement '
- 'fields contained\n'
- 'within a format string to define how individual values '
- 'are presented\n'
- '(see *Format String Syntax*). They can also be passed '
- 'directly to the\n'
- 'built-in "format()" function. Each formattable type may '
- 'define how\n'
- 'the format specification is to be interpreted.\n'
- '\n'
- 'Most built-in types implement the following options for '
- 'format\n'
- 'specifications, although some of the formatting options '
- 'are only\n'
- 'supported by the numeric types.\n'
- '\n'
- 'A general convention is that an empty format string '
- '("""") produces\n'
- 'the same result as if you had called "str()" on the '
- 'value. A non-empty\n'
- 'format string typically modifies the result.\n'
- '\n'
- 'The general form of a *standard format specifier* is:\n'
- '\n'
- ' format_spec ::= '
- '[[fill]align][sign][#][0][width][,][.precision][type]\n'
- ' fill ::= <any character>\n'
- ' align ::= "<" | ">" | "=" | "^"\n'
- ' sign ::= "+" | "-" | " "\n'
- ' width ::= integer\n'
- ' precision ::= integer\n'
- ' type ::= "b" | "c" | "d" | "e" | "E" | "f" | '
- '"F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n'
- '\n'
- 'If a valid *align* value is specified, it can be preceded '
- 'by a *fill*\n'
- 'character that can be any character and defaults to a '
- 'space if\n'
- 'omitted. Note that it is not possible to use "{" and "}" '
- 'as *fill*\n'
- 'char while using the "str.format()" method; this '
- 'limitation however\n'
- 'doesn\'t affect the "format()" function.\n'
- '\n'
- 'The meaning of the various alignment options is as '
- 'follows:\n'
- '\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | Option | '
- 'Meaning '
- '|\n'
- ' '
- '+===========+============================================================+\n'
- ' | "\'<\'" | Forces the field to be left-aligned '
- 'within the available |\n'
- ' | | space (this is the default for most '
- 'objects). |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'>\'" | Forces the field to be right-aligned '
- 'within the available |\n'
- ' | | space (this is the default for '
- 'numbers). |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'=\'" | Forces the padding to be placed after '
- 'the sign (if any) |\n'
- ' | | but before the digits. This is used for '
- 'printing fields |\n'
- " | | in the form '+000000120'. This alignment "
- 'option is only |\n'
- ' | | valid for numeric '
- 'types. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'^\'" | Forces the field to be centered within '
- 'the available |\n'
- ' | | '
- 'space. '
- '|\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- '\n'
- 'Note that unless a minimum field width is defined, the '
- 'field width\n'
- 'will always be the same size as the data to fill it, so '
- 'that the\n'
- 'alignment option has no meaning in this case.\n'
- '\n'
- 'The *sign* option is only valid for number types, and can '
- 'be one of\n'
- 'the following:\n'
- '\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | Option | '
- 'Meaning '
- '|\n'
- ' '
- '+===========+============================================================+\n'
- ' | "\'+\'" | indicates that a sign should be used '
- 'for both positive as |\n'
- ' | | well as negative '
- 'numbers. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'-\'" | indicates that a sign should be used '
- 'only for negative |\n'
- ' | | numbers (this is the default '
- 'behavior). |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | space | indicates that a leading space should be '
- 'used on positive |\n'
- ' | | numbers, and a minus sign on negative '
- 'numbers. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- '\n'
- 'The "\'#\'" option causes the "alternate form" to be used '
- 'for the\n'
- 'conversion. The alternate form is defined differently '
- 'for different\n'
- 'types. This option is only valid for integer, float, '
- 'complex and\n'
- 'Decimal types. For integers, when binary, octal, or '
- 'hexadecimal output\n'
- 'is used, this option adds the prefix respective "\'0b\'", '
- '"\'0o\'", or\n'
- '"\'0x\'" to the output value. For floats, complex and '
- 'Decimal the\n'
- 'alternate form causes the result of the conversion to '
- 'always contain a\n'
- 'decimal-point character, even if no digits follow it. '
- 'Normally, a\n'
- 'decimal-point character appears in the result of these '
- 'conversions\n'
- 'only if a digit follows it. In addition, for "\'g\'" and '
- '"\'G\'"\n'
- 'conversions, trailing zeros are not removed from the '
- 'result.\n'
- '\n'
- 'The "\',\'" option signals the use of a comma for a '
- 'thousands separator.\n'
- 'For a locale aware separator, use the "\'n\'" integer '
- 'presentation type\n'
- 'instead.\n'
- '\n'
- 'Changed in version 3.1: Added the "\',\'" option (see '
- 'also **PEP 378**).\n'
- '\n'
- '*width* is a decimal integer defining the minimum field '
- 'width. If not\n'
- 'specified, then the field width will be determined by the '
- 'content.\n'
- '\n'
- 'Preceding the *width* field by a zero ("\'0\'") character '
- 'enables sign-\n'
- 'aware zero-padding for numeric types. This is equivalent '
- 'to a *fill*\n'
- 'character of "\'0\'" with an *alignment* type of '
- '"\'=\'".\n'
- '\n'
- 'The *precision* is a decimal number indicating how many '
- 'digits should\n'
- 'be displayed after the decimal point for a floating point '
- 'value\n'
- 'formatted with "\'f\'" and "\'F\'", or before and after '
- 'the decimal point\n'
- 'for a floating point value formatted with "\'g\'" or '
- '"\'G\'". For non-\n'
- 'number types the field indicates the maximum field size - '
- 'in other\n'
- 'words, how many characters will be used from the field '
- 'content. The\n'
- '*precision* is not allowed for integer values.\n'
- '\n'
- 'Finally, the *type* determines how the data should be '
- 'presented.\n'
- '\n'
- 'The available string presentation types are:\n'
- '\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | Type | '
- 'Meaning '
- '|\n'
- ' '
- '+===========+============================================================+\n'
- ' | "\'s\'" | String format. This is the default '
- 'type for strings and |\n'
- ' | | may be '
- 'omitted. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | None | The same as '
- '"\'s\'". |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- '\n'
- 'The available integer presentation types are:\n'
- '\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | Type | '
- 'Meaning '
- '|\n'
- ' '
- '+===========+============================================================+\n'
- ' | "\'b\'" | Binary format. Outputs the number in '
- 'base 2. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'c\'" | Character. Converts the integer to the '
- 'corresponding |\n'
- ' | | unicode character before '
- 'printing. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'d\'" | Decimal Integer. Outputs the number in '
- 'base 10. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'o\'" | Octal format. Outputs the number in '
- 'base 8. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'x\'" | Hex format. Outputs the number in base '
- '16, using lower- |\n'
- ' | | case letters for the digits above '
- '9. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'X\'" | Hex format. Outputs the number in base '
- '16, using upper- |\n'
- ' | | case letters for the digits above '
- '9. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'n\'" | Number. This is the same as "\'d\'", '
- 'except that it uses the |\n'
- ' | | current locale setting to insert the '
- 'appropriate number |\n'
- ' | | separator '
- 'characters. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | None | The same as '
- '"\'d\'". |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- '\n'
- 'In addition to the above presentation types, integers can '
- 'be formatted\n'
- 'with the floating point presentation types listed below '
- '(except "\'n\'"\n'
- 'and None). When doing so, "float()" is used to convert '
- 'the integer to\n'
- 'a floating point number before formatting.\n'
- '\n'
- 'The available presentation types for floating point and '
- 'decimal values\n'
- 'are:\n'
- '\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | Type | '
- 'Meaning '
- '|\n'
- ' '
- '+===========+============================================================+\n'
- ' | "\'e\'" | Exponent notation. Prints the number '
- 'in scientific |\n'
- " | | notation using the letter 'e' to "
- 'indicate the exponent. |\n'
- ' | | The default precision is '
- '"6". |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'E\'" | Exponent notation. Same as "\'e\'" '
- 'except it uses an upper |\n'
- " | | case 'E' as the separator "
- 'character. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'f\'" | Fixed point. Displays the number as a '
- 'fixed-point number. |\n'
- ' | | The default precision is '
- '"6". |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'F\'" | Fixed point. Same as "\'f\'", but '
- 'converts "nan" to "NAN" |\n'
- ' | | and "inf" to '
- '"INF". |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'g\'" | General format. For a given precision '
- '"p >= 1", this |\n'
- ' | | rounds the number to "p" significant '
- 'digits and then |\n'
- ' | | formats the result in either fixed-point '
- 'format or in |\n'
- ' | | scientific notation, depending on its '
- 'magnitude. The |\n'
- ' | | precise rules are as follows: suppose '
- 'that the result |\n'
- ' | | formatted with presentation type "\'e\'" '
- 'and precision "p-1" |\n'
- ' | | would have exponent "exp". Then if "-4 '
- '<= exp < p", the |\n'
- ' | | number is formatted with presentation '
- 'type "\'f\'" and |\n'
- ' | | precision "p-1-exp". Otherwise, the '
- 'number is formatted |\n'
- ' | | with presentation type "\'e\'" and '
- 'precision "p-1". In both |\n'
- ' | | cases insignificant trailing zeros are '
- 'removed from the |\n'
- ' | | significand, and the decimal point is '
- 'also removed if |\n'
- ' | | there are no remaining digits following '
- 'it. Positive and |\n'
- ' | | negative infinity, positive and negative '
- 'zero, and nans, |\n'
- ' | | are formatted as "inf", "-inf", "0", '
- '"-0" and "nan" |\n'
- ' | | respectively, regardless of the '
- 'precision. A precision of |\n'
- ' | | "0" is treated as equivalent to a '
- 'precision of "1". The |\n'
- ' | | default precision is '
- '"6". |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'G\'" | General format. Same as "\'g\'" except '
- 'switches to "\'E\'" if |\n'
- ' | | the number gets too large. The '
- 'representations of infinity |\n'
- ' | | and NaN are uppercased, '
- 'too. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'n\'" | Number. This is the same as "\'g\'", '
- 'except that it uses the |\n'
- ' | | current locale setting to insert the '
- 'appropriate number |\n'
- ' | | separator '
- 'characters. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | "\'%\'" | Percentage. Multiplies the number by '
- '100 and displays in |\n'
- ' | | fixed ("\'f\'") format, followed by a '
- 'percent sign. |\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- ' | None | Similar to "\'g\'", except that '
- 'fixed-point notation, when |\n'
- ' | | used, has at least one digit past the '
- 'decimal point. The |\n'
- ' | | default precision is as high as needed '
- 'to represent the |\n'
- ' | | particular value. The overall effect is '
- 'to match the |\n'
- ' | | output of "str()" as altered by the '
- 'other format |\n'
- ' | | '
- 'modifiers. '
- '|\n'
- ' '
- '+-----------+------------------------------------------------------------+\n'
- '\n'
- '\n'
- 'Format examples\n'
- '===============\n'
- '\n'
- 'This section contains examples of the new format syntax '
- 'and comparison\n'
- 'with the old "%"-formatting.\n'
- '\n'
- 'In most of the cases the syntax is similar to the old '
- '"%"-formatting,\n'
- 'with the addition of the "{}" and with ":" used instead '
- 'of "%". For\n'
- 'example, "\'%03.2f\'" can be translated to '
- '"\'{:03.2f}\'".\n'
- '\n'
- 'The new format syntax also supports new and different '
- 'options, shown\n'
- 'in the follow examples.\n'
- '\n'
- 'Accessing arguments by position:\n'
- '\n'
- " >>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n"
- " 'a, b, c'\n"
- " >>> '{}, {}, {}'.format('a', 'b', 'c') # 3.1+ only\n"
- " 'a, b, c'\n"
- " >>> '{2}, {1}, {0}'.format('a', 'b', 'c')\n"
- " 'c, b, a'\n"
- " >>> '{2}, {1}, {0}'.format(*'abc') # unpacking "
- 'argument sequence\n'
- " 'c, b, a'\n"
- " >>> '{0}{1}{0}'.format('abra', 'cad') # arguments' "
- 'indices can be repeated\n'
- " 'abracadabra'\n"
- '\n'
- 'Accessing arguments by name:\n'
- '\n'
- " >>> 'Coordinates: {latitude}, "
- "{longitude}'.format(latitude='37.24N', "
- "longitude='-115.81W')\n"
- " 'Coordinates: 37.24N, -115.81W'\n"
- " >>> coord = {'latitude': '37.24N', 'longitude': "
- "'-115.81W'}\n"
- " >>> 'Coordinates: {latitude}, "
- "{longitude}'.format(**coord)\n"
- " 'Coordinates: 37.24N, -115.81W'\n"
- '\n'
- "Accessing arguments' attributes:\n"
- '\n'
- ' >>> c = 3-5j\n'
- " >>> ('The complex number {0} is formed from the real "
- "part {0.real} '\n"
- " ... 'and the imaginary part {0.imag}.').format(c)\n"
- " 'The complex number (3-5j) is formed from the real "
- "part 3.0 and the imaginary part -5.0.'\n"
- ' >>> class Point:\n'
- ' ... def __init__(self, x, y):\n'
- ' ... self.x, self.y = x, y\n'
- ' ... def __str__(self):\n'
- " ... return 'Point({self.x}, "
- "{self.y})'.format(self=self)\n"
- ' ...\n'
- ' >>> str(Point(4, 2))\n'
- " 'Point(4, 2)'\n"
- '\n'
- "Accessing arguments' items:\n"
- '\n'
- ' >>> coord = (3, 5)\n'
- " >>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n"
- " 'X: 3; Y: 5'\n"
- '\n'
- 'Replacing "%s" and "%r":\n'
- '\n'
- ' >>> "repr() shows quotes: {!r}; str() doesn\'t: '
- '{!s}".format(\'test1\', \'test2\')\n'
- ' "repr() shows quotes: \'test1\'; str() doesn\'t: '
- 'test2"\n'
- '\n'
- 'Aligning the text and specifying a width:\n'
- '\n'
- " >>> '{:<30}'.format('left aligned')\n"
- " 'left aligned '\n"
- " >>> '{:>30}'.format('right aligned')\n"
- " ' right aligned'\n"
- " >>> '{:^30}'.format('centered')\n"
- " ' centered '\n"
- " >>> '{:*^30}'.format('centered') # use '*' as a fill "
- 'char\n'
- " '***********centered***********'\n"
- '\n'
- 'Replacing "%+f", "%-f", and "% f" and specifying a sign:\n'
- '\n'
- " >>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it "
- 'always\n'
- " '+3.140000; -3.140000'\n"
- " >>> '{: f}; {: f}'.format(3.14, -3.14) # show a space "
- 'for positive numbers\n'
- " ' 3.140000; -3.140000'\n"
- " >>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only "
- "the minus -- same as '{:f}; {:f}'\n"
- " '3.140000; -3.140000'\n"
- '\n'
- 'Replacing "%x" and "%o" and converting the value to '
- 'different bases:\n'
- '\n'
- ' >>> # format also supports binary numbers\n'
- ' >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: '
- '{0:b}".format(42)\n'
- " 'int: 42; hex: 2a; oct: 52; bin: 101010'\n"
- ' >>> # with 0x, 0o, or 0b as prefix:\n'
- ' >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: '
- '{0:#b}".format(42)\n'
- " 'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'\n"
- '\n'
- 'Using the comma as a thousands separator:\n'
- '\n'
- " >>> '{:,}'.format(1234567890)\n"
- " '1,234,567,890'\n"
- '\n'
- 'Expressing a percentage:\n'
- '\n'
- ' >>> points = 19\n'
- ' >>> total = 22\n'
- " >>> 'Correct answers: {:.2%}'.format(points/total)\n"
- " 'Correct answers: 86.36%'\n"
- '\n'
- 'Using type-specific formatting:\n'
- '\n'
- ' >>> import datetime\n'
- ' >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n'
- " >>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n"
- " '2010-07-04 12:15:58'\n"
- '\n'
- 'Nesting arguments and more complex examples:\n'
- '\n'
- " >>> for align, text in zip('<^>', ['left', 'center', "
- "'right']):\n"
- " ... '{0:{fill}{align}16}'.format(text, fill=align, "
- 'align=align)\n'
- ' ...\n'
- " 'left<<<<<<<<<<<<'\n"
- " '^^^^^center^^^^^'\n"
- " '>>>>>>>>>>>right'\n"
- ' >>>\n'
- ' >>> octets = [192, 168, 0, 1]\n'
- " >>> '{:02X}{:02X}{:02X}{:02X}'.format(*octets)\n"
- " 'C0A80001'\n"
- ' >>> int(_, 16)\n'
- ' 3232235521\n'
- ' >>>\n'
- ' >>> width = 5\n'
- ' >>> for num in range(5,12): #doctest: '
- '+NORMALIZE_WHITESPACE\n'
- " ... for base in 'dXob':\n"
- " ... print('{0:{width}{base}}'.format(num, "
- "base=base, width=width), end=' ')\n"
- ' ... print()\n'
- ' ...\n'
- ' 5 5 5 101\n'
- ' 6 6 6 110\n'
- ' 7 7 7 111\n'
- ' 8 8 10 1000\n'
- ' 9 9 11 1001\n'
- ' 10 A 12 1010\n'
- ' 11 B 13 1011\n',
- 'function': '\n'
- 'Function definitions\n'
- '********************\n'
- '\n'
- 'A function definition defines a user-defined function object '
- '(see\n'
- 'section *The standard type hierarchy*):\n'
- '\n'
- ' funcdef ::= [decorators] "def" funcname "(" '
- '[parameter_list] ")" ["->" expression] ":" suite\n'
- ' decorators ::= decorator+\n'
- ' decorator ::= "@" dotted_name ["(" [parameter_list '
- '[","]] ")"] NEWLINE\n'
- ' dotted_name ::= identifier ("." identifier)*\n'
- ' parameter_list ::= (defparameter ",")*\n'
- ' | "*" [parameter] ("," defparameter)* '
- '["," "**" parameter]\n'
- ' | "**" parameter\n'
- ' | defparameter [","] )\n'
- ' parameter ::= identifier [":" expression]\n'
- ' defparameter ::= parameter ["=" expression]\n'
- ' funcname ::= identifier\n'
- '\n'
- 'A function definition is an executable statement. Its '
- 'execution binds\n'
- 'the function name in the current local namespace to a function '
- 'object\n'
- '(a wrapper around the executable code for the function). '
- 'This\n'
- 'function object contains a reference to the current global '
- 'namespace\n'
- 'as the global namespace to be used when the function is '
- 'called.\n'
- '\n'
- 'The function definition does not execute the function body; '
- 'this gets\n'
- 'executed only when the function is called. [3]\n'
- '\n'
- 'A function definition may be wrapped by one or more '
- '*decorator*\n'
- 'expressions. Decorator expressions are evaluated when the '
- 'function is\n'
- 'defined, in the scope that contains the function definition. '
- 'The\n'
- 'result must be a callable, which is invoked with the function '
- 'object\n'
- 'as the only argument. The returned value is bound to the '
- 'function name\n'
- 'instead of the function object. Multiple decorators are '
- 'applied in\n'
- 'nested fashion. For example, the following code\n'
- '\n'
- ' @f1(arg)\n'
- ' @f2\n'
- ' def func(): pass\n'
- '\n'
- 'is equivalent to\n'
- '\n'
- ' def func(): pass\n'
- ' func = f1(arg)(f2(func))\n'
- '\n'
- 'When one or more *parameters* have the form *parameter* "="\n'
- '*expression*, the function is said to have "default parameter '
- 'values."\n'
- 'For a parameter with a default value, the corresponding '
- '*argument* may\n'
- "be omitted from a call, in which case the parameter's default "
- 'value is\n'
- 'substituted. If a parameter has a default value, all '
- 'following\n'
- 'parameters up until the ""*"" must also have a default value '
- '--- this\n'
- 'is a syntactic restriction that is not expressed by the '
- 'grammar.\n'
- '\n'
- '**Default parameter values are evaluated from left to right '
- 'when the\n'
- 'function definition is executed.** This means that the '
- 'expression is\n'
- 'evaluated once, when the function is defined, and that the '
- 'same "pre-\n'
- 'computed" value is used for each call. This is especially '
- 'important\n'
- 'to understand when a default parameter is a mutable object, '
- 'such as a\n'
- 'list or a dictionary: if the function modifies the object '
- '(e.g. by\n'
- 'appending an item to a list), the default value is in effect '
- 'modified.\n'
- 'This is generally not what was intended. A way around this is '
- 'to use\n'
- '"None" as the default, and explicitly test for it in the body '
- 'of the\n'
- 'function, e.g.:\n'
- '\n'
- ' def whats_on_the_telly(penguin=None):\n'
- ' if penguin is None:\n'
- ' penguin = []\n'
- ' penguin.append("property of the zoo")\n'
- ' return penguin\n'
- '\n'
- 'Function call semantics are described in more detail in '
- 'section\n'
- '*Calls*. A function call always assigns values to all '
- 'parameters\n'
- 'mentioned in the parameter list, either from position '
- 'arguments, from\n'
- 'keyword arguments, or from default values. If the form\n'
- '""*identifier"" is present, it is initialized to a tuple '
- 'receiving any\n'
- 'excess positional parameters, defaulting to the empty tuple. '
- 'If the\n'
- 'form ""**identifier"" is present, it is initialized to a new\n'
- 'dictionary receiving any excess keyword arguments, defaulting '
- 'to a new\n'
- 'empty dictionary. Parameters after ""*"" or ""*identifier"" '
- 'are\n'
- 'keyword-only parameters and may only be passed used keyword '
- 'arguments.\n'
- '\n'
- 'Parameters may have annotations of the form "": expression"" '
- 'following\n'
- 'the parameter name. Any parameter may have an annotation even '
- 'those\n'
- 'of the form "*identifier" or "**identifier". Functions may '
- 'have\n'
- '"return" annotation of the form ""-> expression"" after the '
- 'parameter\n'
- 'list. These annotations can be any valid Python expression '
- 'and are\n'
- 'evaluated when the function definition is executed. '
- 'Annotations may\n'
- 'be evaluated in a different order than they appear in the '
- 'source code.\n'
- 'The presence of annotations does not change the semantics of '
- 'a\n'
- 'function. The annotation values are available as values of a\n'
- "dictionary keyed by the parameters' names in the "
- '"__annotations__"\n'
- 'attribute of the function object.\n'
- '\n'
- 'It is also possible to create anonymous functions (functions '
- 'not bound\n'
- 'to a name), for immediate use in expressions. This uses '
- 'lambda\n'
- 'expressions, described in section *Lambdas*. Note that the '
- 'lambda\n'
- 'expression is merely a shorthand for a simplified function '
- 'definition;\n'
- 'a function defined in a ""def"" statement can be passed around '
- 'or\n'
- 'assigned to another name just like a function defined by a '
- 'lambda\n'
- 'expression. The ""def"" form is actually more powerful since '
- 'it\n'
- 'allows the execution of multiple statements and annotations.\n'
- '\n'
- "**Programmer's note:** Functions are first-class objects. A "
- '""def""\n'
- 'statement executed inside a function definition defines a '
- 'local\n'
- 'function that can be returned or passed around. Free '
- 'variables used\n'
- 'in the nested function can access the local variables of the '
- 'function\n'
- 'containing the def. See section *Naming and binding* for '
- 'details.\n'
- '\n'
- 'See also: **PEP 3107** - Function Annotations\n'
- '\n'
- ' The original specification for function annotations.\n',
- 'global': '\n'
- 'The "global" statement\n'
- '**********************\n'
- '\n'
- ' global_stmt ::= "global" identifier ("," identifier)*\n'
- '\n'
- 'The "global" statement is a declaration which holds for the '
- 'entire\n'
- 'current code block. It means that the listed identifiers are to '
- 'be\n'
- 'interpreted as globals. It would be impossible to assign to a '
- 'global\n'
- 'variable without "global", although free variables may refer to\n'
- 'globals without being declared global.\n'
- '\n'
- 'Names listed in a "global" statement must not be used in the '
- 'same code\n'
- 'block textually preceding that "global" statement.\n'
- '\n'
- 'Names listed in a "global" statement must not be defined as '
- 'formal\n'
- 'parameters or in a "for" loop control target, "class" '
- 'definition,\n'
- 'function definition, or "import" statement.\n'
- '\n'
- '**CPython implementation detail:** The current implementation '
- 'does not\n'
- 'enforce the two restrictions, but programs should not abuse '
- 'this\n'
- 'freedom, as future implementations may enforce them or silently '
- 'change\n'
- 'the meaning of the program.\n'
- '\n'
- '**Programmer\'s note:** the "global" is a directive to the '
- 'parser. It\n'
- 'applies only to code parsed at the same time as the "global"\n'
- 'statement. In particular, a "global" statement contained in a '
- 'string\n'
- 'or code object supplied to the built-in "exec()" function does '
- 'not\n'
- 'affect the code block *containing* the function call, and code\n'
- 'contained in such a string is unaffected by "global" statements '
- 'in the\n'
- 'code containing the function call. The same applies to the '
- '"eval()"\n'
- 'and "compile()" functions.\n',
- 'id-classes': '\n'
- 'Reserved classes of identifiers\n'
- '*******************************\n'
- '\n'
- 'Certain classes of identifiers (besides keywords) have '
- 'special\n'
- 'meanings. These classes are identified by the patterns of '
- 'leading and\n'
- 'trailing underscore characters:\n'
- '\n'
- '"_*"\n'
- ' Not imported by "from module import *". The special '
- 'identifier "_"\n'
- ' is used in the interactive interpreter to store the '
- 'result of the\n'
- ' last evaluation; it is stored in the "builtins" module. '
- 'When not\n'
- ' in interactive mode, "_" has no special meaning and is '
- 'not defined.\n'
- ' See section *The import statement*.\n'
- '\n'
- ' Note: The name "_" is often used in conjunction with\n'
- ' internationalization; refer to the documentation for '
- 'the\n'
- ' "gettext" module for more information on this '
- 'convention.\n'
- '\n'
- '"__*__"\n'
- ' System-defined names. These names are defined by the '
- 'interpreter\n'
- ' and its implementation (including the standard library). '
- 'Current\n'
- ' system names are discussed in the *Special method names* '
- 'section\n'
- ' and elsewhere. More will likely be defined in future '
- 'versions of\n'
- ' Python. *Any* use of "__*__" names, in any context, that '
- 'does not\n'
- ' follow explicitly documented use, is subject to breakage '
- 'without\n'
- ' warning.\n'
- '\n'
- '"__*"\n'
- ' Class-private names. Names in this category, when used '
- 'within the\n'
- ' context of a class definition, are re-written to use a '
- 'mangled form\n'
- ' to help avoid name clashes between "private" attributes '
- 'of base and\n'
- ' derived classes. See section *Identifiers (Names)*.\n',
- 'identifiers': '\n'
- 'Identifiers and keywords\n'
- '************************\n'
- '\n'
- 'Identifiers (also referred to as *names*) are described by '
- 'the\n'
- 'following lexical definitions.\n'
- '\n'
- 'The syntax of identifiers in Python is based on the Unicode '
- 'standard\n'
- 'annex UAX-31, with elaboration and changes as defined '
- 'below; see also\n'
- '**PEP 3131** for further details.\n'
- '\n'
- 'Within the ASCII range (U+0001..U+007F), the valid '
- 'characters for\n'
- 'identifiers are the same as in Python 2.x: the uppercase '
- 'and lowercase\n'
- 'letters "A" through "Z", the underscore "_" and, except for '
- 'the first\n'
- 'character, the digits "0" through "9".\n'
- '\n'
- 'Python 3.0 introduces additional characters from outside '
- 'the ASCII\n'
- 'range (see **PEP 3131**). For these characters, the '
- 'classification\n'
- 'uses the version of the Unicode Character Database as '
- 'included in the\n'
- '"unicodedata" module.\n'
- '\n'
- 'Identifiers are unlimited in length. Case is significant.\n'
- '\n'
- ' identifier ::= xid_start xid_continue*\n'
- ' id_start ::= <all characters in general categories '
- 'Lu, Ll, Lt, Lm, Lo, Nl, the underscore, and characters with '
- 'the Other_ID_Start property>\n'
- ' id_continue ::= <all characters in id_start, plus '
- 'characters in the categories Mn, Mc, Nd, Pc and others with '
- 'the Other_ID_Continue property>\n'
- ' xid_start ::= <all characters in id_start whose NFKC '
- 'normalization is in "id_start xid_continue*">\n'
- ' xid_continue ::= <all characters in id_continue whose '
- 'NFKC normalization is in "id_continue*">\n'
- '\n'
- 'The Unicode category codes mentioned above stand for:\n'
- '\n'
- '* *Lu* - uppercase letters\n'
- '\n'
- '* *Ll* - lowercase letters\n'
- '\n'
- '* *Lt* - titlecase letters\n'
- '\n'
- '* *Lm* - modifier letters\n'
- '\n'
- '* *Lo* - other letters\n'
- '\n'
- '* *Nl* - letter numbers\n'
- '\n'
- '* *Mn* - nonspacing marks\n'
- '\n'
- '* *Mc* - spacing combining marks\n'
- '\n'
- '* *Nd* - decimal numbers\n'
- '\n'
- '* *Pc* - connector punctuations\n'
- '\n'
- '* *Other_ID_Start* - explicit list of characters in '
- 'PropList.txt to\n'
- ' support backwards compatibility\n'
- '\n'
- '* *Other_ID_Continue* - likewise\n'
- '\n'
- 'All identifiers are converted into the normal form NFKC '
- 'while parsing;\n'
- 'comparison of identifiers is based on NFKC.\n'
- '\n'
- 'A non-normative HTML file listing all valid identifier '
- 'characters for\n'
- 'Unicode 4.1 can be found at http://www.dcl.hpi.uni-\n'
- 'potsdam.de/home/loewis/table-3131.html.\n'
- '\n'
- '\n'
- 'Keywords\n'
- '========\n'
- '\n'
- 'The following identifiers are used as reserved words, or '
- '*keywords* of\n'
- 'the language, and cannot be used as ordinary identifiers. '
- 'They must\n'
- 'be spelled exactly as written here:\n'
- '\n'
- ' False class finally is return\n'
- ' None continue for lambda try\n'
- ' True def from nonlocal while\n'
- ' and del global not with\n'
- ' as elif if or yield\n'
- ' assert else import pass\n'
- ' break except in raise\n'
- '\n'
- '\n'
- 'Reserved classes of identifiers\n'
- '===============================\n'
- '\n'
- 'Certain classes of identifiers (besides keywords) have '
- 'special\n'
- 'meanings. These classes are identified by the patterns of '
- 'leading and\n'
- 'trailing underscore characters:\n'
- '\n'
- '"_*"\n'
- ' Not imported by "from module import *". The special '
- 'identifier "_"\n'
- ' is used in the interactive interpreter to store the '
- 'result of the\n'
- ' last evaluation; it is stored in the "builtins" module. '
- 'When not\n'
- ' in interactive mode, "_" has no special meaning and is '
- 'not defined.\n'
- ' See section *The import statement*.\n'
- '\n'
- ' Note: The name "_" is often used in conjunction with\n'
- ' internationalization; refer to the documentation for '
- 'the\n'
- ' "gettext" module for more information on this '
- 'convention.\n'
- '\n'
- '"__*__"\n'
- ' System-defined names. These names are defined by the '
- 'interpreter\n'
- ' and its implementation (including the standard '
- 'library). Current\n'
- ' system names are discussed in the *Special method names* '
- 'section\n'
- ' and elsewhere. More will likely be defined in future '
- 'versions of\n'
- ' Python. *Any* use of "__*__" names, in any context, '
- 'that does not\n'
- ' follow explicitly documented use, is subject to breakage '
- 'without\n'
- ' warning.\n'
- '\n'
- '"__*"\n'
- ' Class-private names. Names in this category, when used '
- 'within the\n'
- ' context of a class definition, are re-written to use a '
- 'mangled form\n'
- ' to help avoid name clashes between "private" attributes '
- 'of base and\n'
- ' derived classes. See section *Identifiers (Names)*.\n',
- 'if': '\n'
- 'The "if" statement\n'
- '******************\n'
- '\n'
- 'The "if" statement is used for conditional execution:\n'
- '\n'
- ' if_stmt ::= "if" expression ":" suite\n'
- ' ( "elif" expression ":" suite )*\n'
- ' ["else" ":" suite]\n'
- '\n'
- 'It selects exactly one of the suites by evaluating the expressions '
- 'one\n'
- 'by one until one is found to be true (see section *Boolean '
- 'operations*\n'
- 'for the definition of true and false); then that suite is executed\n'
- '(and no other part of the "if" statement is executed or evaluated).\n'
- 'If all expressions are false, the suite of the "else" clause, if\n'
- 'present, is executed.\n',
- 'imaginary': '\n'
- 'Imaginary literals\n'
- '******************\n'
- '\n'
- 'Imaginary literals are described by the following lexical '
- 'definitions:\n'
- '\n'
- ' imagnumber ::= (floatnumber | intpart) ("j" | "J")\n'
- '\n'
- 'An imaginary literal yields a complex number with a real part '
- 'of 0.0.\n'
- 'Complex numbers are represented as a pair of floating point '
- 'numbers\n'
- 'and have the same restrictions on their range. To create a '
- 'complex\n'
- 'number with a nonzero real part, add a floating point number '
- 'to it,\n'
- 'e.g., "(3+4j)". Some examples of imaginary literals:\n'
- '\n'
- ' 3.14j 10.j 10j .001j 1e100j 3.14e-10j\n',
- 'import': '\n'
- 'The "import" statement\n'
- '**********************\n'
- '\n'
- ' import_stmt ::= "import" module ["as" name] ( "," module '
- '["as" name] )*\n'
- ' | "from" relative_module "import" identifier '
- '["as" name]\n'
- ' ( "," identifier ["as" name] )*\n'
- ' | "from" relative_module "import" "(" '
- 'identifier ["as" name]\n'
- ' ( "," identifier ["as" name] )* [","] ")"\n'
- ' | "from" module "import" "*"\n'
- ' module ::= (identifier ".")* identifier\n'
- ' relative_module ::= "."* module | "."+\n'
- ' name ::= identifier\n'
- '\n'
- 'The basic import statement (no "from" clause) is executed in '
- 'two\n'
- 'steps:\n'
- '\n'
- '1. find a module, loading and initializing it if necessary\n'
- '\n'
- '2. define a name or names in the local namespace for the scope\n'
- ' where the "import" statement occurs.\n'
- '\n'
- 'When the statement contains multiple clauses (separated by '
- 'commas) the\n'
- 'two steps are carried out separately for each clause, just as '
- 'though\n'
- 'the clauses had been separated out into individiual import '
- 'statements.\n'
- '\n'
- 'The details of the first step, finding and loading modules are\n'
- 'described in greater detail in the section on the *import '
- 'system*,\n'
- 'which also describes the various types of packages and modules '
- 'that\n'
- 'can be imported, as well as all the hooks that can be used to\n'
- 'customize the import system. Note that failures in this step '
- 'may\n'
- 'indicate either that the module could not be located, *or* that '
- 'an\n'
- 'error occurred while initializing the module, which includes '
- 'execution\n'
- "of the module's code.\n"
- '\n'
- 'If the requested module is retrieved successfully, it will be '
- 'made\n'
- 'available in the local namespace in one of three ways:\n'
- '\n'
- '* If the module name is followed by "as", then the name '
- 'following\n'
- ' "as" is bound directly to the imported module.\n'
- '\n'
- '* If no other name is specified, and the module being imported '
- 'is a\n'
- " top level module, the module's name is bound in the local "
- 'namespace\n'
- ' as a reference to the imported module\n'
- '\n'
- '* If the module being imported is *not* a top level module, then '
- 'the\n'
- ' name of the top level package that contains the module is '
- 'bound in\n'
- ' the local namespace as a reference to the top level package. '
- 'The\n'
- ' imported module must be accessed using its full qualified '
- 'name\n'
- ' rather than directly\n'
- '\n'
- 'The "from" form uses a slightly more complex process:\n'
- '\n'
- '1. find the module specified in the "from" clause, loading and\n'
- ' initializing it if necessary;\n'
- '\n'
- '2. for each of the identifiers specified in the "import" '
- 'clauses:\n'
- '\n'
- ' 1. check if the imported module has an attribute by that '
- 'name\n'
- '\n'
- ' 2. if not, attempt to import a submodule with that name and '
- 'then\n'
- ' check the imported module again for that attribute\n'
- '\n'
- ' 3. if the attribute is not found, "ImportError" is raised.\n'
- '\n'
- ' 4. otherwise, a reference to that value is stored in the '
- 'local\n'
- ' namespace, using the name in the "as" clause if it is '
- 'present,\n'
- ' otherwise using the attribute name\n'
- '\n'
- 'Examples:\n'
- '\n'
- ' import foo # foo imported and bound locally\n'
- ' import foo.bar.baz # foo.bar.baz imported, foo bound '
- 'locally\n'
- ' import foo.bar.baz as fbb # foo.bar.baz imported and bound '
- 'as fbb\n'
- ' from foo.bar import baz # foo.bar.baz imported and bound '
- 'as baz\n'
- ' from foo import attr # foo imported and foo.attr bound '
- 'as attr\n'
- '\n'
- 'If the list of identifiers is replaced by a star ("\'*\'"), all '
- 'public\n'
- 'names defined in the module are bound in the local namespace for '
- 'the\n'
- 'scope where the "import" statement occurs.\n'
- '\n'
- 'The *public names* defined by a module are determined by '
- 'checking the\n'
- 'module\'s namespace for a variable named "__all__"; if defined, '
- 'it must\n'
- 'be a sequence of strings which are names defined or imported by '
- 'that\n'
- 'module. The names given in "__all__" are all considered public '
- 'and\n'
- 'are required to exist. If "__all__" is not defined, the set of '
- 'public\n'
- "names includes all names found in the module's namespace which "
- 'do not\n'
- 'begin with an underscore character ("\'_\'"). "__all__" should '
- 'contain\n'
- 'the entire public API. It is intended to avoid accidentally '
- 'exporting\n'
- 'items that are not part of the API (such as library modules '
- 'which were\n'
- 'imported and used within the module).\n'
- '\n'
- 'The wild card form of import --- "from module import *" --- is '
- 'only\n'
- 'allowed at the module level. Attempting to use it in class or\n'
- 'function definitions will raise a "SyntaxError".\n'
- '\n'
- 'When specifying what module to import you do not have to specify '
- 'the\n'
- 'absolute name of the module. When a module or package is '
- 'contained\n'
- 'within another package it is possible to make a relative import '
- 'within\n'
- 'the same top package without having to mention the package name. '
- 'By\n'
- 'using leading dots in the specified module or package after '
- '"from" you\n'
- 'can specify how high to traverse up the current package '
- 'hierarchy\n'
- 'without specifying exact names. One leading dot means the '
- 'current\n'
- 'package where the module making the import exists. Two dots '
- 'means up\n'
- 'one package level. Three dots is up two levels, etc. So if you '
- 'execute\n'
- '"from . import mod" from a module in the "pkg" package then you '
- 'will\n'
- 'end up importing "pkg.mod". If you execute "from ..subpkg2 '
- 'import mod"\n'
- 'from within "pkg.subpkg1" you will import "pkg.subpkg2.mod". '
- 'The\n'
- 'specification for relative imports is contained within **PEP '
- '328**.\n'
- '\n'
- '"importlib.import_module()" is provided to support applications '
- 'that\n'
- 'determine dynamically the modules to be loaded.\n'
- '\n'
- '\n'
- 'Future statements\n'
- '=================\n'
- '\n'
- 'A *future statement* is a directive to the compiler that a '
- 'particular\n'
- 'module should be compiled using syntax or semantics that will '
- 'be\n'
- 'available in a specified future release of Python where the '
- 'feature\n'
- 'becomes standard.\n'
- '\n'
- 'The future statement is intended to ease migration to future '
- 'versions\n'
- 'of Python that introduce incompatible changes to the language. '
- 'It\n'
- 'allows use of the new features on a per-module basis before the\n'
- 'release in which the feature becomes standard.\n'
- '\n'
- ' future_statement ::= "from" "__future__" "import" feature '
- '["as" name]\n'
- ' ("," feature ["as" name])*\n'
- ' | "from" "__future__" "import" "(" '
- 'feature ["as" name]\n'
- ' ("," feature ["as" name])* [","] ")"\n'
- ' feature ::= identifier\n'
- ' name ::= identifier\n'
- '\n'
- 'A future statement must appear near the top of the module. The '
- 'only\n'
- 'lines that can appear before a future statement are:\n'
- '\n'
- '* the module docstring (if any),\n'
- '\n'
- '* comments,\n'
- '\n'
- '* blank lines, and\n'
- '\n'
- '* other future statements.\n'
- '\n'
- 'The features recognized by Python 3.0 are "absolute_import",\n'
- '"division", "generators", "unicode_literals", "print_function",\n'
- '"nested_scopes" and "with_statement". They are all redundant '
- 'because\n'
- 'they are always enabled, and only kept for backwards '
- 'compatibility.\n'
- '\n'
- 'A future statement is recognized and treated specially at '
- 'compile\n'
- 'time: Changes to the semantics of core constructs are often\n'
- 'implemented by generating different code. It may even be the '
- 'case\n'
- 'that a new feature introduces new incompatible syntax (such as a '
- 'new\n'
- 'reserved word), in which case the compiler may need to parse '
- 'the\n'
- 'module differently. Such decisions cannot be pushed off until\n'
- 'runtime.\n'
- '\n'
- 'For any given release, the compiler knows which feature names '
- 'have\n'
- 'been defined, and raises a compile-time error if a future '
- 'statement\n'
- 'contains a feature not known to it.\n'
- '\n'
- 'The direct runtime semantics are the same as for any import '
- 'statement:\n'
- 'there is a standard module "__future__", described later, and it '
- 'will\n'
- 'be imported in the usual way at the time the future statement '
- 'is\n'
- 'executed.\n'
- '\n'
- 'The interesting runtime semantics depend on the specific '
- 'feature\n'
- 'enabled by the future statement.\n'
- '\n'
- 'Note that there is nothing special about the statement:\n'
- '\n'
- ' import __future__ [as name]\n'
- '\n'
- "That is not a future statement; it's an ordinary import "
- 'statement with\n'
- 'no special semantics or syntax restrictions.\n'
- '\n'
- 'Code compiled by calls to the built-in functions "exec()" and\n'
- '"compile()" that occur in a module "M" containing a future '
- 'statement\n'
- 'will, by default, use the new syntax or semantics associated '
- 'with the\n'
- 'future statement. This can be controlled by optional arguments '
- 'to\n'
- '"compile()" --- see the documentation of that function for '
- 'details.\n'
- '\n'
- 'A future statement typed at an interactive interpreter prompt '
- 'will\n'
- 'take effect for the rest of the interpreter session. If an\n'
- 'interpreter is started with the *-i* option, is passed a script '
- 'name\n'
- 'to execute, and the script includes a future statement, it will '
- 'be in\n'
- 'effect in the interactive session started after the script is\n'
- 'executed.\n'
- '\n'
- 'See also: **PEP 236** - Back to the __future__\n'
- '\n'
- ' The original proposal for the __future__ mechanism.\n',
- 'in': '\n'
- 'Comparisons\n'
- '***********\n'
- '\n'
- 'Unlike C, all comparison operations in Python have the same '
- 'priority,\n'
- 'which is lower than that of any arithmetic, shifting or bitwise\n'
- 'operation. Also unlike C, expressions like "a < b < c" have the\n'
- 'interpretation that is conventional in mathematics:\n'
- '\n'
- ' comparison ::= or_expr ( comp_operator or_expr )*\n'
- ' comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n'
- ' | "is" ["not"] | ["not"] "in"\n'
- '\n'
- 'Comparisons yield boolean values: "True" or "False".\n'
- '\n'
- 'Comparisons can be chained arbitrarily, e.g., "x < y <= z" is\n'
- 'equivalent to "x < y and y <= z", except that "y" is evaluated only\n'
- 'once (but in both cases "z" is not evaluated at all when "x < y" is\n'
- 'found to be false).\n'
- '\n'
- 'Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and '
- '*op1*,\n'
- '*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... '
- 'y\n'
- 'opN z" is equivalent to "a op1 b and b op2 c and ... y opN z", '
- 'except\n'
- 'that each expression is evaluated at most once.\n'
- '\n'
- 'Note that "a op1 b op2 c" doesn\'t imply any kind of comparison '
- 'between\n'
- '*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\n'
- 'perhaps not pretty).\n'
- '\n'
- 'The operators "<", ">", "==", ">=", "<=", and "!=" compare the '
- 'values\n'
- 'of two objects. The objects need not have the same type. If both '
- 'are\n'
- 'numbers, they are converted to a common type. Otherwise, the "==" '
- 'and\n'
- '"!=" operators *always* consider objects of different types to be\n'
- 'unequal, while the "<", ">", ">=" and "<=" operators raise a\n'
- '"TypeError" when comparing objects of different types that do not\n'
- 'implement these operators for the given pair of types. You can\n'
- 'control comparison behavior of objects of non-built-in types by\n'
- 'defining rich comparison methods like "__gt__()", described in '
- 'section\n'
- '*Basic customization*.\n'
- '\n'
- 'Comparison of objects of the same type depends on the type:\n'
- '\n'
- '* Numbers are compared arithmetically.\n'
- '\n'
- '* The values "float(\'NaN\')" and "Decimal(\'NaN\')" are special. '
- 'They\n'
- ' are identical to themselves, "x is x" but are not equal to\n'
- ' themselves, "x != x". Additionally, comparing any value to a\n'
- ' not-a-number value will return "False". For example, both "3 <\n'
- ' float(\'NaN\')" and "float(\'NaN\') < 3" will return "False".\n'
- '\n'
- '* Bytes objects are compared lexicographically using the numeric\n'
- ' values of their elements.\n'
- '\n'
- '* Strings are compared lexicographically using the numeric\n'
- ' equivalents (the result of the built-in function "ord()") of '
- 'their\n'
- " characters. [3] String and bytes object can't be compared!\n"
- '\n'
- '* Tuples and lists are compared lexicographically using comparison\n'
- ' of corresponding elements. This means that to compare equal, '
- 'each\n'
- ' element must compare equal and the two sequences must be of the '
- 'same\n'
- ' type and have the same length.\n'
- '\n'
- ' If not equal, the sequences are ordered the same as their first\n'
- ' differing elements. For example, "[1,2,x] <= [1,2,y]" has the '
- 'same\n'
- ' value as "x <= y". If the corresponding element does not exist, '
- 'the\n'
- ' shorter sequence is ordered first (for example, "[1,2] < '
- '[1,2,3]").\n'
- '\n'
- '* Mappings (dictionaries) compare equal if and only if they have '
- 'the\n'
- ' same "(key, value)" pairs. Order comparisons "(\'<\', \'<=\', '
- "'>=',\n"
- ' \'>\')" raise "TypeError".\n'
- '\n'
- '* Sets and frozensets define comparison operators to mean subset '
- 'and\n'
- ' superset tests. Those relations do not define total orderings '
- '(the\n'
- ' two sets "{1,2}" and "{2,3}" are not equal, nor subsets of one\n'
- ' another, nor supersets of one another). Accordingly, sets are '
- 'not\n'
- ' appropriate arguments for functions which depend on total '
- 'ordering.\n'
- ' For example, "min()", "max()", and "sorted()" produce undefined\n'
- ' results given a list of sets as inputs.\n'
- '\n'
- '* Most other objects of built-in types compare unequal unless they\n'
- ' are the same object; the choice whether one object is considered\n'
- ' smaller or larger than another one is made arbitrarily but\n'
- ' consistently within one execution of a program.\n'
- '\n'
- 'Comparison of objects of differing types depends on whether either '
- 'of\n'
- 'the types provide explicit support for the comparison. Most '
- 'numeric\n'
- 'types can be compared with one another. When cross-type comparison '
- 'is\n'
- 'not supported, the comparison method returns "NotImplemented".\n'
- '\n'
- 'The operators "in" and "not in" test for membership. "x in s"\n'
- 'evaluates to true if *x* is a member of *s*, and false otherwise. '
- '"x\n'
- 'not in s" returns the negation of "x in s". All built-in sequences\n'
- 'and set types support this as well as dictionary, for which "in" '
- 'tests\n'
- 'whether the dictionary has a given key. For container types such as\n'
- 'list, tuple, set, frozenset, dict, or collections.deque, the\n'
- 'expression "x in y" is equivalent to "any(x is e or x == e for e in\n'
- 'y)".\n'
- '\n'
- 'For the string and bytes types, "x in y" is true if and only if *x* '
- 'is\n'
- 'a substring of *y*. An equivalent test is "y.find(x) != -1". '
- 'Empty\n'
- 'strings are always considered to be a substring of any other '
- 'string,\n'
- 'so """ in "abc"" will return "True".\n'
- '\n'
- 'For user-defined classes which define the "__contains__()" method, '
- '"x\n'
- 'in y" is true if and only if "y.__contains__(x)" is true.\n'
- '\n'
- 'For user-defined classes which do not define "__contains__()" but '
- 'do\n'
- 'define "__iter__()", "x in y" is true if some value "z" with "x == '
- 'z"\n'
- 'is produced while iterating over "y". If an exception is raised\n'
- 'during the iteration, it is as if "in" raised that exception.\n'
- '\n'
- 'Lastly, the old-style iteration protocol is tried: if a class '
- 'defines\n'
- '"__getitem__()", "x in y" is true if and only if there is a non-\n'
- 'negative integer index *i* such that "x == y[i]", and all lower\n'
- 'integer indices do not raise "IndexError" exception. (If any other\n'
- 'exception is raised, it is as if "in" raised that exception).\n'
- '\n'
- 'The operator "not in" is defined to have the inverse true value of\n'
- '"in".\n'
- '\n'
- 'The operators "is" and "is not" test for object identity: "x is y" '
- 'is\n'
- 'true if and only if *x* and *y* are the same object. "x is not y"\n'
- 'yields the inverse truth value. [4]\n',
- 'integers': '\n'
- 'Integer literals\n'
- '****************\n'
- '\n'
- 'Integer literals are described by the following lexical '
- 'definitions:\n'
- '\n'
- ' integer ::= decimalinteger | octinteger | hexinteger '
- '| bininteger\n'
- ' decimalinteger ::= nonzerodigit digit* | "0"+\n'
- ' nonzerodigit ::= "1"..."9"\n'
- ' digit ::= "0"..."9"\n'
- ' octinteger ::= "0" ("o" | "O") octdigit+\n'
- ' hexinteger ::= "0" ("x" | "X") hexdigit+\n'
- ' bininteger ::= "0" ("b" | "B") bindigit+\n'
- ' octdigit ::= "0"..."7"\n'
- ' hexdigit ::= digit | "a"..."f" | "A"..."F"\n'
- ' bindigit ::= "0" | "1"\n'
- '\n'
- 'There is no limit for the length of integer literals apart '
- 'from what\n'
- 'can be stored in available memory.\n'
- '\n'
- 'Note that leading zeros in a non-zero decimal number are not '
- 'allowed.\n'
- 'This is for disambiguation with C-style octal literals, which '
- 'Python\n'
- 'used before version 3.0.\n'
- '\n'
- 'Some examples of integer literals:\n'
- '\n'
- ' 7 2147483647 0o177 '
- '0b100110111\n'
- ' 3 79228162514264337593543950336 0o377 '
- '0xdeadbeef\n',
- 'lambda': '\n'
- 'Lambdas\n'
- '*******\n'
- '\n'
- ' lambda_expr ::= "lambda" [parameter_list]: expression\n'
- ' lambda_expr_nocond ::= "lambda" [parameter_list]: '
- 'expression_nocond\n'
- '\n'
- 'Lambda expressions (sometimes called lambda forms) are used to '
- 'create\n'
- 'anonymous functions. The expression "lambda arguments: '
- 'expression"\n'
- 'yields a function object. The unnamed object behaves like a '
- 'function\n'
- 'object defined with\n'
- '\n'
- ' def <lambda>(arguments):\n'
- ' return expression\n'
- '\n'
- 'See section *Function definitions* for the syntax of parameter '
- 'lists.\n'
- 'Note that functions created with lambda expressions cannot '
- 'contain\n'
- 'statements or annotations.\n',
- 'lists': '\n'
- 'List displays\n'
- '*************\n'
- '\n'
- 'A list display is a possibly empty series of expressions enclosed '
- 'in\n'
- 'square brackets:\n'
- '\n'
- ' list_display ::= "[" [expression_list | comprehension] "]"\n'
- '\n'
- 'A list display yields a new list object, the contents being '
- 'specified\n'
- 'by either a list of expressions or a comprehension. When a '
- 'comma-\n'
- 'separated list of expressions is supplied, its elements are '
- 'evaluated\n'
- 'from left to right and placed into the list object in that '
- 'order.\n'
- 'When a comprehension is supplied, the list is constructed from '
- 'the\n'
- 'elements resulting from the comprehension.\n',
- 'naming': '\n'
- 'Naming and binding\n'
- '******************\n'
- '\n'
- '\n'
- 'Binding of names\n'
- '================\n'
- '\n'
- '*Names* refer to objects. Names are introduced by name binding\n'
- 'operations.\n'
- '\n'
- 'The following constructs bind names: formal parameters to '
- 'functions,\n'
- '"import" statements, class and function definitions (these bind '
- 'the\n'
- 'class or function name in the defining block), and targets that '
- 'are\n'
- 'identifiers if occurring in an assignment, "for" loop header, or '
- 'after\n'
- '"as" in a "with" statement or "except" clause. The "import" '
- 'statement\n'
- 'of the form "from ... import *" binds all names defined in the\n'
- 'imported module, except those beginning with an underscore. '
- 'This form\n'
- 'may only be used at the module level.\n'
- '\n'
- 'A target occurring in a "del" statement is also considered bound '
- 'for\n'
- 'this purpose (though the actual semantics are to unbind the '
- 'name).\n'
- '\n'
- 'Each assignment or import statement occurs within a block '
- 'defined by a\n'
- 'class or function definition or at the module level (the '
- 'top-level\n'
- 'code block).\n'
- '\n'
- 'If a name is bound in a block, it is a local variable of that '
- 'block,\n'
- 'unless declared as "nonlocal" or "global". If a name is bound '
- 'at the\n'
- 'module level, it is a global variable. (The variables of the '
- 'module\n'
- 'code block are local and global.) If a variable is used in a '
- 'code\n'
- 'block but not defined there, it is a *free variable*.\n'
- '\n'
- 'Each occurrence of a name in the program text refers to the '
- '*binding*\n'
- 'of that name established by the following name resolution '
- 'rules.\n'
- '\n'
- '\n'
- 'Resolution of names\n'
- '===================\n'
- '\n'
- 'A *scope* defines the visibility of a name within a block. If a '
- 'local\n'
- 'variable is defined in a block, its scope includes that block. '
- 'If the\n'
- 'definition occurs in a function block, the scope extends to any '
- 'blocks\n'
- 'contained within the defining one, unless a contained block '
- 'introduces\n'
- 'a different binding for the name.\n'
- '\n'
- 'When a name is used in a code block, it is resolved using the '
- 'nearest\n'
- 'enclosing scope. The set of all such scopes visible to a code '
- 'block\n'
- "is called the block's *environment*.\n"
- '\n'
- 'When a name is not found at all, a "NameError" exception is '
- 'raised. If\n'
- 'the current scope is a function scope, and the name refers to a '
- 'local\n'
- 'variable that has not yet been bound to a value at the point '
- 'where the\n'
- 'name is used, an "UnboundLocalError" exception is raised.\n'
- '"UnboundLocalError" is a subclass of "NameError".\n'
- '\n'
- 'If a name binding operation occurs anywhere within a code block, '
- 'all\n'
- 'uses of the name within the block are treated as references to '
- 'the\n'
- 'current block. This can lead to errors when a name is used '
- 'within a\n'
- 'block before it is bound. This rule is subtle. Python lacks\n'
- 'declarations and allows name binding operations to occur '
- 'anywhere\n'
- 'within a code block. The local variables of a code block can '
- 'be\n'
- 'determined by scanning the entire text of the block for name '
- 'binding\n'
- 'operations.\n'
- '\n'
- 'If the "global" statement occurs within a block, all uses of the '
- 'name\n'
- 'specified in the statement refer to the binding of that name in '
- 'the\n'
- 'top-level namespace. Names are resolved in the top-level '
- 'namespace by\n'
- 'searching the global namespace, i.e. the namespace of the '
- 'module\n'
- 'containing the code block, and the builtins namespace, the '
- 'namespace\n'
- 'of the module "builtins". The global namespace is searched '
- 'first. If\n'
- 'the name is not found there, the builtins namespace is '
- 'searched. The\n'
- '"global" statement must precede all uses of the name.\n'
- '\n'
- 'The "global" statement has the same scope as a name binding '
- 'operation\n'
- 'in the same block. If the nearest enclosing scope for a free '
- 'variable\n'
- 'contains a global statement, the free variable is treated as a '
- 'global.\n'
- '\n'
- 'The "nonlocal" statement causes corresponding names to refer to\n'
- 'previously bound variables in the nearest enclosing function '
- 'scope.\n'
- '"SyntaxError" is raised at compile time if the given name does '
- 'not\n'
- 'exist in any enclosing function scope.\n'
- '\n'
- 'The namespace for a module is automatically created the first '
- 'time a\n'
- 'module is imported. The main module for a script is always '
- 'called\n'
- '"__main__".\n'
- '\n'
- 'Class definition blocks and arguments to "exec()" and "eval()" '
- 'are\n'
- 'special in the context of name resolution. A class definition is '
- 'an\n'
- 'executable statement that may use and define names. These '
- 'references\n'
- 'follow the normal rules for name resolution with an exception '
- 'that\n'
- 'unbound local variables are looked up in the global namespace. '
- 'The\n'
- 'namespace of the class definition becomes the attribute '
- 'dictionary of\n'
- 'the class. The scope of names defined in a class block is '
- 'limited to\n'
- 'the class block; it does not extend to the code blocks of '
- 'methods --\n'
- 'this includes comprehensions and generator expressions since '
- 'they are\n'
- 'implemented using a function scope. This means that the '
- 'following\n'
- 'will fail:\n'
- '\n'
- ' class A:\n'
- ' a = 42\n'
- ' b = list(a + i for i in range(10))\n'
- '\n'
- '\n'
- 'Builtins and restricted execution\n'
- '=================================\n'
- '\n'
- 'The builtins namespace associated with the execution of a code '
- 'block\n'
- 'is actually found by looking up the name "__builtins__" in its '
- 'global\n'
- 'namespace; this should be a dictionary or a module (in the '
- 'latter case\n'
- "the module's dictionary is used). By default, when in the "
- '"__main__"\n'
- 'module, "__builtins__" is the built-in module "builtins"; when '
- 'in any\n'
- 'other module, "__builtins__" is an alias for the dictionary of '
- 'the\n'
- '"builtins" module itself. "__builtins__" can be set to a '
- 'user-created\n'
- 'dictionary to create a weak form of restricted execution.\n'
- '\n'
- '**CPython implementation detail:** Users should not touch\n'
- '"__builtins__"; it is strictly an implementation detail. Users\n'
- 'wanting to override values in the builtins namespace should '
- '"import"\n'
- 'the "builtins" module and modify its attributes appropriately.\n'
- '\n'
- '\n'
- 'Interaction with dynamic features\n'
- '=================================\n'
- '\n'
- 'Name resolution of free variables occurs at runtime, not at '
- 'compile\n'
- 'time. This means that the following code will print 42:\n'
- '\n'
- ' i = 10\n'
- ' def f():\n'
- ' print(i)\n'
- ' i = 42\n'
- ' f()\n'
- '\n'
- 'There are several cases where Python statements are illegal when '
- 'used\n'
- 'in conjunction with nested scopes that contain free variables.\n'
- '\n'
- 'If a variable is referenced in an enclosing scope, it is illegal '
- 'to\n'
- 'delete the name. An error will be reported at compile time.\n'
- '\n'
- 'The "eval()" and "exec()" functions do not have access to the '
- 'full\n'
- 'environment for resolving names. Names may be resolved in the '
- 'local\n'
- 'and global namespaces of the caller. Free variables are not '
- 'resolved\n'
- 'in the nearest enclosing namespace, but in the global '
- 'namespace. [1]\n'
- 'The "exec()" and "eval()" functions have optional arguments to\n'
- 'override the global and local namespace. If only one namespace '
- 'is\n'
- 'specified, it is used for both.\n',
- 'nonlocal': '\n'
- 'The "nonlocal" statement\n'
- '************************\n'
- '\n'
- ' nonlocal_stmt ::= "nonlocal" identifier ("," identifier)*\n'
- '\n'
- 'The "nonlocal" statement causes the listed identifiers to '
- 'refer to\n'
- 'previously bound variables in the nearest enclosing scope '
- 'excluding\n'
- 'globals. This is important because the default behavior for '
- 'binding is\n'
- 'to search the local namespace first. The statement allows\n'
- 'encapsulated code to rebind variables outside of the local '
- 'scope\n'
- 'besides the global (module) scope.\n'
- '\n'
- 'Names listed in a "nonlocal" statement, unlike those listed in '
- 'a\n'
- '"global" statement, must refer to pre-existing bindings in an\n'
- 'enclosing scope (the scope in which a new binding should be '
- 'created\n'
- 'cannot be determined unambiguously).\n'
- '\n'
- 'Names listed in a "nonlocal" statement must not collide with '
- 'pre-\n'
- 'existing bindings in the local scope.\n'
- '\n'
- 'See also: **PEP 3104** - Access to Names in Outer Scopes\n'
- '\n'
- ' The specification for the "nonlocal" statement.\n',
- 'numbers': '\n'
- 'Numeric literals\n'
- '****************\n'
- '\n'
- 'There are three types of numeric literals: integers, floating '
- 'point\n'
- 'numbers, and imaginary numbers. There are no complex literals\n'
- '(complex numbers can be formed by adding a real number and an\n'
- 'imaginary number).\n'
- '\n'
- 'Note that numeric literals do not include a sign; a phrase like '
- '"-1"\n'
- 'is actually an expression composed of the unary operator '
- '\'"-"\' and the\n'
- 'literal "1".\n',
- 'numeric-types': '\n'
- 'Emulating numeric types\n'
- '***********************\n'
- '\n'
- 'The following methods can be defined to emulate numeric '
- 'objects.\n'
- 'Methods corresponding to operations that are not '
- 'supported by the\n'
- 'particular kind of number implemented (e.g., bitwise '
- 'operations for\n'
- 'non-integral numbers) should be left undefined.\n'
- '\n'
- 'object.__add__(self, other)\n'
- 'object.__sub__(self, other)\n'
- 'object.__mul__(self, other)\n'
- 'object.__matmul__(self, other)\n'
- 'object.__truediv__(self, other)\n'
- 'object.__floordiv__(self, other)\n'
- 'object.__mod__(self, other)\n'
- 'object.__divmod__(self, other)\n'
- 'object.__pow__(self, other[, modulo])\n'
- 'object.__lshift__(self, other)\n'
- 'object.__rshift__(self, other)\n'
- 'object.__and__(self, other)\n'
- 'object.__xor__(self, other)\n'
- 'object.__or__(self, other)\n'
- '\n'
- ' These methods are called to implement the binary '
- 'arithmetic\n'
- ' operations ("+", "-", "*", "@", "/", "//", "%", '
- '"divmod()",\n'
- ' "pow()", "**", "<<", ">>", "&", "^", "|"). For '
- 'instance, to\n'
- ' evaluate the expression "x + y", where *x* is an '
- 'instance of a\n'
- ' class that has an "__add__()" method, "x.__add__(y)" '
- 'is called.\n'
- ' The "__divmod__()" method should be the equivalent to '
- 'using\n'
- ' "__floordiv__()" and "__mod__()"; it should not be '
- 'related to\n'
- ' "__truediv__()". Note that "__pow__()" should be '
- 'defined to accept\n'
- ' an optional third argument if the ternary version of '
- 'the built-in\n'
- ' "pow()" function is to be supported.\n'
- '\n'
- ' If one of those methods does not support the operation '
- 'with the\n'
- ' supplied arguments, it should return '
- '"NotImplemented".\n'
- '\n'
- 'object.__radd__(self, other)\n'
- 'object.__rsub__(self, other)\n'
- 'object.__rmul__(self, other)\n'
- 'object.__rmatmul__(self, other)\n'
- 'object.__rtruediv__(self, other)\n'
- 'object.__rfloordiv__(self, other)\n'
- 'object.__rmod__(self, other)\n'
- 'object.__rdivmod__(self, other)\n'
- 'object.__rpow__(self, other)\n'
- 'object.__rlshift__(self, other)\n'
- 'object.__rrshift__(self, other)\n'
- 'object.__rand__(self, other)\n'
- 'object.__rxor__(self, other)\n'
- 'object.__ror__(self, other)\n'
- '\n'
- ' These methods are called to implement the binary '
- 'arithmetic\n'
- ' operations ("+", "-", "*", "@", "/", "//", "%", '
- '"divmod()",\n'
- ' "pow()", "**", "<<", ">>", "&", "^", "|") with '
- 'reflected (swapped)\n'
- ' operands. These functions are only called if the left '
- 'operand does\n'
- ' not support the corresponding operation and the '
- 'operands are of\n'
- ' different types. [2] For instance, to evaluate the '
- 'expression "x -\n'
- ' y", where *y* is an instance of a class that has an '
- '"__rsub__()"\n'
- ' method, "y.__rsub__(x)" is called if "x.__sub__(y)" '
- 'returns\n'
- ' *NotImplemented*.\n'
- '\n'
- ' Note that ternary "pow()" will not try calling '
- '"__rpow__()" (the\n'
- ' coercion rules would become too complicated).\n'
- '\n'
- " Note: If the right operand's type is a subclass of the "
- 'left\n'
- " operand's type and that subclass provides the "
- 'reflected method\n'
- ' for the operation, this method will be called before '
- 'the left\n'
- " operand's non-reflected method. This behavior "
- 'allows subclasses\n'
- " to override their ancestors' operations.\n"
- '\n'
- 'object.__iadd__(self, other)\n'
- 'object.__isub__(self, other)\n'
- 'object.__imul__(self, other)\n'
- 'object.__imatmul__(self, other)\n'
- 'object.__itruediv__(self, other)\n'
- 'object.__ifloordiv__(self, other)\n'
- 'object.__imod__(self, other)\n'
- 'object.__ipow__(self, other[, modulo])\n'
- 'object.__ilshift__(self, other)\n'
- 'object.__irshift__(self, other)\n'
- 'object.__iand__(self, other)\n'
- 'object.__ixor__(self, other)\n'
- 'object.__ior__(self, other)\n'
- '\n'
- ' These methods are called to implement the augmented '
- 'arithmetic\n'
- ' assignments ("+=", "-=", "*=", "@=", "/=", "//=", '
- '"%=", "**=",\n'
- ' "<<=", ">>=", "&=", "^=", "|="). These methods should '
- 'attempt to\n'
- ' do the operation in-place (modifying *self*) and '
- 'return the result\n'
- ' (which could be, but does not have to be, *self*). If '
- 'a specific\n'
- ' method is not defined, the augmented assignment falls '
- 'back to the\n'
- ' normal methods. For instance, if *x* is an instance '
- 'of a class\n'
- ' with an "__iadd__()" method, "x += y" is equivalent to '
- '"x =\n'
- ' x.__iadd__(y)" . Otherwise, "x.__add__(y)" and '
- '"y.__radd__(x)" are\n'
- ' considered, as with the evaluation of "x + y". In '
- 'certain\n'
- ' situations, augmented assignment can result in '
- 'unexpected errors\n'
- " (see *Why does a_tuple[i] += ['item'] raise an "
- 'exception when the\n'
- ' addition works?*), but this behavior is in fact part '
- 'of the data\n'
- ' model.\n'
- '\n'
- 'object.__neg__(self)\n'
- 'object.__pos__(self)\n'
- 'object.__abs__(self)\n'
- 'object.__invert__(self)\n'
- '\n'
- ' Called to implement the unary arithmetic operations '
- '("-", "+",\n'
- ' "abs()" and "~").\n'
- '\n'
- 'object.__complex__(self)\n'
- 'object.__int__(self)\n'
- 'object.__float__(self)\n'
- 'object.__round__(self[, n])\n'
- '\n'
- ' Called to implement the built-in functions '
- '"complex()", "int()",\n'
- ' "float()" and "round()". Should return a value of the '
- 'appropriate\n'
- ' type.\n'
- '\n'
- 'object.__index__(self)\n'
- '\n'
- ' Called to implement "operator.index()", and whenever '
- 'Python needs\n'
- ' to losslessly convert the numeric object to an integer '
- 'object (such\n'
- ' as in slicing, or in the built-in "bin()", "hex()" and '
- '"oct()"\n'
- ' functions). Presence of this method indicates that the '
- 'numeric\n'
- ' object is an integer type. Must return an integer.\n'
- '\n'
- ' Note: In order to have a coherent integer type class, '
- 'when\n'
- ' "__index__()" is defined "__int__()" should also be '
- 'defined, and\n'
- ' both should return the same value.\n',
- 'objects': '\n'
- 'Objects, values and types\n'
- '*************************\n'
- '\n'
- "*Objects* are Python's abstraction for data. All data in a "
- 'Python\n'
- 'program is represented by objects or by relations between '
- 'objects. (In\n'
- "a sense, and in conformance to Von Neumann's model of a "
- '"stored\n'
- 'program computer," code is also represented by objects.)\n'
- '\n'
- "Every object has an identity, a type and a value. An object's\n"
- '*identity* never changes once it has been created; you may '
- 'think of it\n'
- 'as the object\'s address in memory. The \'"is"\' operator '
- 'compares the\n'
- 'identity of two objects; the "id()" function returns an '
- 'integer\n'
- 'representing its identity.\n'
- '\n'
- '**CPython implementation detail:** For CPython, "id(x)" is the '
- 'memory\n'
- 'address where "x" is stored.\n'
- '\n'
- "An object's type determines the operations that the object "
- 'supports\n'
- '(e.g., "does it have a length?") and also defines the possible '
- 'values\n'
- 'for objects of that type. The "type()" function returns an '
- "object's\n"
- 'type (which is an object itself). Like its identity, an '
- "object's\n"
- '*type* is also unchangeable. [1]\n'
- '\n'
- 'The *value* of some objects can change. Objects whose value '
- 'can\n'
- 'change are said to be *mutable*; objects whose value is '
- 'unchangeable\n'
- 'once they are created are called *immutable*. (The value of an\n'
- 'immutable container object that contains a reference to a '
- 'mutable\n'
- "object can change when the latter's value is changed; however "
- 'the\n'
- 'container is still considered immutable, because the collection '
- 'of\n'
- 'objects it contains cannot be changed. So, immutability is '
- 'not\n'
- 'strictly the same as having an unchangeable value, it is more '
- 'subtle.)\n'
- "An object's mutability is determined by its type; for "
- 'instance,\n'
- 'numbers, strings and tuples are immutable, while dictionaries '
- 'and\n'
- 'lists are mutable.\n'
- '\n'
- 'Objects are never explicitly destroyed; however, when they '
- 'become\n'
- 'unreachable they may be garbage-collected. An implementation '
- 'is\n'
- 'allowed to postpone garbage collection or omit it altogether '
- '--- it is\n'
- 'a matter of implementation quality how garbage collection is\n'
- 'implemented, as long as no objects are collected that are '
- 'still\n'
- 'reachable.\n'
- '\n'
- '**CPython implementation detail:** CPython currently uses a '
- 'reference-\n'
- 'counting scheme with (optional) delayed detection of cyclically '
- 'linked\n'
- 'garbage, which collects most objects as soon as they become\n'
- 'unreachable, but is not guaranteed to collect garbage '
- 'containing\n'
- 'circular references. See the documentation of the "gc" module '
- 'for\n'
- 'information on controlling the collection of cyclic garbage. '
- 'Other\n'
- 'implementations act differently and CPython may change. Do not '
- 'depend\n'
- 'on immediate finalization of objects when they become '
- 'unreachable (so\n'
- 'you should always close files explicitly).\n'
- '\n'
- "Note that the use of the implementation's tracing or debugging\n"
- 'facilities may keep objects alive that would normally be '
- 'collectable.\n'
- 'Also note that catching an exception with a '
- '\'"try"..."except"\'\n'
- 'statement may keep objects alive.\n'
- '\n'
- 'Some objects contain references to "external" resources such as '
- 'open\n'
- 'files or windows. It is understood that these resources are '
- 'freed\n'
- 'when the object is garbage-collected, but since garbage '
- 'collection is\n'
- 'not guaranteed to happen, such objects also provide an explicit '
- 'way to\n'
- 'release the external resource, usually a "close()" method. '
- 'Programs\n'
- 'are strongly recommended to explicitly close such objects. '
- 'The\n'
- '\'"try"..."finally"\' statement and the \'"with"\' statement '
- 'provide\n'
- 'convenient ways to do this.\n'
- '\n'
- 'Some objects contain references to other objects; these are '
- 'called\n'
- '*containers*. Examples of containers are tuples, lists and\n'
- "dictionaries. The references are part of a container's value. "
- 'In\n'
- 'most cases, when we talk about the value of a container, we '
- 'imply the\n'
- 'values, not the identities of the contained objects; however, '
- 'when we\n'
- 'talk about the mutability of a container, only the identities '
- 'of the\n'
- 'immediately contained objects are implied. So, if an '
- 'immutable\n'
- 'container (like a tuple) contains a reference to a mutable '
- 'object, its\n'
- 'value changes if that mutable object is changed.\n'
- '\n'
- 'Types affect almost all aspects of object behavior. Even the\n'
- 'importance of object identity is affected in some sense: for '
- 'immutable\n'
- 'types, operations that compute new values may actually return '
- 'a\n'
- 'reference to any existing object with the same type and value, '
- 'while\n'
- 'for mutable objects this is not allowed. E.g., after "a = 1; b '
- '= 1",\n'
- '"a" and "b" may or may not refer to the same object with the '
- 'value\n'
- 'one, depending on the implementation, but after "c = []; d = '
- '[]", "c"\n'
- 'and "d" are guaranteed to refer to two different, unique, '
- 'newly\n'
- 'created empty lists. (Note that "c = d = []" assigns the same '
- 'object\n'
- 'to both "c" and "d".)\n',
- 'operator-summary': '\n'
- 'Operator precedence\n'
- '*******************\n'
- '\n'
- 'The following table summarizes the operator precedence '
- 'in Python, from\n'
- 'lowest precedence (least binding) to highest '
- 'precedence (most\n'
- 'binding). Operators in the same box have the same '
- 'precedence. Unless\n'
- 'the syntax is explicitly given, operators are binary. '
- 'Operators in\n'
- 'the same box group left to right (except for '
- 'exponentiation, which\n'
- 'groups from right to left).\n'
- '\n'
- 'Note that comparisons, membership tests, and identity '
- 'tests, all have\n'
- 'the same precedence and have a left-to-right chaining '
- 'feature as\n'
- 'described in the *Comparisons* section.\n'
- '\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| Operator | '
- 'Description |\n'
- '+=================================================+=======================================+\n'
- '| "lambda" | '
- 'Lambda expression |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "if" -- "else" | '
- 'Conditional expression |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "or" | '
- 'Boolean OR |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "and" | '
- 'Boolean AND |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "not" "x" | '
- 'Boolean NOT |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "in", "not in", "is", "is not", "<", "<=", ">", | '
- 'Comparisons, including membership |\n'
- '| ">=", "!=", "==" | '
- 'tests and identity tests |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "|" | '
- 'Bitwise OR |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "^" | '
- 'Bitwise XOR |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "&" | '
- 'Bitwise AND |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "<<", ">>" | '
- 'Shifts |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "+", "-" | '
- 'Addition and subtraction |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "*", "@", "/", "//", "%" | '
- 'Multiplication, matrix multiplication |\n'
- '| | '
- 'division, remainder [5] |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "+x", "-x", "~x" | '
- 'Positive, negative, bitwise NOT |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "**" | '
- 'Exponentiation [6] |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "await" "x" | '
- 'Await expression |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "x[index]", "x[index:index]", | '
- 'Subscription, slicing, call, |\n'
- '| "x(arguments...)", "x.attribute" | '
- 'attribute reference |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '| "(expressions...)", "[expressions...]", "{key: | '
- 'Binding or tuple display, list |\n'
- '| value...}", "{expressions...}" | '
- 'display, dictionary display, set |\n'
- '| | '
- 'display |\n'
- '+-------------------------------------------------+---------------------------------------+\n'
- '\n'
- '-[ Footnotes ]-\n'
- '\n'
- '[1] While "abs(x%y) < abs(y)" is true mathematically, '
- 'for floats\n'
- ' it may not be true numerically due to roundoff. '
- 'For example, and\n'
- ' assuming a platform on which a Python float is an '
- 'IEEE 754 double-\n'
- ' precision number, in order that "-1e-100 % 1e100" '
- 'have the same\n'
- ' sign as "1e100", the computed result is "-1e-100 + '
- '1e100", which\n'
- ' is numerically exactly equal to "1e100". The '
- 'function\n'
- ' "math.fmod()" returns a result whose sign matches '
- 'the sign of the\n'
- ' first argument instead, and so returns "-1e-100" '
- 'in this case.\n'
- ' Which approach is more appropriate depends on the '
- 'application.\n'
- '\n'
- '[2] If x is very close to an exact integer multiple of '
- "y, it's\n"
- ' possible for "x//y" to be one larger than '
- '"(x-x%y)//y" due to\n'
- ' rounding. In such cases, Python returns the '
- 'latter result, in\n'
- ' order to preserve that "divmod(x,y)[0] * y + x % '
- 'y" be very close\n'
- ' to "x".\n'
- '\n'
- '[3] While comparisons between strings make sense at '
- 'the byte\n'
- ' level, they may be counter-intuitive to users. '
- 'For example, the\n'
- ' strings ""\\u00C7"" and ""\\u0043\\u0327"" compare '
- 'differently, even\n'
- ' though they both represent the same unicode '
- 'character (LATIN\n'
- ' CAPITAL LETTER C WITH CEDILLA). To compare '
- 'strings in a human\n'
- ' recognizable way, compare using '
- '"unicodedata.normalize()".\n'
- '\n'
- '[4] Due to automatic garbage-collection, free lists, '
- 'and the\n'
- ' dynamic nature of descriptors, you may notice '
- 'seemingly unusual\n'
- ' behaviour in certain uses of the "is" operator, '
- 'like those\n'
- ' involving comparisons between instance methods, or '
- 'constants.\n'
- ' Check their documentation for more info.\n'
- '\n'
- '[5] The "%" operator is also used for string '
- 'formatting; the same\n'
- ' precedence applies.\n'
- '\n'
- '[6] The power operator "**" binds less tightly than an '
- 'arithmetic\n'
- ' or bitwise unary operator on its right, that is, '
- '"2**-1" is "0.5".\n',
- 'pass': '\n'
- 'The "pass" statement\n'
- '********************\n'
- '\n'
- ' pass_stmt ::= "pass"\n'
- '\n'
- '"pass" is a null operation --- when it is executed, nothing '
- 'happens.\n'
- 'It is useful as a placeholder when a statement is required\n'
- 'syntactically, but no code needs to be executed, for example:\n'
- '\n'
- ' def f(arg): pass # a function that does nothing (yet)\n'
- '\n'
- ' class C: pass # a class with no methods (yet)\n',
- 'power': '\n'
- 'The power operator\n'
- '******************\n'
- '\n'
- 'The power operator binds more tightly than unary operators on '
- 'its\n'
- 'left; it binds less tightly than unary operators on its right. '
- 'The\n'
- 'syntax is:\n'
- '\n'
- ' power ::= await ["**" u_expr]\n'
- '\n'
- 'Thus, in an unparenthesized sequence of power and unary '
- 'operators, the\n'
- 'operators are evaluated from right to left (this does not '
- 'constrain\n'
- 'the evaluation order for the operands): "-1**2" results in "-1".\n'
- '\n'
- 'The power operator has the same semantics as the built-in '
- '"pow()"\n'
- 'function, when called with two arguments: it yields its left '
- 'argument\n'
- 'raised to the power of its right argument. The numeric arguments '
- 'are\n'
- 'first converted to a common type, and the result is of that '
- 'type.\n'
- '\n'
- 'For int operands, the result has the same type as the operands '
- 'unless\n'
- 'the second argument is negative; in that case, all arguments are\n'
- 'converted to float and a float result is delivered. For example,\n'
- '"10**2" returns "100", but "10**-2" returns "0.01".\n'
- '\n'
- 'Raising "0.0" to a negative power results in a '
- '"ZeroDivisionError".\n'
- 'Raising a negative number to a fractional power results in a '
- '"complex"\n'
- 'number. (In earlier versions it raised a "ValueError".)\n',
- 'raise': '\n'
- 'The "raise" statement\n'
- '*********************\n'
- '\n'
- ' raise_stmt ::= "raise" [expression ["from" expression]]\n'
- '\n'
- 'If no expressions are present, "raise" re-raises the last '
- 'exception\n'
- 'that was active in the current scope. If no exception is active '
- 'in\n'
- 'the current scope, a "RuntimeError" exception is raised '
- 'indicating\n'
- 'that this is an error.\n'
- '\n'
- 'Otherwise, "raise" evaluates the first expression as the '
- 'exception\n'
- 'object. It must be either a subclass or an instance of\n'
- '"BaseException". If it is a class, the exception instance will '
- 'be\n'
- 'obtained when needed by instantiating the class with no '
- 'arguments.\n'
- '\n'
- "The *type* of the exception is the exception instance's class, "
- 'the\n'
- '*value* is the instance itself.\n'
- '\n'
- 'A traceback object is normally created automatically when an '
- 'exception\n'
- 'is raised and attached to it as the "__traceback__" attribute, '
- 'which\n'
- 'is writable. You can create an exception and set your own '
- 'traceback in\n'
- 'one step using the "with_traceback()" exception method (which '
- 'returns\n'
- 'the same exception instance, with its traceback set to its '
- 'argument),\n'
- 'like so:\n'
- '\n'
- ' raise Exception("foo occurred").with_traceback(tracebackobj)\n'
- '\n'
- 'The "from" clause is used for exception chaining: if given, the '
- 'second\n'
- '*expression* must be another exception class or instance, which '
- 'will\n'
- 'then be attached to the raised exception as the "__cause__" '
- 'attribute\n'
- '(which is writable). If the raised exception is not handled, '
- 'both\n'
- 'exceptions will be printed:\n'
- '\n'
- ' >>> try:\n'
- ' ... print(1 / 0)\n'
- ' ... except Exception as exc:\n'
- ' ... raise RuntimeError("Something bad happened") from exc\n'
- ' ...\n'
- ' Traceback (most recent call last):\n'
- ' File "<stdin>", line 2, in <module>\n'
- ' ZeroDivisionError: int division or modulo by zero\n'
- '\n'
- ' The above exception was the direct cause of the following '
- 'exception:\n'
- '\n'
- ' Traceback (most recent call last):\n'
- ' File "<stdin>", line 4, in <module>\n'
- ' RuntimeError: Something bad happened\n'
- '\n'
- 'A similar mechanism works implicitly if an exception is raised '
- 'inside\n'
- 'an exception handler or a "finally" clause: the previous '
- 'exception is\n'
- 'then attached as the new exception\'s "__context__" attribute:\n'
- '\n'
- ' >>> try:\n'
- ' ... print(1 / 0)\n'
- ' ... except:\n'
- ' ... raise RuntimeError("Something bad happened")\n'
- ' ...\n'
- ' Traceback (most recent call last):\n'
- ' File "<stdin>", line 2, in <module>\n'
- ' ZeroDivisionError: int division or modulo by zero\n'
- '\n'
- ' During handling of the above exception, another exception '
- 'occurred:\n'
- '\n'
- ' Traceback (most recent call last):\n'
- ' File "<stdin>", line 4, in <module>\n'
- ' RuntimeError: Something bad happened\n'
- '\n'
- 'Additional information on exceptions can be found in section\n'
- '*Exceptions*, and information about handling exceptions is in '
- 'section\n'
- '*The try statement*.\n',
- 'return': '\n'
- 'The "return" statement\n'
- '**********************\n'
- '\n'
- ' return_stmt ::= "return" [expression_list]\n'
- '\n'
- '"return" may only occur syntactically nested in a function '
- 'definition,\n'
- 'not within a nested class definition.\n'
- '\n'
- 'If an expression list is present, it is evaluated, else "None" '
- 'is\n'
- 'substituted.\n'
- '\n'
- '"return" leaves the current function call with the expression '
- 'list (or\n'
- '"None") as return value.\n'
- '\n'
- 'When "return" passes control out of a "try" statement with a '
- '"finally"\n'
- 'clause, that "finally" clause is executed before really leaving '
- 'the\n'
- 'function.\n'
- '\n'
- 'In a generator function, the "return" statement indicates that '
- 'the\n'
- 'generator is done and will cause "StopIteration" to be raised. '
- 'The\n'
- 'returned value (if any) is used as an argument to construct\n'
- '"StopIteration" and becomes the "StopIteration.value" '
- 'attribute.\n',
- 'sequence-types': '\n'
- 'Emulating container types\n'
- '*************************\n'
- '\n'
- 'The following methods can be defined to implement '
- 'container objects.\n'
- 'Containers usually are sequences (such as lists or '
- 'tuples) or mappings\n'
- '(like dictionaries), but can represent other containers '
- 'as well. The\n'
- 'first set of methods is used either to emulate a '
- 'sequence or to\n'
- 'emulate a mapping; the difference is that for a '
- 'sequence, the\n'
- 'allowable keys should be the integers *k* for which "0 '
- '<= k < N" where\n'
- '*N* is the length of the sequence, or slice objects, '
- 'which define a\n'
- 'range of items. It is also recommended that mappings '
- 'provide the\n'
- 'methods "keys()", "values()", "items()", "get()", '
- '"clear()",\n'
- '"setdefault()", "pop()", "popitem()", "copy()", and '
- '"update()"\n'
- "behaving similar to those for Python's standard "
- 'dictionary objects.\n'
- 'The "collections" module provides a "MutableMapping" '
- 'abstract base\n'
- 'class to help create those methods from a base set of '
- '"__getitem__()",\n'
- '"__setitem__()", "__delitem__()", and "keys()". Mutable '
- 'sequences\n'
- 'should provide methods "append()", "count()", "index()", '
- '"extend()",\n'
- '"insert()", "pop()", "remove()", "reverse()" and '
- '"sort()", like Python\n'
- 'standard list objects. Finally, sequence types should '
- 'implement\n'
- 'addition (meaning concatenation) and multiplication '
- '(meaning\n'
- 'repetition) by defining the methods "__add__()", '
- '"__radd__()",\n'
- '"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" '
- 'described\n'
- 'below; they should not define other numerical '
- 'operators. It is\n'
- 'recommended that both mappings and sequences implement '
- 'the\n'
- '"__contains__()" method to allow efficient use of the '
- '"in" operator;\n'
- 'for mappings, "in" should search the mapping\'s keys; '
- 'for sequences, it\n'
- 'should search through the values. It is further '
- 'recommended that both\n'
- 'mappings and sequences implement the "__iter__()" method '
- 'to allow\n'
- 'efficient iteration through the container; for mappings, '
- '"__iter__()"\n'
- 'should be the same as "keys()"; for sequences, it should '
- 'iterate\n'
- 'through the values.\n'
- '\n'
- 'object.__len__(self)\n'
- '\n'
- ' Called to implement the built-in function "len()". '
- 'Should return\n'
- ' the length of the object, an integer ">=" 0. Also, '
- 'an object that\n'
- ' doesn\'t define a "__bool__()" method and whose '
- '"__len__()" method\n'
- ' returns zero is considered to be false in a Boolean '
- 'context.\n'
- '\n'
- 'object.__length_hint__(self)\n'
- '\n'
- ' Called to implement "operator.length_hint()". Should '
- 'return an\n'
- ' estimated length for the object (which may be greater '
- 'or less than\n'
- ' the actual length). The length must be an integer '
- '">=" 0. This\n'
- ' method is purely an optimization and is never '
- 'required for\n'
- ' correctness.\n'
- '\n'
- ' New in version 3.4.\n'
- '\n'
- 'Note: Slicing is done exclusively with the following '
- 'three methods.\n'
- ' A call like\n'
- '\n'
- ' a[1:2] = b\n'
- '\n'
- ' is translated to\n'
- '\n'
- ' a[slice(1, 2, None)] = b\n'
- '\n'
- ' and so forth. Missing slice items are always filled '
- 'in with "None".\n'
- '\n'
- 'object.__getitem__(self, key)\n'
- '\n'
- ' Called to implement evaluation of "self[key]". For '
- 'sequence types,\n'
- ' the accepted keys should be integers and slice '
- 'objects. Note that\n'
- ' the special interpretation of negative indexes (if '
- 'the class wishes\n'
- ' to emulate a sequence type) is up to the '
- '"__getitem__()" method. If\n'
- ' *key* is of an inappropriate type, "TypeError" may be '
- 'raised; if of\n'
- ' a value outside the set of indexes for the sequence '
- '(after any\n'
- ' special interpretation of negative values), '
- '"IndexError" should be\n'
- ' raised. For mapping types, if *key* is missing (not '
- 'in the\n'
- ' container), "KeyError" should be raised.\n'
- '\n'
- ' Note: "for" loops expect that an "IndexError" will be '
- 'raised for\n'
- ' illegal indexes to allow proper detection of the '
- 'end of the\n'
- ' sequence.\n'
- '\n'
- 'object.__missing__(self, key)\n'
- '\n'
- ' Called by "dict"."__getitem__()" to implement '
- '"self[key]" for dict\n'
- ' subclasses when key is not in the dictionary.\n'
- '\n'
- 'object.__setitem__(self, key, value)\n'
- '\n'
- ' Called to implement assignment to "self[key]". Same '
- 'note as for\n'
- ' "__getitem__()". This should only be implemented for '
- 'mappings if\n'
- ' the objects support changes to the values for keys, '
- 'or if new keys\n'
- ' can be added, or for sequences if elements can be '
- 'replaced. The\n'
- ' same exceptions should be raised for improper *key* '
- 'values as for\n'
- ' the "__getitem__()" method.\n'
- '\n'
- 'object.__delitem__(self, key)\n'
- '\n'
- ' Called to implement deletion of "self[key]". Same '
- 'note as for\n'
- ' "__getitem__()". This should only be implemented for '
- 'mappings if\n'
- ' the objects support removal of keys, or for sequences '
- 'if elements\n'
- ' can be removed from the sequence. The same '
- 'exceptions should be\n'
- ' raised for improper *key* values as for the '
- '"__getitem__()" method.\n'
- '\n'
- 'object.__iter__(self)\n'
- '\n'
- ' This method is called when an iterator is required '
- 'for a container.\n'
- ' This method should return a new iterator object that '
- 'can iterate\n'
- ' over all the objects in the container. For mappings, '
- 'it should\n'
- ' iterate over the keys of the container.\n'
- '\n'
- ' Iterator objects also need to implement this method; '
- 'they are\n'
- ' required to return themselves. For more information '
- 'on iterator\n'
- ' objects, see *Iterator Types*.\n'
- '\n'
- 'object.__reversed__(self)\n'
- '\n'
- ' Called (if present) by the "reversed()" built-in to '
- 'implement\n'
- ' reverse iteration. It should return a new iterator '
- 'object that\n'
- ' iterates over all the objects in the container in '
- 'reverse order.\n'
- '\n'
- ' If the "__reversed__()" method is not provided, the '
- '"reversed()"\n'
- ' built-in will fall back to using the sequence '
- 'protocol ("__len__()"\n'
- ' and "__getitem__()"). Objects that support the '
- 'sequence protocol\n'
- ' should only provide "__reversed__()" if they can '
- 'provide an\n'
- ' implementation that is more efficient than the one '
- 'provided by\n'
- ' "reversed()".\n'
- '\n'
- 'The membership test operators ("in" and "not in") are '
- 'normally\n'
- 'implemented as an iteration through a sequence. '
- 'However, container\n'
- 'objects can supply the following special method with a '
- 'more efficient\n'
- 'implementation, which also does not require the object '
- 'be a sequence.\n'
- '\n'
- 'object.__contains__(self, item)\n'
- '\n'
- ' Called to implement membership test operators. '
- 'Should return true\n'
- ' if *item* is in *self*, false otherwise. For mapping '
- 'objects, this\n'
- ' should consider the keys of the mapping rather than '
- 'the values or\n'
- ' the key-item pairs.\n'
- '\n'
- ' For objects that don\'t define "__contains__()", the '
- 'membership test\n'
- ' first tries iteration via "__iter__()", then the old '
- 'sequence\n'
- ' iteration protocol via "__getitem__()", see *this '
- 'section in the\n'
- ' language reference*.\n',
- 'shifting': '\n'
- 'Shifting operations\n'
- '*******************\n'
- '\n'
- 'The shifting operations have lower priority than the '
- 'arithmetic\n'
- 'operations:\n'
- '\n'
- ' shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n'
- '\n'
- 'These operators accept integers as arguments. They shift the '
- 'first\n'
- 'argument to the left or right by the number of bits given by '
- 'the\n'
- 'second argument.\n'
- '\n'
- 'A right shift by *n* bits is defined as floor division by '
- '"pow(2,n)".\n'
- 'A left shift by *n* bits is defined as multiplication with '
- '"pow(2,n)".\n'
- '\n'
- 'Note: In the current implementation, the right-hand operand '
- 'is\n'
- ' required to be at most "sys.maxsize". If the right-hand '
- 'operand is\n'
- ' larger than "sys.maxsize" an "OverflowError" exception is '
- 'raised.\n',
- 'slicings': '\n'
- 'Slicings\n'
- '********\n'
- '\n'
- 'A slicing selects a range of items in a sequence object (e.g., '
- 'a\n'
- 'string, tuple or list). Slicings may be used as expressions '
- 'or as\n'
- 'targets in assignment or "del" statements. The syntax for a '
- 'slicing:\n'
- '\n'
- ' slicing ::= primary "[" slice_list "]"\n'
- ' slice_list ::= slice_item ("," slice_item)* [","]\n'
- ' slice_item ::= expression | proper_slice\n'
- ' proper_slice ::= [lower_bound] ":" [upper_bound] [ ":" '
- '[stride] ]\n'
- ' lower_bound ::= expression\n'
- ' upper_bound ::= expression\n'
- ' stride ::= expression\n'
- '\n'
- 'There is ambiguity in the formal syntax here: anything that '
- 'looks like\n'
- 'an expression list also looks like a slice list, so any '
- 'subscription\n'
- 'can be interpreted as a slicing. Rather than further '
- 'complicating the\n'
- 'syntax, this is disambiguated by defining that in this case '
- 'the\n'
- 'interpretation as a subscription takes priority over the\n'
- 'interpretation as a slicing (this is the case if the slice '
- 'list\n'
- 'contains no proper slice).\n'
- '\n'
- 'The semantics for a slicing are as follows. The primary is '
- 'indexed\n'
- '(using the same "__getitem__()" method as normal subscription) '
- 'with a\n'
- 'key that is constructed from the slice list, as follows. If '
- 'the slice\n'
- 'list contains at least one comma, the key is a tuple '
- 'containing the\n'
- 'conversion of the slice items; otherwise, the conversion of '
- 'the lone\n'
- 'slice item is the key. The conversion of a slice item that is '
- 'an\n'
- 'expression is that expression. The conversion of a proper '
- 'slice is a\n'
- 'slice object (see section *The standard type hierarchy*) '
- 'whose\n'
- '"start", "stop" and "step" attributes are the values of the\n'
- 'expressions given as lower bound, upper bound and stride,\n'
- 'respectively, substituting "None" for missing expressions.\n',
- 'specialattrs': '\n'
- 'Special Attributes\n'
- '******************\n'
- '\n'
- 'The implementation adds a few special read-only attributes '
- 'to several\n'
- 'object types, where they are relevant. Some of these are '
- 'not reported\n'
- 'by the "dir()" built-in function.\n'
- '\n'
- 'object.__dict__\n'
- '\n'
- ' A dictionary or other mapping object used to store an '
- "object's\n"
- ' (writable) attributes.\n'
- '\n'
- 'instance.__class__\n'
- '\n'
- ' The class to which a class instance belongs.\n'
- '\n'
- 'class.__bases__\n'
- '\n'
- ' The tuple of base classes of a class object.\n'
- '\n'
- 'class.__name__\n'
- '\n'
- ' The name of the class or type.\n'
- '\n'
- 'class.__qualname__\n'
- '\n'
- ' The *qualified name* of the class or type.\n'
- '\n'
- ' New in version 3.3.\n'
- '\n'
- 'class.__mro__\n'
- '\n'
- ' This attribute is a tuple of classes that are '
- 'considered when\n'
- ' looking for base classes during method resolution.\n'
- '\n'
- 'class.mro()\n'
- '\n'
- ' This method can be overridden by a metaclass to '
- 'customize the\n'
- ' method resolution order for its instances. It is '
- 'called at class\n'
- ' instantiation, and its result is stored in "__mro__".\n'
- '\n'
- 'class.__subclasses__()\n'
- '\n'
- ' Each class keeps a list of weak references to its '
- 'immediate\n'
- ' subclasses. This method returns a list of all those '
- 'references\n'
- ' still alive. Example:\n'
- '\n'
- ' >>> int.__subclasses__()\n'
- " [<class 'bool'>]\n"
- '\n'
- '-[ Footnotes ]-\n'
- '\n'
- '[1] Additional information on these special methods may be '
- 'found\n'
- ' in the Python Reference Manual (*Basic '
- 'customization*).\n'
- '\n'
- '[2] As a consequence, the list "[1, 2]" is considered '
- 'equal to\n'
- ' "[1.0, 2.0]", and similarly for tuples.\n'
- '\n'
- "[3] They must have since the parser can't tell the type of "
- 'the\n'
- ' operands.\n'
- '\n'
- '[4] Cased characters are those with general category '
- 'property\n'
- ' being one of "Lu" (Letter, uppercase), "Ll" (Letter, '
- 'lowercase),\n'
- ' or "Lt" (Letter, titlecase).\n'
- '\n'
- '[5] To format only a tuple you should therefore provide a\n'
- ' singleton tuple whose only element is the tuple to be '
- 'formatted.\n',
- 'specialnames': '\n'
- 'Special method names\n'
- '********************\n'
- '\n'
- 'A class can implement certain operations that are invoked '
- 'by special\n'
- 'syntax (such as arithmetic operations or subscripting and '
- 'slicing) by\n'
- "defining methods with special names. This is Python's "
- 'approach to\n'
- '*operator overloading*, allowing classes to define their '
- 'own behavior\n'
- 'with respect to language operators. For instance, if a '
- 'class defines\n'
- 'a method named "__getitem__()", and "x" is an instance of '
- 'this class,\n'
- 'then "x[i]" is roughly equivalent to '
- '"type(x).__getitem__(x, i)".\n'
- 'Except where mentioned, attempts to execute an operation '
- 'raise an\n'
- 'exception when no appropriate method is defined '
- '(typically\n'
- '"AttributeError" or "TypeError").\n'
- '\n'
- 'When implementing a class that emulates any built-in type, '
- 'it is\n'
- 'important that the emulation only be implemented to the '
- 'degree that it\n'
- 'makes sense for the object being modelled. For example, '
- 'some\n'
- 'sequences may work well with retrieval of individual '
- 'elements, but\n'
- 'extracting a slice may not make sense. (One example of '
- 'this is the\n'
- '"NodeList" interface in the W3C\'s Document Object '
- 'Model.)\n'
- '\n'
- '\n'
- 'Basic customization\n'
- '===================\n'
- '\n'
- 'object.__new__(cls[, ...])\n'
- '\n'
- ' Called to create a new instance of class *cls*. '
- '"__new__()" is a\n'
- ' static method (special-cased so you need not declare it '
- 'as such)\n'
- ' that takes the class of which an instance was requested '
- 'as its\n'
- ' first argument. The remaining arguments are those '
- 'passed to the\n'
- ' object constructor expression (the call to the class). '
- 'The return\n'
- ' value of "__new__()" should be the new object instance '
- '(usually an\n'
- ' instance of *cls*).\n'
- '\n'
- ' Typical implementations create a new instance of the '
- 'class by\n'
- ' invoking the superclass\'s "__new__()" method using\n'
- ' "super(currentclass, cls).__new__(cls[, ...])" with '
- 'appropriate\n'
- ' arguments and then modifying the newly-created instance '
- 'as\n'
- ' necessary before returning it.\n'
- '\n'
- ' If "__new__()" returns an instance of *cls*, then the '
- 'new\n'
- ' instance\'s "__init__()" method will be invoked like\n'
- ' "__init__(self[, ...])", where *self* is the new '
- 'instance and the\n'
- ' remaining arguments are the same as were passed to '
- '"__new__()".\n'
- '\n'
- ' If "__new__()" does not return an instance of *cls*, '
- 'then the new\n'
- ' instance\'s "__init__()" method will not be invoked.\n'
- '\n'
- ' "__new__()" is intended mainly to allow subclasses of '
- 'immutable\n'
- ' types (like int, str, or tuple) to customize instance '
- 'creation. It\n'
- ' is also commonly overridden in custom metaclasses in '
- 'order to\n'
- ' customize class creation.\n'
- '\n'
- 'object.__init__(self[, ...])\n'
- '\n'
- ' Called after the instance has been created (by '
- '"__new__()"), but\n'
- ' before it is returned to the caller. The arguments are '
- 'those\n'
- ' passed to the class constructor expression. If a base '
- 'class has an\n'
- ' "__init__()" method, the derived class\'s "__init__()" '
- 'method, if\n'
- ' any, must explicitly call it to ensure proper '
- 'initialization of the\n'
- ' base class part of the instance; for example:\n'
- ' "BaseClass.__init__(self, [args...])".\n'
- '\n'
- ' Because "__new__()" and "__init__()" work together in '
- 'constructing\n'
- ' objects ("__new__()" to create it, and "__init__()" to '
- 'customise\n'
- ' it), no non-"None" value may be returned by '
- '"__init__()"; doing so\n'
- ' will cause a "TypeError" to be raised at runtime.\n'
- '\n'
- 'object.__del__(self)\n'
- '\n'
- ' Called when the instance is about to be destroyed. '
- 'This is also\n'
- ' called a destructor. If a base class has a "__del__()" '
- 'method, the\n'
- ' derived class\'s "__del__()" method, if any, must '
- 'explicitly call it\n'
- ' to ensure proper deletion of the base class part of the '
- 'instance.\n'
- ' Note that it is possible (though not recommended!) for '
- 'the\n'
- ' "__del__()" method to postpone destruction of the '
- 'instance by\n'
- ' creating a new reference to it. It may then be called '
- 'at a later\n'
- ' time when this new reference is deleted. It is not '
- 'guaranteed that\n'
- ' "__del__()" methods are called for objects that still '
- 'exist when\n'
- ' the interpreter exits.\n'
- '\n'
- ' Note: "del x" doesn\'t directly call "x.__del__()" --- '
- 'the former\n'
- ' decrements the reference count for "x" by one, and '
- 'the latter is\n'
- ' only called when "x"\'s reference count reaches '
- 'zero. Some common\n'
- ' situations that may prevent the reference count of an '
- 'object from\n'
- ' going to zero include: circular references between '
- 'objects (e.g.,\n'
- ' a doubly-linked list or a tree data structure with '
- 'parent and\n'
- ' child pointers); a reference to the object on the '
- 'stack frame of\n'
- ' a function that caught an exception (the traceback '
- 'stored in\n'
- ' "sys.exc_info()[2]" keeps the stack frame alive); or '
- 'a reference\n'
- ' to the object on the stack frame that raised an '
- 'unhandled\n'
- ' exception in interactive mode (the traceback stored '
- 'in\n'
- ' "sys.last_traceback" keeps the stack frame alive). '
- 'The first\n'
- ' situation can only be remedied by explicitly breaking '
- 'the cycles;\n'
- ' the second can be resolved by freeing the reference '
- 'to the\n'
- ' traceback object when it is no longer useful, and the '
- 'third can\n'
- ' be resolved by storing "None" in '
- '"sys.last_traceback". Circular\n'
- ' references which are garbage are detected and cleaned '
- 'up when the\n'
- " cyclic garbage collector is enabled (it's on by "
- 'default). Refer\n'
- ' to the documentation for the "gc" module for more '
- 'information\n'
- ' about this topic.\n'
- '\n'
- ' Warning: Due to the precarious circumstances under '
- 'which\n'
- ' "__del__()" methods are invoked, exceptions that '
- 'occur during\n'
- ' their execution are ignored, and a warning is printed '
- 'to\n'
- ' "sys.stderr" instead. Also, when "__del__()" is '
- 'invoked in\n'
- ' response to a module being deleted (e.g., when '
- 'execution of the\n'
- ' program is done), other globals referenced by the '
- '"__del__()"\n'
- ' method may already have been deleted or in the '
- 'process of being\n'
- ' torn down (e.g. the import machinery shutting down). '
- 'For this\n'
- ' reason, "__del__()" methods should do the absolute '
- 'minimum needed\n'
- ' to maintain external invariants. Starting with '
- 'version 1.5,\n'
- ' Python guarantees that globals whose name begins with '
- 'a single\n'
- ' underscore are deleted from their module before other '
- 'globals are\n'
- ' deleted; if no other references to such globals '
- 'exist, this may\n'
- ' help in assuring that imported modules are still '
- 'available at the\n'
- ' time when the "__del__()" method is called.\n'
- '\n'
- 'object.__repr__(self)\n'
- '\n'
- ' Called by the "repr()" built-in function to compute the '
- '"official"\n'
- ' string representation of an object. If at all '
- 'possible, this\n'
- ' should look like a valid Python expression that could '
- 'be used to\n'
- ' recreate an object with the same value (given an '
- 'appropriate\n'
- ' environment). If this is not possible, a string of the '
- 'form\n'
- ' "<...some useful description...>" should be returned. '
- 'The return\n'
- ' value must be a string object. If a class defines '
- '"__repr__()" but\n'
- ' not "__str__()", then "__repr__()" is also used when an '
- '"informal"\n'
- ' string representation of instances of that class is '
- 'required.\n'
- '\n'
- ' This is typically used for debugging, so it is '
- 'important that the\n'
- ' representation is information-rich and unambiguous.\n'
- '\n'
- 'object.__str__(self)\n'
- '\n'
- ' Called by "str(object)" and the built-in functions '
- '"format()" and\n'
- ' "print()" to compute the "informal" or nicely printable '
- 'string\n'
- ' representation of an object. The return value must be '
- 'a *string*\n'
- ' object.\n'
- '\n'
- ' This method differs from "object.__repr__()" in that '
- 'there is no\n'
- ' expectation that "__str__()" return a valid Python '
- 'expression: a\n'
- ' more convenient or concise representation can be used.\n'
- '\n'
- ' The default implementation defined by the built-in type '
- '"object"\n'
- ' calls "object.__repr__()".\n'
- '\n'
- 'object.__bytes__(self)\n'
- '\n'
- ' Called by "bytes()" to compute a byte-string '
- 'representation of an\n'
- ' object. This should return a "bytes" object.\n'
- '\n'
- 'object.__format__(self, format_spec)\n'
- '\n'
- ' Called by the "format()" built-in function (and by '
- 'extension, the\n'
- ' "str.format()" method of class "str") to produce a '
- '"formatted"\n'
- ' string representation of an object. The "format_spec" '
- 'argument is a\n'
- ' string that contains a description of the formatting '
- 'options\n'
- ' desired. The interpretation of the "format_spec" '
- 'argument is up to\n'
- ' the type implementing "__format__()", however most '
- 'classes will\n'
- ' either delegate formatting to one of the built-in '
- 'types, or use a\n'
- ' similar formatting option syntax.\n'
- '\n'
- ' See *Format Specification Mini-Language* for a '
- 'description of the\n'
- ' standard formatting syntax.\n'
- '\n'
- ' The return value must be a string object.\n'
- '\n'
- ' Changed in version 3.4: The __format__ method of '
- '"object" itself\n'
- ' raises a "TypeError" if passed any non-empty string.\n'
- '\n'
- 'object.__lt__(self, other)\n'
- 'object.__le__(self, other)\n'
- 'object.__eq__(self, other)\n'
- 'object.__ne__(self, other)\n'
- 'object.__gt__(self, other)\n'
- 'object.__ge__(self, other)\n'
- '\n'
- ' These are the so-called "rich comparison" methods. The\n'
- ' correspondence between operator symbols and method '
- 'names is as\n'
- ' follows: "x<y" calls "x.__lt__(y)", "x<=y" calls '
- '"x.__le__(y)",\n'
- ' "x==y" calls "x.__eq__(y)", "x!=y" calls "x.__ne__(y)", '
- '"x>y" calls\n'
- ' "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n'
- '\n'
- ' A rich comparison method may return the singleton '
- '"NotImplemented"\n'
- ' if it does not implement the operation for a given pair '
- 'of\n'
- ' arguments. By convention, "False" and "True" are '
- 'returned for a\n'
- ' successful comparison. However, these methods can '
- 'return any value,\n'
- ' so if the comparison operator is used in a Boolean '
- 'context (e.g.,\n'
- ' in the condition of an "if" statement), Python will '
- 'call "bool()"\n'
- ' on the value to determine if the result is true or '
- 'false.\n'
- '\n'
- ' By default, "__ne__()" delegates to "__eq__()" and '
- 'inverts the\n'
- ' result unless it is "NotImplemented". There are no '
- 'other implied\n'
- ' relationships among the comparison operators, for '
- 'example, the\n'
- ' truth of "(x<y or x==y)" does not imply "x<=y". To '
- 'automatically\n'
- ' generate ordering operations from a single root '
- 'operation, see\n'
- ' "functools.total_ordering()".\n'
- '\n'
- ' See the paragraph on "__hash__()" for some important '
- 'notes on\n'
- ' creating *hashable* objects which support custom '
- 'comparison\n'
- ' operations and are usable as dictionary keys.\n'
- '\n'
- ' There are no swapped-argument versions of these methods '
- '(to be used\n'
- ' when the left argument does not support the operation '
- 'but the right\n'
- ' argument does); rather, "__lt__()" and "__gt__()" are '
- "each other's\n"
- ' reflection, "__le__()" and "__ge__()" are each other\'s '
- 'reflection,\n'
- ' and "__eq__()" and "__ne__()" are their own reflection. '
- 'If the\n'
- " operands are of different types, and right operand's "
- 'type is a\n'
- " direct or indirect subclass of the left operand's type, "
- 'the\n'
- ' reflected method of the right operand has priority, '
- 'otherwise the\n'
- " left operand's method has priority. Virtual "
- 'subclassing is not\n'
- ' considered.\n'
- '\n'
- 'object.__hash__(self)\n'
- '\n'
- ' Called by built-in function "hash()" and for operations '
- 'on members\n'
- ' of hashed collections including "set", "frozenset", and '
- '"dict".\n'
- ' "__hash__()" should return an integer. The only '
- 'required property\n'
- ' is that objects which compare equal have the same hash '
- 'value; it is\n'
- ' advised to somehow mix together (e.g. using exclusive '
- 'or) the hash\n'
- ' values for the components of the object that also play '
- 'a part in\n'
- ' comparison of objects.\n'
- '\n'
- ' Note: "hash()" truncates the value returned from an '
- "object's\n"
- ' custom "__hash__()" method to the size of a '
- '"Py_ssize_t". This\n'
- ' is typically 8 bytes on 64-bit builds and 4 bytes on '
- '32-bit\n'
- ' builds. If an object\'s "__hash__()" must '
- 'interoperate on builds\n'
- ' of different bit sizes, be sure to check the width on '
- 'all\n'
- ' supported builds. An easy way to do this is with '
- '"python -c\n'
- ' "import sys; print(sys.hash_info.width)""\n'
- '\n'
- ' If a class does not define an "__eq__()" method it '
- 'should not\n'
- ' define a "__hash__()" operation either; if it defines '
- '"__eq__()"\n'
- ' but not "__hash__()", its instances will not be usable '
- 'as items in\n'
- ' hashable collections. If a class defines mutable '
- 'objects and\n'
- ' implements an "__eq__()" method, it should not '
- 'implement\n'
- ' "__hash__()", since the implementation of hashable '
- 'collections\n'
- " requires that a key's hash value is immutable (if the "
- "object's hash\n"
- ' value changes, it will be in the wrong hash bucket).\n'
- '\n'
- ' User-defined classes have "__eq__()" and "__hash__()" '
- 'methods by\n'
- ' default; with them, all objects compare unequal (except '
- 'with\n'
- ' themselves) and "x.__hash__()" returns an appropriate '
- 'value such\n'
- ' that "x == y" implies both that "x is y" and "hash(x) '
- '== hash(y)".\n'
- '\n'
- ' A class that overrides "__eq__()" and does not define '
- '"__hash__()"\n'
- ' will have its "__hash__()" implicitly set to "None". '
- 'When the\n'
- ' "__hash__()" method of a class is "None", instances of '
- 'the class\n'
- ' will raise an appropriate "TypeError" when a program '
- 'attempts to\n'
- ' retrieve their hash value, and will also be correctly '
- 'identified as\n'
- ' unhashable when checking "isinstance(obj, '
- 'collections.Hashable").\n'
- '\n'
- ' If a class that overrides "__eq__()" needs to retain '
- 'the\n'
- ' implementation of "__hash__()" from a parent class, the '
- 'interpreter\n'
- ' must be told this explicitly by setting "__hash__ =\n'
- ' <ParentClass>.__hash__".\n'
- '\n'
- ' If a class that does not override "__eq__()" wishes to '
- 'suppress\n'
- ' hash support, it should include "__hash__ = None" in '
- 'the class\n'
- ' definition. A class which defines its own "__hash__()" '
- 'that\n'
- ' explicitly raises a "TypeError" would be incorrectly '
- 'identified as\n'
- ' hashable by an "isinstance(obj, collections.Hashable)" '
- 'call.\n'
- '\n'
- ' Note: By default, the "__hash__()" values of str, bytes '
- 'and\n'
- ' datetime objects are "salted" with an unpredictable '
- 'random value.\n'
- ' Although they remain constant within an individual '
- 'Python\n'
- ' process, they are not predictable between repeated '
- 'invocations of\n'
- ' Python.This is intended to provide protection against '
- 'a denial-\n'
- ' of-service caused by carefully-chosen inputs that '
- 'exploit the\n'
- ' worst case performance of a dict insertion, O(n^2) '
- 'complexity.\n'
- ' See '
- 'http://www.ocert.org/advisories/ocert-2011-003.html for\n'
- ' details.Changing hash values affects the iteration '
- 'order of\n'
- ' dicts, sets and other mappings. Python has never '
- 'made guarantees\n'
- ' about this ordering (and it typically varies between '
- '32-bit and\n'
- ' 64-bit builds).See also "PYTHONHASHSEED".\n'
- '\n'
- ' Changed in version 3.3: Hash randomization is enabled '
- 'by default.\n'
- '\n'
- 'object.__bool__(self)\n'
- '\n'
- ' Called to implement truth value testing and the '
- 'built-in operation\n'
- ' "bool()"; should return "False" or "True". When this '
- 'method is not\n'
- ' defined, "__len__()" is called, if it is defined, and '
- 'the object is\n'
- ' considered true if its result is nonzero. If a class '
- 'defines\n'
- ' neither "__len__()" nor "__bool__()", all its instances '
- 'are\n'
- ' considered true.\n'
- '\n'
- '\n'
- 'Customizing attribute access\n'
- '============================\n'
- '\n'
- 'The following methods can be defined to customize the '
- 'meaning of\n'
- 'attribute access (use of, assignment to, or deletion of '
- '"x.name") for\n'
- 'class instances.\n'
- '\n'
- 'object.__getattr__(self, name)\n'
- '\n'
- ' Called when an attribute lookup has not found the '
- 'attribute in the\n'
- ' usual places (i.e. it is not an instance attribute nor '
- 'is it found\n'
- ' in the class tree for "self"). "name" is the attribute '
- 'name. This\n'
- ' method should return the (computed) attribute value or '
- 'raise an\n'
- ' "AttributeError" exception.\n'
- '\n'
- ' Note that if the attribute is found through the normal '
- 'mechanism,\n'
- ' "__getattr__()" is not called. (This is an intentional '
- 'asymmetry\n'
- ' between "__getattr__()" and "__setattr__()".) This is '
- 'done both for\n'
- ' efficiency reasons and because otherwise '
- '"__getattr__()" would have\n'
- ' no way to access other attributes of the instance. '
- 'Note that at\n'
- ' least for instance variables, you can fake total '
- 'control by not\n'
- ' inserting any values in the instance attribute '
- 'dictionary (but\n'
- ' instead inserting them in another object). See the\n'
- ' "__getattribute__()" method below for a way to actually '
- 'get total\n'
- ' control over attribute access.\n'
- '\n'
- 'object.__getattribute__(self, name)\n'
- '\n'
- ' Called unconditionally to implement attribute accesses '
- 'for\n'
- ' instances of the class. If the class also defines '
- '"__getattr__()",\n'
- ' the latter will not be called unless '
- '"__getattribute__()" either\n'
- ' calls it explicitly or raises an "AttributeError". This '
- 'method\n'
- ' should return the (computed) attribute value or raise '
- 'an\n'
- ' "AttributeError" exception. In order to avoid infinite '
- 'recursion in\n'
- ' this method, its implementation should always call the '
- 'base class\n'
- ' method with the same name to access any attributes it '
- 'needs, for\n'
- ' example, "object.__getattribute__(self, name)".\n'
- '\n'
- ' Note: This method may still be bypassed when looking up '
- 'special\n'
- ' methods as the result of implicit invocation via '
- 'language syntax\n'
- ' or built-in functions. See *Special method lookup*.\n'
- '\n'
- 'object.__setattr__(self, name, value)\n'
- '\n'
- ' Called when an attribute assignment is attempted. This '
- 'is called\n'
- ' instead of the normal mechanism (i.e. store the value '
- 'in the\n'
- ' instance dictionary). *name* is the attribute name, '
- '*value* is the\n'
- ' value to be assigned to it.\n'
- '\n'
- ' If "__setattr__()" wants to assign to an instance '
- 'attribute, it\n'
- ' should call the base class method with the same name, '
- 'for example,\n'
- ' "object.__setattr__(self, name, value)".\n'
- '\n'
- 'object.__delattr__(self, name)\n'
- '\n'
- ' Like "__setattr__()" but for attribute deletion instead '
- 'of\n'
- ' assignment. This should only be implemented if "del '
- 'obj.name" is\n'
- ' meaningful for the object.\n'
- '\n'
- 'object.__dir__(self)\n'
- '\n'
- ' Called when "dir()" is called on the object. A sequence '
- 'must be\n'
- ' returned. "dir()" converts the returned sequence to a '
- 'list and\n'
- ' sorts it.\n'
- '\n'
- '\n'
- 'Implementing Descriptors\n'
- '------------------------\n'
- '\n'
- 'The following methods only apply when an instance of the '
- 'class\n'
- 'containing the method (a so-called *descriptor* class) '
- 'appears in an\n'
- '*owner* class (the descriptor must be in either the '
- "owner's class\n"
- 'dictionary or in the class dictionary for one of its '
- 'parents). In the\n'
- 'examples below, "the attribute" refers to the attribute '
- 'whose name is\n'
- 'the key of the property in the owner class\' "__dict__".\n'
- '\n'
- 'object.__get__(self, instance, owner)\n'
- '\n'
- ' Called to get the attribute of the owner class (class '
- 'attribute\n'
- ' access) or of an instance of that class (instance '
- 'attribute\n'
- ' access). *owner* is always the owner class, while '
- '*instance* is the\n'
- ' instance that the attribute was accessed through, or '
- '"None" when\n'
- ' the attribute is accessed through the *owner*. This '
- 'method should\n'
- ' return the (computed) attribute value or raise an '
- '"AttributeError"\n'
- ' exception.\n'
- '\n'
- 'object.__set__(self, instance, value)\n'
- '\n'
- ' Called to set the attribute on an instance *instance* '
- 'of the owner\n'
- ' class to a new value, *value*.\n'
- '\n'
- 'object.__delete__(self, instance)\n'
- '\n'
- ' Called to delete the attribute on an instance '
- '*instance* of the\n'
- ' owner class.\n'
- '\n'
- 'The attribute "__objclass__" is interpreted by the '
- '"inspect" module as\n'
- 'specifying the class where this object was defined '
- '(setting this\n'
- 'appropriately can assist in runtime introspection of '
- 'dynamic class\n'
- 'attributes). For callables, it may indicate that an '
- 'instance of the\n'
- 'given type (or a subclass) is expected or required as the '
- 'first\n'
- 'positional argument (for example, CPython sets this '
- 'attribute for\n'
- 'unbound methods that are implemented in C).\n'
- '\n'
- '\n'
- 'Invoking Descriptors\n'
- '--------------------\n'
- '\n'
- 'In general, a descriptor is an object attribute with '
- '"binding\n'
- 'behavior", one whose attribute access has been overridden '
- 'by methods\n'
- 'in the descriptor protocol: "__get__()", "__set__()", '
- 'and\n'
- '"__delete__()". If any of those methods are defined for an '
- 'object, it\n'
- 'is said to be a descriptor.\n'
- '\n'
- 'The default behavior for attribute access is to get, set, '
- 'or delete\n'
- "the attribute from an object's dictionary. For instance, "
- '"a.x" has a\n'
- 'lookup chain starting with "a.__dict__[\'x\']", then\n'
- '"type(a).__dict__[\'x\']", and continuing through the base '
- 'classes of\n'
- '"type(a)" excluding metaclasses.\n'
- '\n'
- 'However, if the looked-up value is an object defining one '
- 'of the\n'
- 'descriptor methods, then Python may override the default '
- 'behavior and\n'
- 'invoke the descriptor method instead. Where this occurs '
- 'in the\n'
- 'precedence chain depends on which descriptor methods were '
- 'defined and\n'
- 'how they were called.\n'
- '\n'
- 'The starting point for descriptor invocation is a binding, '
- '"a.x". How\n'
- 'the arguments are assembled depends on "a":\n'
- '\n'
- 'Direct Call\n'
- ' The simplest and least common call is when user code '
- 'directly\n'
- ' invokes a descriptor method: "x.__get__(a)".\n'
- '\n'
- 'Instance Binding\n'
- ' If binding to an object instance, "a.x" is transformed '
- 'into the\n'
- ' call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n'
- '\n'
- 'Class Binding\n'
- ' If binding to a class, "A.x" is transformed into the '
- 'call:\n'
- ' "A.__dict__[\'x\'].__get__(None, A)".\n'
- '\n'
- 'Super Binding\n'
- ' If "a" is an instance of "super", then the binding '
- '"super(B,\n'
- ' obj).m()" searches "obj.__class__.__mro__" for the base '
- 'class "A"\n'
- ' immediately preceding "B" and then invokes the '
- 'descriptor with the\n'
- ' call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n'
- '\n'
- 'For instance bindings, the precedence of descriptor '
- 'invocation depends\n'
- 'on the which descriptor methods are defined. A descriptor '
- 'can define\n'
- 'any combination of "__get__()", "__set__()" and '
- '"__delete__()". If it\n'
- 'does not define "__get__()", then accessing the attribute '
- 'will return\n'
- 'the descriptor object itself unless there is a value in '
- "the object's\n"
- 'instance dictionary. If the descriptor defines '
- '"__set__()" and/or\n'
- '"__delete__()", it is a data descriptor; if it defines '
- 'neither, it is\n'
- 'a non-data descriptor. Normally, data descriptors define '
- 'both\n'
- '"__get__()" and "__set__()", while non-data descriptors '
- 'have just the\n'
- '"__get__()" method. Data descriptors with "__set__()" and '
- '"__get__()"\n'
- 'defined always override a redefinition in an instance '
- 'dictionary. In\n'
- 'contrast, non-data descriptors can be overridden by '
- 'instances.\n'
- '\n'
- 'Python methods (including "staticmethod()" and '
- '"classmethod()") are\n'
- 'implemented as non-data descriptors. Accordingly, '
- 'instances can\n'
- 'redefine and override methods. This allows individual '
- 'instances to\n'
- 'acquire behaviors that differ from other instances of the '
- 'same class.\n'
- '\n'
- 'The "property()" function is implemented as a data '
- 'descriptor.\n'
- 'Accordingly, instances cannot override the behavior of a '
- 'property.\n'
- '\n'
- '\n'
- '__slots__\n'
- '---------\n'
- '\n'
- 'By default, instances of classes have a dictionary for '
- 'attribute\n'
- 'storage. This wastes space for objects having very few '
- 'instance\n'
- 'variables. The space consumption can become acute when '
- 'creating large\n'
- 'numbers of instances.\n'
- '\n'
- 'The default can be overridden by defining *__slots__* in a '
- 'class\n'
- 'definition. The *__slots__* declaration takes a sequence '
- 'of instance\n'
- 'variables and reserves just enough space in each instance '
- 'to hold a\n'
- 'value for each variable. Space is saved because '
- '*__dict__* is not\n'
- 'created for each instance.\n'
- '\n'
- 'object.__slots__\n'
- '\n'
- ' This class variable can be assigned a string, iterable, '
- 'or sequence\n'
- ' of strings with variable names used by instances. '
- '*__slots__*\n'
- ' reserves space for the declared variables and prevents '
- 'the\n'
- ' automatic creation of *__dict__* and *__weakref__* for '
- 'each\n'
- ' instance.\n'
- '\n'
- '\n'
- 'Notes on using *__slots__*\n'
- '~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
- '\n'
- '* When inheriting from a class without *__slots__*, the '
- '*__dict__*\n'
- ' attribute of that class will always be accessible, so a '
- '*__slots__*\n'
- ' definition in the subclass is meaningless.\n'
- '\n'
- '* Without a *__dict__* variable, instances cannot be '
- 'assigned new\n'
- ' variables not listed in the *__slots__* definition. '
- 'Attempts to\n'
- ' assign to an unlisted variable name raises '
- '"AttributeError". If\n'
- ' dynamic assignment of new variables is desired, then '
- 'add\n'
- ' "\'__dict__\'" to the sequence of strings in the '
- '*__slots__*\n'
- ' declaration.\n'
- '\n'
- '* Without a *__weakref__* variable for each instance, '
- 'classes\n'
- ' defining *__slots__* do not support weak references to '
- 'its\n'
- ' instances. If weak reference support is needed, then '
- 'add\n'
- ' "\'__weakref__\'" to the sequence of strings in the '
- '*__slots__*\n'
- ' declaration.\n'
- '\n'
- '* *__slots__* are implemented at the class level by '
- 'creating\n'
- ' descriptors (*Implementing Descriptors*) for each '
- 'variable name. As\n'
- ' a result, class attributes cannot be used to set default '
- 'values for\n'
- ' instance variables defined by *__slots__*; otherwise, '
- 'the class\n'
- ' attribute would overwrite the descriptor assignment.\n'
- '\n'
- '* The action of a *__slots__* declaration is limited to '
- 'the class\n'
- ' where it is defined. As a result, subclasses will have '
- 'a *__dict__*\n'
- ' unless they also define *__slots__* (which must only '
- 'contain names\n'
- ' of any *additional* slots).\n'
- '\n'
- '* If a class defines a slot also defined in a base class, '
- 'the\n'
- ' instance variable defined by the base class slot is '
- 'inaccessible\n'
- ' (except by retrieving its descriptor directly from the '
- 'base class).\n'
- ' This renders the meaning of the program undefined. In '
- 'the future, a\n'
- ' check may be added to prevent this.\n'
- '\n'
- '* Nonempty *__slots__* does not work for classes derived '
- 'from\n'
- ' "variable-length" built-in types such as "int", "bytes" '
- 'and "tuple".\n'
- '\n'
- '* Any non-string iterable may be assigned to *__slots__*. '
- 'Mappings\n'
- ' may also be used; however, in the future, special '
- 'meaning may be\n'
- ' assigned to the values corresponding to each key.\n'
- '\n'
- '* *__class__* assignment works only if both classes have '
- 'the same\n'
- ' *__slots__*.\n'
- '\n'
- '\n'
- 'Customizing class creation\n'
- '==========================\n'
- '\n'
- 'By default, classes are constructed using "type()". The '
- 'class body is\n'
- 'executed in a new namespace and the class name is bound '
- 'locally to the\n'
- 'result of "type(name, bases, namespace)".\n'
- '\n'
- 'The class creation process can be customised by passing '
- 'the\n'
- '"metaclass" keyword argument in the class definition line, '
- 'or by\n'
- 'inheriting from an existing class that included such an '
- 'argument. In\n'
- 'the following example, both "MyClass" and "MySubclass" are '
- 'instances\n'
- 'of "Meta":\n'
- '\n'
- ' class Meta(type):\n'
- ' pass\n'
- '\n'
- ' class MyClass(metaclass=Meta):\n'
- ' pass\n'
- '\n'
- ' class MySubclass(MyClass):\n'
- ' pass\n'
- '\n'
- 'Any other keyword arguments that are specified in the '
- 'class definition\n'
- 'are passed through to all metaclass operations described '
- 'below.\n'
- '\n'
- 'When a class definition is executed, the following steps '
- 'occur:\n'
- '\n'
- '* the appropriate metaclass is determined\n'
- '\n'
- '* the class namespace is prepared\n'
- '\n'
- '* the class body is executed\n'
- '\n'
- '* the class object is created\n'
- '\n'
- '\n'
- 'Determining the appropriate metaclass\n'
- '-------------------------------------\n'
- '\n'
- 'The appropriate metaclass for a class definition is '
- 'determined as\n'
- 'follows:\n'
- '\n'
- '* if no bases and no explicit metaclass are given, then '
- '"type()" is\n'
- ' used\n'
- '\n'
- '* if an explicit metaclass is given and it is *not* an '
- 'instance of\n'
- ' "type()", then it is used directly as the metaclass\n'
- '\n'
- '* if an instance of "type()" is given as the explicit '
- 'metaclass, or\n'
- ' bases are defined, then the most derived metaclass is '
- 'used\n'
- '\n'
- 'The most derived metaclass is selected from the explicitly '
- 'specified\n'
- 'metaclass (if any) and the metaclasses (i.e. "type(cls)") '
- 'of all\n'
- 'specified base classes. The most derived metaclass is one '
- 'which is a\n'
- 'subtype of *all* of these candidate metaclasses. If none '
- 'of the\n'
- 'candidate metaclasses meets that criterion, then the class '
- 'definition\n'
- 'will fail with "TypeError".\n'
- '\n'
- '\n'
- 'Preparing the class namespace\n'
- '-----------------------------\n'
- '\n'
- 'Once the appropriate metaclass has been identified, then '
- 'the class\n'
- 'namespace is prepared. If the metaclass has a '
- '"__prepare__" attribute,\n'
- 'it is called as "namespace = metaclass.__prepare__(name, '
- 'bases,\n'
- '**kwds)" (where the additional keyword arguments, if any, '
- 'come from\n'
- 'the class definition).\n'
- '\n'
- 'If the metaclass has no "__prepare__" attribute, then the '
- 'class\n'
- 'namespace is initialised as an empty "dict()" instance.\n'
- '\n'
- 'See also: **PEP 3115** - Metaclasses in Python 3000\n'
- '\n'
- ' Introduced the "__prepare__" namespace hook\n'
- '\n'
- '\n'
- 'Executing the class body\n'
- '------------------------\n'
- '\n'
- 'The class body is executed (approximately) as "exec(body, '
- 'globals(),\n'
- 'namespace)". The key difference from a normal call to '
- '"exec()" is that\n'
- 'lexical scoping allows the class body (including any '
- 'methods) to\n'
- 'reference names from the current and outer scopes when the '
- 'class\n'
- 'definition occurs inside a function.\n'
- '\n'
- 'However, even when the class definition occurs inside the '
- 'function,\n'
- 'methods defined inside the class still cannot see names '
- 'defined at the\n'
- 'class scope. Class variables must be accessed through the '
- 'first\n'
- 'parameter of instance or class methods, and cannot be '
- 'accessed at all\n'
- 'from static methods.\n'
- '\n'
- '\n'
- 'Creating the class object\n'
- '-------------------------\n'
- '\n'
- 'Once the class namespace has been populated by executing '
- 'the class\n'
- 'body, the class object is created by calling '
- '"metaclass(name, bases,\n'
- 'namespace, **kwds)" (the additional keywords passed here '
- 'are the same\n'
- 'as those passed to "__prepare__").\n'
- '\n'
- 'This class object is the one that will be referenced by '
- 'the zero-\n'
- 'argument form of "super()". "__class__" is an implicit '
- 'closure\n'
- 'reference created by the compiler if any methods in a '
- 'class body refer\n'
- 'to either "__class__" or "super". This allows the zero '
- 'argument form\n'
- 'of "super()" to correctly identify the class being defined '
- 'based on\n'
- 'lexical scoping, while the class or instance that was used '
- 'to make the\n'
- 'current call is identified based on the first argument '
- 'passed to the\n'
- 'method.\n'
- '\n'
- 'After the class object is created, it is passed to the '
- 'class\n'
- 'decorators included in the class definition (if any) and '
- 'the resulting\n'
- 'object is bound in the local namespace as the defined '
- 'class.\n'
- '\n'
- 'See also: **PEP 3135** - New super\n'
- '\n'
- ' Describes the implicit "__class__" closure reference\n'
- '\n'
- '\n'
- 'Metaclass example\n'
- '-----------------\n'
- '\n'
- 'The potential uses for metaclasses are boundless. Some '
- 'ideas that have\n'
- 'been explored include logging, interface checking, '
- 'automatic\n'
- 'delegation, automatic property creation, proxies, '
- 'frameworks, and\n'
- 'automatic resource locking/synchronization.\n'
- '\n'
- 'Here is an example of a metaclass that uses an\n'
- '"collections.OrderedDict" to remember the order that class '
- 'variables\n'
- 'are defined:\n'
- '\n'
- ' class OrderedClass(type):\n'
- '\n'
- ' @classmethod\n'
- ' def __prepare__(metacls, name, bases, **kwds):\n'
- ' return collections.OrderedDict()\n'
- '\n'
- ' def __new__(cls, name, bases, namespace, **kwds):\n'
- ' result = type.__new__(cls, name, bases, '
- 'dict(namespace))\n'
- ' result.members = tuple(namespace)\n'
- ' return result\n'
- '\n'
- ' class A(metaclass=OrderedClass):\n'
- ' def one(self): pass\n'
- ' def two(self): pass\n'
- ' def three(self): pass\n'
- ' def four(self): pass\n'
- '\n'
- ' >>> A.members\n'
- " ('__module__', 'one', 'two', 'three', 'four')\n"
- '\n'
- 'When the class definition for *A* gets executed, the '
- 'process begins\n'
- 'with calling the metaclass\'s "__prepare__()" method which '
- 'returns an\n'
- 'empty "collections.OrderedDict". That mapping records the '
- 'methods and\n'
- 'attributes of *A* as they are defined within the body of '
- 'the class\n'
- 'statement. Once those definitions are executed, the '
- 'ordered dictionary\n'
- 'is fully populated and the metaclass\'s "__new__()" method '
- 'gets\n'
- 'invoked. That method builds the new type and it saves the '
- 'ordered\n'
- 'dictionary keys in an attribute called "members".\n'
- '\n'
- '\n'
- 'Customizing instance and subclass checks\n'
- '========================================\n'
- '\n'
- 'The following methods are used to override the default '
- 'behavior of the\n'
- '"isinstance()" and "issubclass()" built-in functions.\n'
- '\n'
- 'In particular, the metaclass "abc.ABCMeta" implements '
- 'these methods in\n'
- 'order to allow the addition of Abstract Base Classes '
- '(ABCs) as\n'
- '"virtual base classes" to any class or type (including '
- 'built-in\n'
- 'types), including other ABCs.\n'
- '\n'
- 'class.__instancecheck__(self, instance)\n'
- '\n'
- ' Return true if *instance* should be considered a '
- '(direct or\n'
- ' indirect) instance of *class*. If defined, called to '
- 'implement\n'
- ' "isinstance(instance, class)".\n'
- '\n'
- 'class.__subclasscheck__(self, subclass)\n'
- '\n'
- ' Return true if *subclass* should be considered a '
- '(direct or\n'
- ' indirect) subclass of *class*. If defined, called to '
- 'implement\n'
- ' "issubclass(subclass, class)".\n'
- '\n'
- 'Note that these methods are looked up on the type '
- '(metaclass) of a\n'
- 'class. They cannot be defined as class methods in the '
- 'actual class.\n'
- 'This is consistent with the lookup of special methods that '
- 'are called\n'
- 'on instances, only in this case the instance is itself a '
- 'class.\n'
- '\n'
- 'See also: **PEP 3119** - Introducing Abstract Base '
- 'Classes\n'
- '\n'
- ' Includes the specification for customizing '
- '"isinstance()" and\n'
- ' "issubclass()" behavior through "__instancecheck__()" '
- 'and\n'
- ' "__subclasscheck__()", with motivation for this '
- 'functionality in\n'
- ' the context of adding Abstract Base Classes (see the '
- '"abc"\n'
- ' module) to the language.\n'
- '\n'
- '\n'
- 'Emulating callable objects\n'
- '==========================\n'
- '\n'
- 'object.__call__(self[, args...])\n'
- '\n'
- ' Called when the instance is "called" as a function; if '
- 'this method\n'
- ' is defined, "x(arg1, arg2, ...)" is a shorthand for\n'
- ' "x.__call__(arg1, arg2, ...)".\n'
- '\n'
- '\n'
- 'Emulating container types\n'
- '=========================\n'
- '\n'
- 'The following methods can be defined to implement '
- 'container objects.\n'
- 'Containers usually are sequences (such as lists or tuples) '
- 'or mappings\n'
- '(like dictionaries), but can represent other containers as '
- 'well. The\n'
- 'first set of methods is used either to emulate a sequence '
- 'or to\n'
- 'emulate a mapping; the difference is that for a sequence, '
- 'the\n'
- 'allowable keys should be the integers *k* for which "0 <= '
- 'k < N" where\n'
- '*N* is the length of the sequence, or slice objects, which '
- 'define a\n'
- 'range of items. It is also recommended that mappings '
- 'provide the\n'
- 'methods "keys()", "values()", "items()", "get()", '
- '"clear()",\n'
- '"setdefault()", "pop()", "popitem()", "copy()", and '
- '"update()"\n'
- "behaving similar to those for Python's standard dictionary "
- 'objects.\n'
- 'The "collections" module provides a "MutableMapping" '
- 'abstract base\n'
- 'class to help create those methods from a base set of '
- '"__getitem__()",\n'
- '"__setitem__()", "__delitem__()", and "keys()". Mutable '
- 'sequences\n'
- 'should provide methods "append()", "count()", "index()", '
- '"extend()",\n'
- '"insert()", "pop()", "remove()", "reverse()" and "sort()", '
- 'like Python\n'
- 'standard list objects. Finally, sequence types should '
- 'implement\n'
- 'addition (meaning concatenation) and multiplication '
- '(meaning\n'
- 'repetition) by defining the methods "__add__()", '
- '"__radd__()",\n'
- '"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" '
- 'described\n'
- 'below; they should not define other numerical operators. '
- 'It is\n'
- 'recommended that both mappings and sequences implement '
- 'the\n'
- '"__contains__()" method to allow efficient use of the "in" '
- 'operator;\n'
- 'for mappings, "in" should search the mapping\'s keys; for '
- 'sequences, it\n'
- 'should search through the values. It is further '
- 'recommended that both\n'
- 'mappings and sequences implement the "__iter__()" method '
- 'to allow\n'
- 'efficient iteration through the container; for mappings, '
- '"__iter__()"\n'
- 'should be the same as "keys()"; for sequences, it should '
- 'iterate\n'
- 'through the values.\n'
- '\n'
- 'object.__len__(self)\n'
- '\n'
- ' Called to implement the built-in function "len()". '
- 'Should return\n'
- ' the length of the object, an integer ">=" 0. Also, an '
- 'object that\n'
- ' doesn\'t define a "__bool__()" method and whose '
- '"__len__()" method\n'
- ' returns zero is considered to be false in a Boolean '
- 'context.\n'
- '\n'
- 'object.__length_hint__(self)\n'
- '\n'
- ' Called to implement "operator.length_hint()". Should '
- 'return an\n'
- ' estimated length for the object (which may be greater '
- 'or less than\n'
- ' the actual length). The length must be an integer ">=" '
- '0. This\n'
- ' method is purely an optimization and is never required '
- 'for\n'
- ' correctness.\n'
- '\n'
- ' New in version 3.4.\n'
- '\n'
- 'Note: Slicing is done exclusively with the following three '
- 'methods.\n'
- ' A call like\n'
- '\n'
- ' a[1:2] = b\n'
- '\n'
- ' is translated to\n'
- '\n'
- ' a[slice(1, 2, None)] = b\n'
- '\n'
- ' and so forth. Missing slice items are always filled in '
- 'with "None".\n'
- '\n'
- 'object.__getitem__(self, key)\n'
- '\n'
- ' Called to implement evaluation of "self[key]". For '
- 'sequence types,\n'
- ' the accepted keys should be integers and slice '
- 'objects. Note that\n'
- ' the special interpretation of negative indexes (if the '
- 'class wishes\n'
- ' to emulate a sequence type) is up to the '
- '"__getitem__()" method. If\n'
- ' *key* is of an inappropriate type, "TypeError" may be '
- 'raised; if of\n'
- ' a value outside the set of indexes for the sequence '
- '(after any\n'
- ' special interpretation of negative values), '
- '"IndexError" should be\n'
- ' raised. For mapping types, if *key* is missing (not in '
- 'the\n'
- ' container), "KeyError" should be raised.\n'
- '\n'
- ' Note: "for" loops expect that an "IndexError" will be '
- 'raised for\n'
- ' illegal indexes to allow proper detection of the end '
- 'of the\n'
- ' sequence.\n'
- '\n'
- 'object.__missing__(self, key)\n'
- '\n'
- ' Called by "dict"."__getitem__()" to implement '
- '"self[key]" for dict\n'
- ' subclasses when key is not in the dictionary.\n'
- '\n'
- 'object.__setitem__(self, key, value)\n'
- '\n'
- ' Called to implement assignment to "self[key]". Same '
- 'note as for\n'
- ' "__getitem__()". This should only be implemented for '
- 'mappings if\n'
- ' the objects support changes to the values for keys, or '
- 'if new keys\n'
- ' can be added, or for sequences if elements can be '
- 'replaced. The\n'
- ' same exceptions should be raised for improper *key* '
- 'values as for\n'
- ' the "__getitem__()" method.\n'
- '\n'
- 'object.__delitem__(self, key)\n'
- '\n'
- ' Called to implement deletion of "self[key]". Same note '
- 'as for\n'
- ' "__getitem__()". This should only be implemented for '
- 'mappings if\n'
- ' the objects support removal of keys, or for sequences '
- 'if elements\n'
- ' can be removed from the sequence. The same exceptions '
- 'should be\n'
- ' raised for improper *key* values as for the '
- '"__getitem__()" method.\n'
- '\n'
- 'object.__iter__(self)\n'
- '\n'
- ' This method is called when an iterator is required for '
- 'a container.\n'
- ' This method should return a new iterator object that '
- 'can iterate\n'
- ' over all the objects in the container. For mappings, '
- 'it should\n'
- ' iterate over the keys of the container.\n'
- '\n'
- ' Iterator objects also need to implement this method; '
- 'they are\n'
- ' required to return themselves. For more information on '
- 'iterator\n'
- ' objects, see *Iterator Types*.\n'
- '\n'
- 'object.__reversed__(self)\n'
- '\n'
- ' Called (if present) by the "reversed()" built-in to '
- 'implement\n'
- ' reverse iteration. It should return a new iterator '
- 'object that\n'
- ' iterates over all the objects in the container in '
- 'reverse order.\n'
- '\n'
- ' If the "__reversed__()" method is not provided, the '
- '"reversed()"\n'
- ' built-in will fall back to using the sequence protocol '
- '("__len__()"\n'
- ' and "__getitem__()"). Objects that support the '
- 'sequence protocol\n'
- ' should only provide "__reversed__()" if they can '
- 'provide an\n'
- ' implementation that is more efficient than the one '
- 'provided by\n'
- ' "reversed()".\n'
- '\n'
- 'The membership test operators ("in" and "not in") are '
- 'normally\n'
- 'implemented as an iteration through a sequence. However, '
- 'container\n'
- 'objects can supply the following special method with a '
- 'more efficient\n'
- 'implementation, which also does not require the object be '
- 'a sequence.\n'
- '\n'
- 'object.__contains__(self, item)\n'
- '\n'
- ' Called to implement membership test operators. Should '
- 'return true\n'
- ' if *item* is in *self*, false otherwise. For mapping '
- 'objects, this\n'
- ' should consider the keys of the mapping rather than the '
- 'values or\n'
- ' the key-item pairs.\n'
- '\n'
- ' For objects that don\'t define "__contains__()", the '
- 'membership test\n'
- ' first tries iteration via "__iter__()", then the old '
- 'sequence\n'
- ' iteration protocol via "__getitem__()", see *this '
- 'section in the\n'
- ' language reference*.\n'
- '\n'
- '\n'
- 'Emulating numeric types\n'
- '=======================\n'
- '\n'
- 'The following methods can be defined to emulate numeric '
- 'objects.\n'
- 'Methods corresponding to operations that are not supported '
- 'by the\n'
- 'particular kind of number implemented (e.g., bitwise '
- 'operations for\n'
- 'non-integral numbers) should be left undefined.\n'
- '\n'
- 'object.__add__(self, other)\n'
- 'object.__sub__(self, other)\n'
- 'object.__mul__(self, other)\n'
- 'object.__matmul__(self, other)\n'
- 'object.__truediv__(self, other)\n'
- 'object.__floordiv__(self, other)\n'
- 'object.__mod__(self, other)\n'
- 'object.__divmod__(self, other)\n'
- 'object.__pow__(self, other[, modulo])\n'
- 'object.__lshift__(self, other)\n'
- 'object.__rshift__(self, other)\n'
- 'object.__and__(self, other)\n'
- 'object.__xor__(self, other)\n'
- 'object.__or__(self, other)\n'
- '\n'
- ' These methods are called to implement the binary '
- 'arithmetic\n'
- ' operations ("+", "-", "*", "@", "/", "//", "%", '
- '"divmod()",\n'
- ' "pow()", "**", "<<", ">>", "&", "^", "|"). For '
- 'instance, to\n'
- ' evaluate the expression "x + y", where *x* is an '
- 'instance of a\n'
- ' class that has an "__add__()" method, "x.__add__(y)" is '
- 'called.\n'
- ' The "__divmod__()" method should be the equivalent to '
- 'using\n'
- ' "__floordiv__()" and "__mod__()"; it should not be '
- 'related to\n'
- ' "__truediv__()". Note that "__pow__()" should be '
- 'defined to accept\n'
- ' an optional third argument if the ternary version of '
- 'the built-in\n'
- ' "pow()" function is to be supported.\n'
- '\n'
- ' If one of those methods does not support the operation '
- 'with the\n'
- ' supplied arguments, it should return "NotImplemented".\n'
- '\n'
- 'object.__radd__(self, other)\n'
- 'object.__rsub__(self, other)\n'
- 'object.__rmul__(self, other)\n'
- 'object.__rmatmul__(self, other)\n'
- 'object.__rtruediv__(self, other)\n'
- 'object.__rfloordiv__(self, other)\n'
- 'object.__rmod__(self, other)\n'
- 'object.__rdivmod__(self, other)\n'
- 'object.__rpow__(self, other)\n'
- 'object.__rlshift__(self, other)\n'
- 'object.__rrshift__(self, other)\n'
- 'object.__rand__(self, other)\n'
- 'object.__rxor__(self, other)\n'
- 'object.__ror__(self, other)\n'
- '\n'
- ' These methods are called to implement the binary '
- 'arithmetic\n'
- ' operations ("+", "-", "*", "@", "/", "//", "%", '
- '"divmod()",\n'
- ' "pow()", "**", "<<", ">>", "&", "^", "|") with '
- 'reflected (swapped)\n'
- ' operands. These functions are only called if the left '
- 'operand does\n'
- ' not support the corresponding operation and the '
- 'operands are of\n'
- ' different types. [2] For instance, to evaluate the '
- 'expression "x -\n'
- ' y", where *y* is an instance of a class that has an '
- '"__rsub__()"\n'
- ' method, "y.__rsub__(x)" is called if "x.__sub__(y)" '
- 'returns\n'
- ' *NotImplemented*.\n'
- '\n'
- ' Note that ternary "pow()" will not try calling '
- '"__rpow__()" (the\n'
- ' coercion rules would become too complicated).\n'
- '\n'
- " Note: If the right operand's type is a subclass of the "
- 'left\n'
- " operand's type and that subclass provides the "
- 'reflected method\n'
- ' for the operation, this method will be called before '
- 'the left\n'
- " operand's non-reflected method. This behavior allows "
- 'subclasses\n'
- " to override their ancestors' operations.\n"
- '\n'
- 'object.__iadd__(self, other)\n'
- 'object.__isub__(self, other)\n'
- 'object.__imul__(self, other)\n'
- 'object.__imatmul__(self, other)\n'
- 'object.__itruediv__(self, other)\n'
- 'object.__ifloordiv__(self, other)\n'
- 'object.__imod__(self, other)\n'
- 'object.__ipow__(self, other[, modulo])\n'
- 'object.__ilshift__(self, other)\n'
- 'object.__irshift__(self, other)\n'
- 'object.__iand__(self, other)\n'
- 'object.__ixor__(self, other)\n'
- 'object.__ior__(self, other)\n'
- '\n'
- ' These methods are called to implement the augmented '
- 'arithmetic\n'
- ' assignments ("+=", "-=", "*=", "@=", "/=", "//=", "%=", '
- '"**=",\n'
- ' "<<=", ">>=", "&=", "^=", "|="). These methods should '
- 'attempt to\n'
- ' do the operation in-place (modifying *self*) and return '
- 'the result\n'
- ' (which could be, but does not have to be, *self*). If '
- 'a specific\n'
- ' method is not defined, the augmented assignment falls '
- 'back to the\n'
- ' normal methods. For instance, if *x* is an instance of '
- 'a class\n'
- ' with an "__iadd__()" method, "x += y" is equivalent to '
- '"x =\n'
- ' x.__iadd__(y)" . Otherwise, "x.__add__(y)" and '
- '"y.__radd__(x)" are\n'
- ' considered, as with the evaluation of "x + y". In '
- 'certain\n'
- ' situations, augmented assignment can result in '
- 'unexpected errors\n'
- " (see *Why does a_tuple[i] += ['item'] raise an "
- 'exception when the\n'
- ' addition works?*), but this behavior is in fact part of '
- 'the data\n'
- ' model.\n'
- '\n'
- 'object.__neg__(self)\n'
- 'object.__pos__(self)\n'
- 'object.__abs__(self)\n'
- 'object.__invert__(self)\n'
- '\n'
- ' Called to implement the unary arithmetic operations '
- '("-", "+",\n'
- ' "abs()" and "~").\n'
- '\n'
- 'object.__complex__(self)\n'
- 'object.__int__(self)\n'
- 'object.__float__(self)\n'
- 'object.__round__(self[, n])\n'
- '\n'
- ' Called to implement the built-in functions "complex()", '
- '"int()",\n'
- ' "float()" and "round()". Should return a value of the '
- 'appropriate\n'
- ' type.\n'
- '\n'
- 'object.__index__(self)\n'
- '\n'
- ' Called to implement "operator.index()", and whenever '
- 'Python needs\n'
- ' to losslessly convert the numeric object to an integer '
- 'object (such\n'
- ' as in slicing, or in the built-in "bin()", "hex()" and '
- '"oct()"\n'
- ' functions). Presence of this method indicates that the '
- 'numeric\n'
- ' object is an integer type. Must return an integer.\n'
- '\n'
- ' Note: In order to have a coherent integer type class, '
- 'when\n'
- ' "__index__()" is defined "__int__()" should also be '
- 'defined, and\n'
- ' both should return the same value.\n'
- '\n'
- '\n'
- 'With Statement Context Managers\n'
- '===============================\n'
- '\n'
- 'A *context manager* is an object that defines the runtime '
- 'context to\n'
- 'be established when executing a "with" statement. The '
- 'context manager\n'
- 'handles the entry into, and the exit from, the desired '
- 'runtime context\n'
- 'for the execution of the block of code. Context managers '
- 'are normally\n'
- 'invoked using the "with" statement (described in section '
- '*The with\n'
- 'statement*), but can also be used by directly invoking '
- 'their methods.\n'
- '\n'
- 'Typical uses of context managers include saving and '
- 'restoring various\n'
- 'kinds of global state, locking and unlocking resources, '
- 'closing opened\n'
- 'files, etc.\n'
- '\n'
- 'For more information on context managers, see *Context '
- 'Manager Types*.\n'
- '\n'
- 'object.__enter__(self)\n'
- '\n'
- ' Enter the runtime context related to this object. The '
- '"with"\n'
- " statement will bind this method's return value to the "
- 'target(s)\n'
- ' specified in the "as" clause of the statement, if any.\n'
- '\n'
- 'object.__exit__(self, exc_type, exc_value, traceback)\n'
- '\n'
- ' Exit the runtime context related to this object. The '
- 'parameters\n'
- ' describe the exception that caused the context to be '
- 'exited. If the\n'
- ' context was exited without an exception, all three '
- 'arguments will\n'
- ' be "None".\n'
- '\n'
- ' If an exception is supplied, and the method wishes to '
- 'suppress the\n'
- ' exception (i.e., prevent it from being propagated), it '
- 'should\n'
- ' return a true value. Otherwise, the exception will be '
- 'processed\n'
- ' normally upon exit from this method.\n'
- '\n'
- ' Note that "__exit__()" methods should not reraise the '
- 'passed-in\n'
- " exception; this is the caller's responsibility.\n"
- '\n'
- 'See also: **PEP 0343** - The "with" statement\n'
- '\n'
- ' The specification, background, and examples for the '
- 'Python "with"\n'
- ' statement.\n'
- '\n'
- '\n'
- 'Special method lookup\n'
- '=====================\n'
- '\n'
- 'For custom classes, implicit invocations of special '
- 'methods are only\n'
- "guaranteed to work correctly if defined on an object's "
- 'type, not in\n'
- "the object's instance dictionary. That behaviour is the "
- 'reason why\n'
- 'the following code raises an exception:\n'
- '\n'
- ' >>> class C:\n'
- ' ... pass\n'
- ' ...\n'
- ' >>> c = C()\n'
- ' >>> c.__len__ = lambda: 5\n'
- ' >>> len(c)\n'
- ' Traceback (most recent call last):\n'
- ' File "<stdin>", line 1, in <module>\n'
- " TypeError: object of type 'C' has no len()\n"
- '\n'
- 'The rationale behind this behaviour lies with a number of '
- 'special\n'
- 'methods such as "__hash__()" and "__repr__()" that are '
- 'implemented by\n'
- 'all objects, including type objects. If the implicit '
- 'lookup of these\n'
- 'methods used the conventional lookup process, they would '
- 'fail when\n'
- 'invoked on the type object itself:\n'
- '\n'
- ' >>> 1 .__hash__() == hash(1)\n'
- ' True\n'
- ' >>> int.__hash__() == hash(int)\n'
- ' Traceback (most recent call last):\n'
- ' File "<stdin>", line 1, in <module>\n'
- " TypeError: descriptor '__hash__' of 'int' object needs "
- 'an argument\n'
- '\n'
- 'Incorrectly attempting to invoke an unbound method of a '
- 'class in this\n'
- "way is sometimes referred to as 'metaclass confusion', and "
- 'is avoided\n'
- 'by bypassing the instance when looking up special '
- 'methods:\n'
- '\n'
- ' >>> type(1).__hash__(1) == hash(1)\n'
- ' True\n'
- ' >>> type(int).__hash__(int) == hash(int)\n'
- ' True\n'
- '\n'
- 'In addition to bypassing any instance attributes in the '
- 'interest of\n'
- 'correctness, implicit special method lookup generally also '
- 'bypasses\n'
- 'the "__getattribute__()" method even of the object\'s '
- 'metaclass:\n'
- '\n'
- ' >>> class Meta(type):\n'
- ' ... def __getattribute__(*args):\n'
- ' ... print("Metaclass getattribute invoked")\n'
- ' ... return type.__getattribute__(*args)\n'
- ' ...\n'
- ' >>> class C(object, metaclass=Meta):\n'
- ' ... def __len__(self):\n'
- ' ... return 10\n'
- ' ... def __getattribute__(*args):\n'
- ' ... print("Class getattribute invoked")\n'
- ' ... return object.__getattribute__(*args)\n'
- ' ...\n'
- ' >>> c = C()\n'
- ' >>> c.__len__() # Explicit lookup via '
- 'instance\n'
- ' Class getattribute invoked\n'
- ' 10\n'
- ' >>> type(c).__len__(c) # Explicit lookup via '
- 'type\n'
- ' Metaclass getattribute invoked\n'
- ' 10\n'
- ' >>> len(c) # Implicit lookup\n'
- ' 10\n'
- '\n'
- 'Bypassing the "__getattribute__()" machinery in this '
- 'fashion provides\n'
- 'significant scope for speed optimisations within the '
- 'interpreter, at\n'
- 'the cost of some flexibility in the handling of special '
- 'methods (the\n'
- 'special method *must* be set on the class object itself in '
- 'order to be\n'
- 'consistently invoked by the interpreter).\n',
- 'string-methods': '\n'
- 'String Methods\n'
- '**************\n'
- '\n'
- 'Strings implement all of the *common* sequence '
- 'operations, along with\n'
- 'the additional methods described below.\n'
- '\n'
- 'Strings also support two styles of string formatting, '
- 'one providing a\n'
- 'large degree of flexibility and customization (see '
- '"str.format()",\n'
- '*Format String Syntax* and *String Formatting*) and the '
- 'other based on\n'
- 'C "printf" style formatting that handles a narrower '
- 'range of types and\n'
- 'is slightly harder to use correctly, but is often faster '
- 'for the cases\n'
- 'it can handle (*printf-style String Formatting*).\n'
- '\n'
- 'The *Text Processing Services* section of the standard '
- 'library covers\n'
- 'a number of other modules that provide various text '
- 'related utilities\n'
- '(including regular expression support in the "re" '
- 'module).\n'
- '\n'
- 'str.capitalize()\n'
- '\n'
- ' Return a copy of the string with its first character '
- 'capitalized\n'
- ' and the rest lowercased.\n'
- '\n'
- 'str.casefold()\n'
- '\n'
- ' Return a casefolded copy of the string. Casefolded '
- 'strings may be\n'
- ' used for caseless matching.\n'
- '\n'
- ' Casefolding is similar to lowercasing but more '
- 'aggressive because\n'
- ' it is intended to remove all case distinctions in a '
- 'string. For\n'
- ' example, the German lowercase letter "\'ß\'" is '
- 'equivalent to ""ss"".\n'
- ' Since it is already lowercase, "lower()" would do '
- 'nothing to "\'ß\'";\n'
- ' "casefold()" converts it to ""ss"".\n'
- '\n'
- ' The casefolding algorithm is described in section '
- '3.13 of the\n'
- ' Unicode Standard.\n'
- '\n'
- ' New in version 3.3.\n'
- '\n'
- 'str.center(width[, fillchar])\n'
- '\n'
- ' Return centered in a string of length *width*. '
- 'Padding is done\n'
- ' using the specified *fillchar* (default is an ASCII '
- 'space). The\n'
- ' original string is returned if *width* is less than '
- 'or equal to\n'
- ' "len(s)".\n'
- '\n'
- 'str.count(sub[, start[, end]])\n'
- '\n'
- ' Return the number of non-overlapping occurrences of '
- 'substring *sub*\n'
- ' in the range [*start*, *end*]. Optional arguments '
- '*start* and\n'
- ' *end* are interpreted as in slice notation.\n'
- '\n'
- 'str.encode(encoding="utf-8", errors="strict")\n'
- '\n'
- ' Return an encoded version of the string as a bytes '
- 'object. Default\n'
- ' encoding is "\'utf-8\'". *errors* may be given to set '
- 'a different\n'
- ' error handling scheme. The default for *errors* is '
- '"\'strict\'",\n'
- ' meaning that encoding errors raise a "UnicodeError". '
- 'Other possible\n'
- ' values are "\'ignore\'", "\'replace\'", '
- '"\'xmlcharrefreplace\'",\n'
- ' "\'backslashreplace\'" and any other name registered '
- 'via\n'
- ' "codecs.register_error()", see section *Error '
- 'Handlers*. For a list\n'
- ' of possible encodings, see section *Standard '
- 'Encodings*.\n'
- '\n'
- ' Changed in version 3.1: Support for keyword arguments '
- 'added.\n'
- '\n'
- 'str.endswith(suffix[, start[, end]])\n'
- '\n'
- ' Return "True" if the string ends with the specified '
- '*suffix*,\n'
- ' otherwise return "False". *suffix* can also be a '
- 'tuple of suffixes\n'
- ' to look for. With optional *start*, test beginning '
- 'at that\n'
- ' position. With optional *end*, stop comparing at '
- 'that position.\n'
- '\n'
- 'str.expandtabs(tabsize=8)\n'
- '\n'
- ' Return a copy of the string where all tab characters '
- 'are replaced\n'
- ' by one or more spaces, depending on the current '
- 'column and the\n'
- ' given tab size. Tab positions occur every *tabsize* '
- 'characters\n'
- ' (default is 8, giving tab positions at columns 0, 8, '
- '16 and so on).\n'
- ' To expand the string, the current column is set to '
- 'zero and the\n'
- ' string is examined character by character. If the '
- 'character is a\n'
- ' tab ("\\t"), one or more space characters are '
- 'inserted in the result\n'
- ' until the current column is equal to the next tab '
- 'position. (The\n'
- ' tab character itself is not copied.) If the '
- 'character is a newline\n'
- ' ("\\n") or return ("\\r"), it is copied and the '
- 'current column is\n'
- ' reset to zero. Any other character is copied '
- 'unchanged and the\n'
- ' current column is incremented by one regardless of '
- 'how the\n'
- ' character is represented when printed.\n'
- '\n'
- " >>> '01\\t012\\t0123\\t01234'.expandtabs()\n"
- " '01 012 0123 01234'\n"
- " >>> '01\\t012\\t0123\\t01234'.expandtabs(4)\n"
- " '01 012 0123 01234'\n"
- '\n'
- 'str.find(sub[, start[, end]])\n'
- '\n'
- ' Return the lowest index in the string where substring '
- '*sub* is\n'
- ' found, such that *sub* is contained in the slice '
- '"s[start:end]".\n'
- ' Optional arguments *start* and *end* are interpreted '
- 'as in slice\n'
- ' notation. Return "-1" if *sub* is not found.\n'
- '\n'
- ' Note: The "find()" method should be used only if you '
- 'need to know\n'
- ' the position of *sub*. To check if *sub* is a '
- 'substring or not,\n'
- ' use the "in" operator:\n'
- '\n'
- " >>> 'Py' in 'Python'\n"
- ' True\n'
- '\n'
- 'str.format(*args, **kwargs)\n'
- '\n'
- ' Perform a string formatting operation. The string on '
- 'which this\n'
- ' method is called can contain literal text or '
- 'replacement fields\n'
- ' delimited by braces "{}". Each replacement field '
- 'contains either\n'
- ' the numeric index of a positional argument, or the '
- 'name of a\n'
- ' keyword argument. Returns a copy of the string where '
- 'each\n'
- ' replacement field is replaced with the string value '
- 'of the\n'
- ' corresponding argument.\n'
- '\n'
- ' >>> "The sum of 1 + 2 is {0}".format(1+2)\n'
- " 'The sum of 1 + 2 is 3'\n"
- '\n'
- ' See *Format String Syntax* for a description of the '
- 'various\n'
- ' formatting options that can be specified in format '
- 'strings.\n'
- '\n'
- 'str.format_map(mapping)\n'
- '\n'
- ' Similar to "str.format(**mapping)", except that '
- '"mapping" is used\n'
- ' directly and not copied to a "dict". This is useful '
- 'if for example\n'
- ' "mapping" is a dict subclass:\n'
- '\n'
- ' >>> class Default(dict):\n'
- ' ... def __missing__(self, key):\n'
- ' ... return key\n'
- ' ...\n'
- " >>> '{name} was born in "
- "{country}'.format_map(Default(name='Guido'))\n"
- " 'Guido was born in country'\n"
- '\n'
- ' New in version 3.2.\n'
- '\n'
- 'str.index(sub[, start[, end]])\n'
- '\n'
- ' Like "find()", but raise "ValueError" when the '
- 'substring is not\n'
- ' found.\n'
- '\n'
- 'str.isalnum()\n'
- '\n'
- ' Return true if all characters in the string are '
- 'alphanumeric and\n'
- ' there is at least one character, false otherwise. A '
- 'character "c"\n'
- ' is alphanumeric if one of the following returns '
- '"True":\n'
- ' "c.isalpha()", "c.isdecimal()", "c.isdigit()", or '
- '"c.isnumeric()".\n'
- '\n'
- 'str.isalpha()\n'
- '\n'
- ' Return true if all characters in the string are '
- 'alphabetic and\n'
- ' there is at least one character, false otherwise. '
- 'Alphabetic\n'
- ' characters are those characters defined in the '
- 'Unicode character\n'
- ' database as "Letter", i.e., those with general '
- 'category property\n'
- ' being one of "Lm", "Lt", "Lu", "Ll", or "Lo". Note '
- 'that this is\n'
- ' different from the "Alphabetic" property defined in '
- 'the Unicode\n'
- ' Standard.\n'
- '\n'
- 'str.isdecimal()\n'
- '\n'
- ' Return true if all characters in the string are '
- 'decimal characters\n'
- ' and there is at least one character, false otherwise. '
- 'Decimal\n'
- ' characters are those from general category "Nd". This '
- 'category\n'
- ' includes digit characters, and all characters that '
- 'can be used to\n'
- ' form decimal-radix numbers, e.g. U+0660, ARABIC-INDIC '
- 'DIGIT ZERO.\n'
- '\n'
- 'str.isdigit()\n'
- '\n'
- ' Return true if all characters in the string are '
- 'digits and there is\n'
- ' at least one character, false otherwise. Digits '
- 'include decimal\n'
- ' characters and digits that need special handling, '
- 'such as the\n'
- ' compatibility superscript digits. Formally, a digit '
- 'is a character\n'
- ' that has the property value Numeric_Type=Digit or\n'
- ' Numeric_Type=Decimal.\n'
- '\n'
- 'str.isidentifier()\n'
- '\n'
- ' Return true if the string is a valid identifier '
- 'according to the\n'
- ' language definition, section *Identifiers and '
- 'keywords*.\n'
- '\n'
- ' Use "keyword.iskeyword()" to test for reserved '
- 'identifiers such as\n'
- ' "def" and "class".\n'
- '\n'
- 'str.islower()\n'
- '\n'
- ' Return true if all cased characters [4] in the string '
- 'are lowercase\n'
- ' and there is at least one cased character, false '
- 'otherwise.\n'
- '\n'
- 'str.isnumeric()\n'
- '\n'
- ' Return true if all characters in the string are '
- 'numeric characters,\n'
- ' and there is at least one character, false otherwise. '
- 'Numeric\n'
- ' characters include digit characters, and all '
- 'characters that have\n'
- ' the Unicode numeric value property, e.g. U+2155, '
- 'VULGAR FRACTION\n'
- ' ONE FIFTH. Formally, numeric characters are those '
- 'with the\n'
- ' property value Numeric_Type=Digit, '
- 'Numeric_Type=Decimal or\n'
- ' Numeric_Type=Numeric.\n'
- '\n'
- 'str.isprintable()\n'
- '\n'
- ' Return true if all characters in the string are '
- 'printable or the\n'
- ' string is empty, false otherwise. Nonprintable '
- 'characters are\n'
- ' those characters defined in the Unicode character '
- 'database as\n'
- ' "Other" or "Separator", excepting the ASCII space '
- '(0x20) which is\n'
- ' considered printable. (Note that printable '
- 'characters in this\n'
- ' context are those which should not be escaped when '
- '"repr()" is\n'
- ' invoked on a string. It has no bearing on the '
- 'handling of strings\n'
- ' written to "sys.stdout" or "sys.stderr".)\n'
- '\n'
- 'str.isspace()\n'
- '\n'
- ' Return true if there are only whitespace characters '
- 'in the string\n'
- ' and there is at least one character, false '
- 'otherwise. Whitespace\n'
- ' characters are those characters defined in the '
- 'Unicode character\n'
- ' database as "Other" or "Separator" and those with '
- 'bidirectional\n'
- ' property being one of "WS", "B", or "S".\n'
- '\n'
- 'str.istitle()\n'
- '\n'
- ' Return true if the string is a titlecased string and '
- 'there is at\n'
- ' least one character, for example uppercase characters '
- 'may only\n'
- ' follow uncased characters and lowercase characters '
- 'only cased ones.\n'
- ' Return false otherwise.\n'
- '\n'
- 'str.isupper()\n'
- '\n'
- ' Return true if all cased characters [4] in the string '
- 'are uppercase\n'
- ' and there is at least one cased character, false '
- 'otherwise.\n'
- '\n'
- 'str.join(iterable)\n'
- '\n'
- ' Return a string which is the concatenation of the '
- 'strings in the\n'
- ' *iterable* *iterable*. A "TypeError" will be raised '
- 'if there are\n'
- ' any non-string values in *iterable*, including '
- '"bytes" objects.\n'
- ' The separator between elements is the string '
- 'providing this method.\n'
- '\n'
- 'str.ljust(width[, fillchar])\n'
- '\n'
- ' Return the string left justified in a string of '
- 'length *width*.\n'
- ' Padding is done using the specified *fillchar* '
- '(default is an ASCII\n'
- ' space). The original string is returned if *width* is '
- 'less than or\n'
- ' equal to "len(s)".\n'
- '\n'
- 'str.lower()\n'
- '\n'
- ' Return a copy of the string with all the cased '
- 'characters [4]\n'
- ' converted to lowercase.\n'
- '\n'
- ' The lowercasing algorithm used is described in '
- 'section 3.13 of the\n'
- ' Unicode Standard.\n'
- '\n'
- 'str.lstrip([chars])\n'
- '\n'
- ' Return a copy of the string with leading characters '
- 'removed. The\n'
- ' *chars* argument is a string specifying the set of '
- 'characters to be\n'
- ' removed. If omitted or "None", the *chars* argument '
- 'defaults to\n'
- ' removing whitespace. The *chars* argument is not a '
- 'prefix; rather,\n'
- ' all combinations of its values are stripped:\n'
- '\n'
- " >>> ' spacious '.lstrip()\n"
- " 'spacious '\n"
- " >>> 'www.example.com'.lstrip('cmowz.')\n"
- " 'example.com'\n"
- '\n'
- 'static str.maketrans(x[, y[, z]])\n'
- '\n'
- ' This static method returns a translation table usable '
- 'for\n'
- ' "str.translate()".\n'
- '\n'
- ' If there is only one argument, it must be a '
- 'dictionary mapping\n'
- ' Unicode ordinals (integers) or characters (strings of '
- 'length 1) to\n'
- ' Unicode ordinals, strings (of arbitrary lengths) or '
- 'None.\n'
- ' Character keys will then be converted to ordinals.\n'
- '\n'
- ' If there are two arguments, they must be strings of '
- 'equal length,\n'
- ' and in the resulting dictionary, each character in x '
- 'will be mapped\n'
- ' to the character at the same position in y. If there '
- 'is a third\n'
- ' argument, it must be a string, whose characters will '
- 'be mapped to\n'
- ' None in the result.\n'
- '\n'
- 'str.partition(sep)\n'
- '\n'
- ' Split the string at the first occurrence of *sep*, '
- 'and return a\n'
- ' 3-tuple containing the part before the separator, the '
- 'separator\n'
- ' itself, and the part after the separator. If the '
- 'separator is not\n'
- ' found, return a 3-tuple containing the string itself, '
- 'followed by\n'
- ' two empty strings.\n'
- '\n'
- 'str.replace(old, new[, count])\n'
- '\n'
- ' Return a copy of the string with all occurrences of '
- 'substring *old*\n'
- ' replaced by *new*. If the optional argument *count* '
- 'is given, only\n'
- ' the first *count* occurrences are replaced.\n'
- '\n'
- 'str.rfind(sub[, start[, end]])\n'
- '\n'
- ' Return the highest index in the string where '
- 'substring *sub* is\n'
- ' found, such that *sub* is contained within '
- '"s[start:end]".\n'
- ' Optional arguments *start* and *end* are interpreted '
- 'as in slice\n'
- ' notation. Return "-1" on failure.\n'
- '\n'
- 'str.rindex(sub[, start[, end]])\n'
- '\n'
- ' Like "rfind()" but raises "ValueError" when the '
- 'substring *sub* is\n'
- ' not found.\n'
- '\n'
- 'str.rjust(width[, fillchar])\n'
- '\n'
- ' Return the string right justified in a string of '
- 'length *width*.\n'
- ' Padding is done using the specified *fillchar* '
- '(default is an ASCII\n'
- ' space). The original string is returned if *width* is '
- 'less than or\n'
- ' equal to "len(s)".\n'
- '\n'
- 'str.rpartition(sep)\n'
- '\n'
- ' Split the string at the last occurrence of *sep*, and '
- 'return a\n'
- ' 3-tuple containing the part before the separator, the '
- 'separator\n'
- ' itself, and the part after the separator. If the '
- 'separator is not\n'
- ' found, return a 3-tuple containing two empty strings, '
- 'followed by\n'
- ' the string itself.\n'
- '\n'
- 'str.rsplit(sep=None, maxsplit=-1)\n'
- '\n'
- ' Return a list of the words in the string, using *sep* '
- 'as the\n'
- ' delimiter string. If *maxsplit* is given, at most '
- '*maxsplit* splits\n'
- ' are done, the *rightmost* ones. If *sep* is not '
- 'specified or\n'
- ' "None", any whitespace string is a separator. Except '
- 'for splitting\n'
- ' from the right, "rsplit()" behaves like "split()" '
- 'which is\n'
- ' described in detail below.\n'
- '\n'
- 'str.rstrip([chars])\n'
- '\n'
- ' Return a copy of the string with trailing characters '
- 'removed. The\n'
- ' *chars* argument is a string specifying the set of '
- 'characters to be\n'
- ' removed. If omitted or "None", the *chars* argument '
- 'defaults to\n'
- ' removing whitespace. The *chars* argument is not a '
- 'suffix; rather,\n'
- ' all combinations of its values are stripped:\n'
- '\n'
- " >>> ' spacious '.rstrip()\n"
- " ' spacious'\n"
- " >>> 'mississippi'.rstrip('ipz')\n"
- " 'mississ'\n"
- '\n'
- 'str.split(sep=None, maxsplit=-1)\n'
- '\n'
- ' Return a list of the words in the string, using *sep* '
- 'as the\n'
- ' delimiter string. If *maxsplit* is given, at most '
- '*maxsplit*\n'
- ' splits are done (thus, the list will have at most '
- '"maxsplit+1"\n'
- ' elements). If *maxsplit* is not specified or "-1", '
- 'then there is\n'
- ' no limit on the number of splits (all possible splits '
- 'are made).\n'
- '\n'
- ' If *sep* is given, consecutive delimiters are not '
- 'grouped together\n'
- ' and are deemed to delimit empty strings (for '
- 'example,\n'
- ' "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', '
- '\'2\']"). The *sep* argument\n'
- ' may consist of multiple characters (for example,\n'
- ' "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', '
- '\'3\']"). Splitting an\n'
- ' empty string with a specified separator returns '
- '"[\'\']".\n'
- '\n'
- ' For example:\n'
- '\n'
- " >>> '1,2,3'.split(',')\n"
- " ['1', '2', '3']\n"
- " >>> '1,2,3'.split(',', maxsplit=1)\n"
- " ['1', '2,3']\n"
- " >>> '1,2,,3,'.split(',')\n"
- " ['1', '2', '', '3', '']\n"
- '\n'
- ' If *sep* is not specified or is "None", a different '
- 'splitting\n'
- ' algorithm is applied: runs of consecutive whitespace '
- 'are regarded\n'
- ' as a single separator, and the result will contain no '
- 'empty strings\n'
- ' at the start or end if the string has leading or '
- 'trailing\n'
- ' whitespace. Consequently, splitting an empty string '
- 'or a string\n'
- ' consisting of just whitespace with a "None" separator '
- 'returns "[]".\n'
- '\n'
- ' For example:\n'
- '\n'
- " >>> '1 2 3'.split()\n"
- " ['1', '2', '3']\n"
- " >>> '1 2 3'.split(maxsplit=1)\n"
- " ['1', '2 3']\n"
- " >>> ' 1 2 3 '.split()\n"
- " ['1', '2', '3']\n"
- '\n'
- 'str.splitlines([keepends])\n'
- '\n'
- ' Return a list of the lines in the string, breaking at '
- 'line\n'
- ' boundaries. Line breaks are not included in the '
- 'resulting list\n'
- ' unless *keepends* is given and true.\n'
- '\n'
- ' This method splits on the following line boundaries. '
- 'In\n'
- ' particular, the boundaries are a superset of '
- '*universal newlines*.\n'
- '\n'
- ' '
- '+-------------------------+-------------------------------+\n'
- ' | Representation | '
- 'Description |\n'
- ' '
- '+=========================+===============================+\n'
- ' | "\\n" | Line '
- 'Feed |\n'
- ' '
- '+-------------------------+-------------------------------+\n'
- ' | "\\r" | Carriage '
- 'Return |\n'
- ' '
- '+-------------------------+-------------------------------+\n'
- ' | "\\r\\n" | Carriage Return + Line '
- 'Feed |\n'
- ' '
- '+-------------------------+-------------------------------+\n'
- ' | "\\v" or "\\x0b" | Line '
- 'Tabulation |\n'
- ' '
- '+-------------------------+-------------------------------+\n'
- ' | "\\f" or "\\x0c" | Form '
- 'Feed |\n'
- ' '
- '+-------------------------+-------------------------------+\n'
- ' | "\\x1c" | File '
- 'Separator |\n'
- ' '
- '+-------------------------+-------------------------------+\n'
- ' | "\\x1d" | Group '
- 'Separator |\n'
- ' '
- '+-------------------------+-------------------------------+\n'
- ' | "\\x1e" | Record '
- 'Separator |\n'
- ' '
- '+-------------------------+-------------------------------+\n'
- ' | "\\x85" | Next Line (C1 Control '
- 'Code) |\n'
- ' '
- '+-------------------------+-------------------------------+\n'
- ' | "\\u2028" | Line '
- 'Separator |\n'
- ' '
- '+-------------------------+-------------------------------+\n'
- ' | "\\u2029" | Paragraph '
- 'Separator |\n'
- ' '
- '+-------------------------+-------------------------------+\n'
- '\n'
- ' Changed in version 3.2: "\\v" and "\\f" added to list '
- 'of line\n'
- ' boundaries.\n'
- '\n'
- ' For example:\n'
- '\n'
- " >>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n"
- " ['ab c', '', 'de fg', 'kl']\n"
- " >>> 'ab c\\n\\nde "
- "fg\\rkl\\r\\n'.splitlines(keepends=True)\n"
- " ['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']\n"
- '\n'
- ' Unlike "split()" when a delimiter string *sep* is '
- 'given, this\n'
- ' method returns an empty list for the empty string, '
- 'and a terminal\n'
- ' line break does not result in an extra line:\n'
- '\n'
- ' >>> "".splitlines()\n'
- ' []\n'
- ' >>> "One line\\n".splitlines()\n'
- " ['One line']\n"
- '\n'
- ' For comparison, "split(\'\\n\')" gives:\n'
- '\n'
- " >>> ''.split('\\n')\n"
- " ['']\n"
- " >>> 'Two lines\\n'.split('\\n')\n"
- " ['Two lines', '']\n"
- '\n'
- 'str.startswith(prefix[, start[, end]])\n'
- '\n'
- ' Return "True" if string starts with the *prefix*, '
- 'otherwise return\n'
- ' "False". *prefix* can also be a tuple of prefixes to '
- 'look for.\n'
- ' With optional *start*, test string beginning at that '
- 'position.\n'
- ' With optional *end*, stop comparing string at that '
- 'position.\n'
- '\n'
- 'str.strip([chars])\n'
- '\n'
- ' Return a copy of the string with the leading and '
- 'trailing\n'
- ' characters removed. The *chars* argument is a string '
- 'specifying the\n'
- ' set of characters to be removed. If omitted or '
- '"None", the *chars*\n'
- ' argument defaults to removing whitespace. The *chars* '
- 'argument is\n'
- ' not a prefix or suffix; rather, all combinations of '
- 'its values are\n'
- ' stripped:\n'
- '\n'
- " >>> ' spacious '.strip()\n"
- " 'spacious'\n"
- " >>> 'www.example.com'.strip('cmowz.')\n"
- " 'example'\n"
- '\n'
- ' The outermost leading and trailing *chars* argument '
- 'values are\n'
- ' stripped from the string. Characters are removed from '
- 'the leading\n'
- ' end until reaching a string character that is not '
- 'contained in the\n'
- ' set of characters in *chars*. A similar action takes '
- 'place on the\n'
- ' trailing end. For example:\n'
- '\n'
- " >>> comment_string = '#....... Section 3.2.1 Issue "
- "#32 .......'\n"
- " >>> comment_string.strip('.#! ')\n"
- " 'Section 3.2.1 Issue #32'\n"
- '\n'
- 'str.swapcase()\n'
- '\n'
- ' Return a copy of the string with uppercase characters '
- 'converted to\n'
- ' lowercase and vice versa. Note that it is not '
- 'necessarily true that\n'
- ' "s.swapcase().swapcase() == s".\n'
- '\n'
- 'str.title()\n'
- '\n'
- ' Return a titlecased version of the string where words '
- 'start with an\n'
- ' uppercase character and the remaining characters are '
- 'lowercase.\n'
- '\n'
- ' For example:\n'
- '\n'
- " >>> 'Hello world'.title()\n"
- " 'Hello World'\n"
- '\n'
- ' The algorithm uses a simple language-independent '
- 'definition of a\n'
- ' word as groups of consecutive letters. The '
- 'definition works in\n'
- ' many contexts but it means that apostrophes in '
- 'contractions and\n'
- ' possessives form word boundaries, which may not be '
- 'the desired\n'
- ' result:\n'
- '\n'
- ' >>> "they\'re bill\'s friends from the '
- 'UK".title()\n'
- ' "They\'Re Bill\'S Friends From The Uk"\n'
- '\n'
- ' A workaround for apostrophes can be constructed using '
- 'regular\n'
- ' expressions:\n'
- '\n'
- ' >>> import re\n'
- ' >>> def titlecase(s):\n'
- ' ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n'
- ' ... lambda mo: '
- 'mo.group(0)[0].upper() +\n'
- ' ... '
- 'mo.group(0)[1:].lower(),\n'
- ' ... s)\n'
- ' ...\n'
- ' >>> titlecase("they\'re bill\'s friends.")\n'
- ' "They\'re Bill\'s Friends."\n'
- '\n'
- 'str.translate(table)\n'
- '\n'
- ' Return a copy of the string in which each character '
- 'has been mapped\n'
- ' through the given translation table. The table must '
- 'be an object\n'
- ' that implements indexing via "__getitem__()", '
- 'typically a *mapping*\n'
- ' or *sequence*. When indexed by a Unicode ordinal (an '
- 'integer), the\n'
- ' table object can do any of the following: return a '
- 'Unicode ordinal\n'
- ' or a string, to map the character to one or more '
- 'other characters;\n'
- ' return "None", to delete the character from the '
- 'return string; or\n'
- ' raise a "LookupError" exception, to map the character '
- 'to itself.\n'
- '\n'
- ' You can use "str.maketrans()" to create a translation '
- 'map from\n'
- ' character-to-character mappings in different '
- 'formats.\n'
- '\n'
- ' See also the "codecs" module for a more flexible '
- 'approach to custom\n'
- ' character mappings.\n'
- '\n'
- 'str.upper()\n'
- '\n'
- ' Return a copy of the string with all the cased '
- 'characters [4]\n'
- ' converted to uppercase. Note that '
- '"str.upper().isupper()" might be\n'
- ' "False" if "s" contains uncased characters or if the '
- 'Unicode\n'
- ' category of the resulting character(s) is not "Lu" '
- '(Letter,\n'
- ' uppercase), but e.g. "Lt" (Letter, titlecase).\n'
- '\n'
- ' The uppercasing algorithm used is described in '
- 'section 3.13 of the\n'
- ' Unicode Standard.\n'
- '\n'
- 'str.zfill(width)\n'
- '\n'
- ' Return a copy of the string left filled with ASCII '
- '"\'0\'" digits to\n'
- ' make a string of length *width*. A leading sign '
- 'prefix\n'
- ' ("\'+\'"/"\'-\'") is handled by inserting the padding '
- '*after* the sign\n'
- ' character rather than before. The original string is '
- 'returned if\n'
- ' *width* is less than or equal to "len(s)".\n'
- '\n'
- ' For example:\n'
- '\n'
- ' >>> "42".zfill(5)\n'
- " '00042'\n"
- ' >>> "-42".zfill(5)\n'
- " '-0042'\n",
- 'strings': '\n'
- 'String and Bytes literals\n'
- '*************************\n'
- '\n'
- 'String literals are described by the following lexical '
- 'definitions:\n'
- '\n'
- ' stringliteral ::= [stringprefix](shortstring | '
- 'longstring)\n'
- ' stringprefix ::= "r" | "u" | "R" | "U"\n'
- ' shortstring ::= "\'" shortstringitem* "\'" | \'"\' '
- 'shortstringitem* \'"\'\n'
- ' longstring ::= "\'\'\'" longstringitem* "\'\'\'" | '
- '\'"""\' longstringitem* \'"""\'\n'
- ' shortstringitem ::= shortstringchar | stringescapeseq\n'
- ' longstringitem ::= longstringchar | stringescapeseq\n'
- ' shortstringchar ::= <any source character except "\\" or '
- 'newline or the quote>\n'
- ' longstringchar ::= <any source character except "\\">\n'
- ' stringescapeseq ::= "\\" <any source character>\n'
- '\n'
- ' bytesliteral ::= bytesprefix(shortbytes | longbytes)\n'
- ' bytesprefix ::= "b" | "B" | "br" | "Br" | "bR" | "BR" | '
- '"rb" | "rB" | "Rb" | "RB"\n'
- ' shortbytes ::= "\'" shortbytesitem* "\'" | \'"\' '
- 'shortbytesitem* \'"\'\n'
- ' longbytes ::= "\'\'\'" longbytesitem* "\'\'\'" | '
- '\'"""\' longbytesitem* \'"""\'\n'
- ' shortbytesitem ::= shortbyteschar | bytesescapeseq\n'
- ' longbytesitem ::= longbyteschar | bytesescapeseq\n'
- ' shortbyteschar ::= <any ASCII character except "\\" or '
- 'newline or the quote>\n'
- ' longbyteschar ::= <any ASCII character except "\\">\n'
- ' bytesescapeseq ::= "\\" <any ASCII character>\n'
- '\n'
- 'One syntactic restriction not indicated by these productions is '
- 'that\n'
- 'whitespace is not allowed between the "stringprefix" or '
- '"bytesprefix"\n'
- 'and the rest of the literal. The source character set is '
- 'defined by\n'
- 'the encoding declaration; it is UTF-8 if no encoding '
- 'declaration is\n'
- 'given in the source file; see section *Encoding declarations*.\n'
- '\n'
- 'In plain English: Both types of literals can be enclosed in '
- 'matching\n'
- 'single quotes ("\'") or double quotes ("""). They can also be '
- 'enclosed\n'
- 'in matching groups of three single or double quotes (these are\n'
- 'generally referred to as *triple-quoted strings*). The '
- 'backslash\n'
- '("\\") character is used to escape characters that otherwise '
- 'have a\n'
- 'special meaning, such as newline, backslash itself, or the '
- 'quote\n'
- 'character.\n'
- '\n'
- 'Bytes literals are always prefixed with "\'b\'" or "\'B\'"; '
- 'they produce\n'
- 'an instance of the "bytes" type instead of the "str" type. '
- 'They may\n'
- 'only contain ASCII characters; bytes with a numeric value of '
- '128 or\n'
- 'greater must be expressed with escapes.\n'
- '\n'
- 'As of Python 3.3 it is possible again to prefix string literals '
- 'with a\n'
- '"u" prefix to simplify maintenance of dual 2.x and 3.x '
- 'codebases.\n'
- '\n'
- 'Both string and bytes literals may optionally be prefixed with '
- 'a\n'
- 'letter "\'r\'" or "\'R\'"; such strings are called *raw '
- 'strings* and treat\n'
- 'backslashes as literal characters. As a result, in string '
- 'literals,\n'
- '"\'\\U\'" and "\'\\u\'" escapes in raw strings are not treated '
- 'specially.\n'
- "Given that Python 2.x's raw unicode literals behave differently "
- 'than\n'
- 'Python 3.x\'s the "\'ur\'" syntax is not supported.\n'
- '\n'
- 'New in version 3.3: The "\'rb\'" prefix of raw bytes literals '
- 'has been\n'
- 'added as a synonym of "\'br\'".\n'
- '\n'
- 'New in version 3.3: Support for the unicode legacy literal\n'
- '("u\'value\'") was reintroduced to simplify the maintenance of '
- 'dual\n'
- 'Python 2.x and 3.x codebases. See **PEP 414** for more '
- 'information.\n'
- '\n'
- 'In triple-quoted literals, unescaped newlines and quotes are '
- 'allowed\n'
- '(and are retained), except that three unescaped quotes in a '
- 'row\n'
- 'terminate the literal. (A "quote" is the character used to '
- 'open the\n'
- 'literal, i.e. either "\'" or """.)\n'
- '\n'
- 'Unless an "\'r\'" or "\'R\'" prefix is present, escape '
- 'sequences in string\n'
- 'and bytes literals are interpreted according to rules similar '
- 'to those\n'
- 'used by Standard C. The recognized escape sequences are:\n'
- '\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| Escape Sequence | Meaning | '
- 'Notes |\n'
- '+===================+===================================+=========+\n'
- '| "\\newline" | Backslash and newline ignored '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\\\" | Backslash ("\\") '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\\'" | Single quote ("\'") '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\"" | Double quote (""") '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\a" | ASCII Bell (BEL) '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\b" | ASCII Backspace (BS) '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\f" | ASCII Formfeed (FF) '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\n" | ASCII Linefeed (LF) '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\r" | ASCII Carriage Return (CR) '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\t" | ASCII Horizontal Tab (TAB) '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\v" | ASCII Vertical Tab (VT) '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\ooo" | Character with octal value *ooo* | '
- '(1,3) |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\xhh" | Character with hex value *hh* | '
- '(2,3) |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '\n'
- 'Escape sequences only recognized in string literals are:\n'
- '\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| Escape Sequence | Meaning | '
- 'Notes |\n'
- '+===================+===================================+=========+\n'
- '| "\\N{name}" | Character named *name* in the | '
- '(4) |\n'
- '| | Unicode database '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\uxxxx" | Character with 16-bit hex value | '
- '(5) |\n'
- '| | *xxxx* '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '| "\\Uxxxxxxxx" | Character with 32-bit hex value | '
- '(6) |\n'
- '| | *xxxxxxxx* '
- '| |\n'
- '+-------------------+-----------------------------------+---------+\n'
- '\n'
- 'Notes:\n'
- '\n'
- '1. As in Standard C, up to three octal digits are accepted.\n'
- '\n'
- '2. Unlike in Standard C, exactly two hex digits are required.\n'
- '\n'
- '3. In a bytes literal, hexadecimal and octal escapes denote '
- 'the\n'
- ' byte with the given value. In a string literal, these '
- 'escapes\n'
- ' denote a Unicode character with the given value.\n'
- '\n'
- '4. Changed in version 3.3: Support for name aliases [1] has '
- 'been\n'
- ' added.\n'
- '\n'
- '5. Individual code units which form parts of a surrogate pair '
- 'can\n'
- ' be encoded using this escape sequence. Exactly four hex '
- 'digits are\n'
- ' required.\n'
- '\n'
- '6. Any Unicode character can be encoded this way. Exactly '
- 'eight\n'
- ' hex digits are required.\n'
- '\n'
- 'Unlike Standard C, all unrecognized escape sequences are left '
- 'in the\n'
- 'string unchanged, i.e., *the backslash is left in the result*. '
- '(This\n'
- 'behavior is useful when debugging: if an escape sequence is '
- 'mistyped,\n'
- 'the resulting output is more easily recognized as broken.) It '
- 'is also\n'
- 'important to note that the escape sequences only recognized in '
- 'string\n'
- 'literals fall into the category of unrecognized escapes for '
- 'bytes\n'
- 'literals.\n'
- '\n'
- 'Even in a raw literal, quotes can be escaped with a backslash, '
- 'but the\n'
- 'backslash remains in the result; for example, "r"\\""" is a '
- 'valid\n'
- 'string literal consisting of two characters: a backslash and a '
- 'double\n'
- 'quote; "r"\\"" is not a valid string literal (even a raw string '
- 'cannot\n'
- 'end in an odd number of backslashes). Specifically, *a raw '
- 'literal\n'
- 'cannot end in a single backslash* (since the backslash would '
- 'escape\n'
- 'the following quote character). Note also that a single '
- 'backslash\n'
- 'followed by a newline is interpreted as those two characters as '
- 'part\n'
- 'of the literal, *not* as a line continuation.\n',
- 'subscriptions': '\n'
- 'Subscriptions\n'
- '*************\n'
- '\n'
- 'A subscription selects an item of a sequence (string, '
- 'tuple or list)\n'
- 'or mapping (dictionary) object:\n'
- '\n'
- ' subscription ::= primary "[" expression_list "]"\n'
- '\n'
- 'The primary must evaluate to an object that supports '
- 'subscription\n'
- '(lists or dictionaries for example). User-defined '
- 'objects can support\n'
- 'subscription by defining a "__getitem__()" method.\n'
- '\n'
- 'For built-in objects, there are two types of objects that '
- 'support\n'
- 'subscription:\n'
- '\n'
- 'If the primary is a mapping, the expression list must '
- 'evaluate to an\n'
- 'object whose value is one of the keys of the mapping, and '
- 'the\n'
- 'subscription selects the value in the mapping that '
- 'corresponds to that\n'
- 'key. (The expression list is a tuple except if it has '
- 'exactly one\n'
- 'item.)\n'
- '\n'
- 'If the primary is a sequence, the expression (list) must '
- 'evaluate to\n'
- 'an integer or a slice (as discussed in the following '
- 'section).\n'
- '\n'
- 'The formal syntax makes no special provision for negative '
- 'indices in\n'
- 'sequences; however, built-in sequences all provide a '
- '"__getitem__()"\n'
- 'method that interprets negative indices by adding the '
- 'length of the\n'
- 'sequence to the index (so that "x[-1]" selects the last '
- 'item of "x").\n'
- 'The resulting value must be a nonnegative integer less '
- 'than the number\n'
- 'of items in the sequence, and the subscription selects '
- 'the item whose\n'
- 'index is that value (counting from zero). Since the '
- 'support for\n'
- "negative indices and slicing occurs in the object's "
- '"__getitem__()"\n'
- 'method, subclasses overriding this method will need to '
- 'explicitly add\n'
- 'that support.\n'
- '\n'
- "A string's items are characters. A character is not a "
- 'separate data\n'
- 'type but a string of exactly one character.\n',
- 'truth': '\n'
- 'Truth Value Testing\n'
- '*******************\n'
- '\n'
- 'Any object can be tested for truth value, for use in an "if" or\n'
- '"while" condition or as operand of the Boolean operations below. '
- 'The\n'
- 'following values are considered false:\n'
- '\n'
- '* "None"\n'
- '\n'
- '* "False"\n'
- '\n'
- '* zero of any numeric type, for example, "0", "0.0", "0j".\n'
- '\n'
- '* any empty sequence, for example, "\'\'", "()", "[]".\n'
- '\n'
- '* any empty mapping, for example, "{}".\n'
- '\n'
- '* instances of user-defined classes, if the class defines a\n'
- ' "__bool__()" or "__len__()" method, when that method returns '
- 'the\n'
- ' integer zero or "bool" value "False". [1]\n'
- '\n'
- 'All other values are considered true --- so objects of many types '
- 'are\n'
- 'always true.\n'
- '\n'
- 'Operations and built-in functions that have a Boolean result '
- 'always\n'
- 'return "0" or "False" for false and "1" or "True" for true, '
- 'unless\n'
- 'otherwise stated. (Important exception: the Boolean operations '
- '"or"\n'
- 'and "and" always return one of their operands.)\n',
- 'try': '\n'
- 'The "try" statement\n'
- '*******************\n'
- '\n'
- 'The "try" statement specifies exception handlers and/or cleanup '
- 'code\n'
- 'for a group of statements:\n'
- '\n'
- ' try_stmt ::= try1_stmt | try2_stmt\n'
- ' try1_stmt ::= "try" ":" suite\n'
- ' ("except" [expression ["as" identifier]] ":" '
- 'suite)+\n'
- ' ["else" ":" suite]\n'
- ' ["finally" ":" suite]\n'
- ' try2_stmt ::= "try" ":" suite\n'
- ' "finally" ":" suite\n'
- '\n'
- 'The "except" clause(s) specify one or more exception handlers. When '
- 'no\n'
- 'exception occurs in the "try" clause, no exception handler is\n'
- 'executed. When an exception occurs in the "try" suite, a search for '
- 'an\n'
- 'exception handler is started. This search inspects the except '
- 'clauses\n'
- 'in turn until one is found that matches the exception. An '
- 'expression-\n'
- 'less except clause, if present, must be last; it matches any\n'
- 'exception. For an except clause with an expression, that '
- 'expression\n'
- 'is evaluated, and the clause matches the exception if the '
- 'resulting\n'
- 'object is "compatible" with the exception. An object is '
- 'compatible\n'
- 'with an exception if it is the class or a base class of the '
- 'exception\n'
- 'object or a tuple containing an item compatible with the '
- 'exception.\n'
- '\n'
- 'If no except clause matches the exception, the search for an '
- 'exception\n'
- 'handler continues in the surrounding code and on the invocation '
- 'stack.\n'
- '[1]\n'
- '\n'
- 'If the evaluation of an expression in the header of an except '
- 'clause\n'
- 'raises an exception, the original search for a handler is canceled '
- 'and\n'
- 'a search starts for the new exception in the surrounding code and '
- 'on\n'
- 'the call stack (it is treated as if the entire "try" statement '
- 'raised\n'
- 'the exception).\n'
- '\n'
- 'When a matching except clause is found, the exception is assigned '
- 'to\n'
- 'the target specified after the "as" keyword in that except clause, '
- 'if\n'
- "present, and the except clause's suite is executed. All except\n"
- 'clauses must have an executable block. When the end of this block '
- 'is\n'
- 'reached, execution continues normally after the entire try '
- 'statement.\n'
- '(This means that if two nested handlers exist for the same '
- 'exception,\n'
- 'and the exception occurs in the try clause of the inner handler, '
- 'the\n'
- 'outer handler will not handle the exception.)\n'
- '\n'
- 'When an exception has been assigned using "as target", it is '
- 'cleared\n'
- 'at the end of the except clause. This is as if\n'
- '\n'
- ' except E as N:\n'
- ' foo\n'
- '\n'
- 'was translated to\n'
- '\n'
- ' except E as N:\n'
- ' try:\n'
- ' foo\n'
- ' finally:\n'
- ' del N\n'
- '\n'
- 'This means the exception must be assigned to a different name to '
- 'be\n'
- 'able to refer to it after the except clause. Exceptions are '
- 'cleared\n'
- 'because with the traceback attached to them, they form a reference\n'
- 'cycle with the stack frame, keeping all locals in that frame alive\n'
- 'until the next garbage collection occurs.\n'
- '\n'
- "Before an except clause's suite is executed, details about the\n"
- 'exception are stored in the "sys" module and can be accessed via\n'
- '"sys.exc_info()". "sys.exc_info()" returns a 3-tuple consisting of '
- 'the\n'
- 'exception class, the exception instance and a traceback object '
- '(see\n'
- 'section *The standard type hierarchy*) identifying the point in '
- 'the\n'
- 'program where the exception occurred. "sys.exc_info()" values are\n'
- 'restored to their previous values (before the call) when returning\n'
- 'from a function that handled an exception.\n'
- '\n'
- 'The optional "else" clause is executed if and when control flows '
- 'off\n'
- 'the end of the "try" clause. [2] Exceptions in the "else" clause '
- 'are\n'
- 'not handled by the preceding "except" clauses.\n'
- '\n'
- 'If "finally" is present, it specifies a \'cleanup\' handler. The '
- '"try"\n'
- 'clause is executed, including any "except" and "else" clauses. If '
- 'an\n'
- 'exception occurs in any of the clauses and is not handled, the\n'
- 'exception is temporarily saved. The "finally" clause is executed. '
- 'If\n'
- 'there is a saved exception it is re-raised at the end of the '
- '"finally"\n'
- 'clause. If the "finally" clause raises another exception, the '
- 'saved\n'
- 'exception is set as the context of the new exception. If the '
- '"finally"\n'
- 'clause executes a "return" or "break" statement, the saved '
- 'exception\n'
- 'is discarded:\n'
- '\n'
- ' >>> def f():\n'
- ' ... try:\n'
- ' ... 1/0\n'
- ' ... finally:\n'
- ' ... return 42\n'
- ' ...\n'
- ' >>> f()\n'
- ' 42\n'
- '\n'
- 'The exception information is not available to the program during\n'
- 'execution of the "finally" clause.\n'
- '\n'
- 'When a "return", "break" or "continue" statement is executed in '
- 'the\n'
- '"try" suite of a "try"..."finally" statement, the "finally" clause '
- 'is\n'
- 'also executed \'on the way out.\' A "continue" statement is illegal '
- 'in\n'
- 'the "finally" clause. (The reason is a problem with the current\n'
- 'implementation --- this restriction may be lifted in the future).\n'
- '\n'
- 'The return value of a function is determined by the last "return"\n'
- 'statement executed. Since the "finally" clause always executes, a\n'
- '"return" statement executed in the "finally" clause will always be '
- 'the\n'
- 'last one executed:\n'
- '\n'
- ' >>> def foo():\n'
- ' ... try:\n'
- " ... return 'try'\n"
- ' ... finally:\n'
- " ... return 'finally'\n"
- ' ...\n'
- ' >>> foo()\n'
- " 'finally'\n"
- '\n'
- 'Additional information on exceptions can be found in section\n'
- '*Exceptions*, and information on using the "raise" statement to\n'
- 'generate exceptions may be found in section *The raise statement*.\n',
- 'types': '\n'
- 'The standard type hierarchy\n'
- '***************************\n'
- '\n'
- 'Below is a list of the types that are built into Python. '
- 'Extension\n'
- 'modules (written in C, Java, or other languages, depending on '
- 'the\n'
- 'implementation) can define additional types. Future versions of\n'
- 'Python may add types to the type hierarchy (e.g., rational '
- 'numbers,\n'
- 'efficiently stored arrays of integers, etc.), although such '
- 'additions\n'
- 'will often be provided via the standard library instead.\n'
- '\n'
- 'Some of the type descriptions below contain a paragraph listing\n'
- "'special attributes.' These are attributes that provide access "
- 'to the\n'
- 'implementation and are not intended for general use. Their '
- 'definition\n'
- 'may change in the future.\n'
- '\n'
- 'None\n'
- ' This type has a single value. There is a single object with '
- 'this\n'
- ' value. This object is accessed through the built-in name '
- '"None". It\n'
- ' is used to signify the absence of a value in many situations, '
- 'e.g.,\n'
- " it is returned from functions that don't explicitly return\n"
- ' anything. Its truth value is false.\n'
- '\n'
- 'NotImplemented\n'
- ' This type has a single value. There is a single object with '
- 'this\n'
- ' value. This object is accessed through the built-in name\n'
- ' "NotImplemented". Numeric methods and rich comparison methods\n'
- ' should return this value if they do not implement the '
- 'operation for\n'
- ' the operands provided. (The interpreter will then try the\n'
- ' reflected operation, or some other fallback, depending on the\n'
- ' operator.) Its truth value is true.\n'
- '\n'
- ' See *Implementing the arithmetic operations* for more '
- 'details.\n'
- '\n'
- 'Ellipsis\n'
- ' This type has a single value. There is a single object with '
- 'this\n'
- ' value. This object is accessed through the literal "..." or '
- 'the\n'
- ' built-in name "Ellipsis". Its truth value is true.\n'
- '\n'
- '"numbers.Number"\n'
- ' These are created by numeric literals and returned as results '
- 'by\n'
- ' arithmetic operators and arithmetic built-in functions. '
- 'Numeric\n'
- ' objects are immutable; once created their value never '
- 'changes.\n'
- ' Python numbers are of course strongly related to mathematical\n'
- ' numbers, but subject to the limitations of numerical '
- 'representation\n'
- ' in computers.\n'
- '\n'
- ' Python distinguishes between integers, floating point numbers, '
- 'and\n'
- ' complex numbers:\n'
- '\n'
- ' "numbers.Integral"\n'
- ' These represent elements from the mathematical set of '
- 'integers\n'
- ' (positive and negative).\n'
- '\n'
- ' There are two types of integers:\n'
- '\n'
- ' Integers ("int")\n'
- '\n'
- ' These represent numbers in an unlimited range, subject '
- 'to\n'
- ' available (virtual) memory only. For the purpose of '
- 'shift\n'
- ' and mask operations, a binary representation is assumed, '
- 'and\n'
- " negative numbers are represented in a variant of 2's\n"
- ' complement which gives the illusion of an infinite '
- 'string of\n'
- ' sign bits extending to the left.\n'
- '\n'
- ' Booleans ("bool")\n'
- ' These represent the truth values False and True. The '
- 'two\n'
- ' objects representing the values "False" and "True" are '
- 'the\n'
- ' only Boolean objects. The Boolean type is a subtype of '
- 'the\n'
- ' integer type, and Boolean values behave like the values '
- '0 and\n'
- ' 1, respectively, in almost all contexts, the exception '
- 'being\n'
- ' that when converted to a string, the strings ""False"" '
- 'or\n'
- ' ""True"" are returned, respectively.\n'
- '\n'
- ' The rules for integer representation are intended to give '
- 'the\n'
- ' most meaningful interpretation of shift and mask '
- 'operations\n'
- ' involving negative integers.\n'
- '\n'
- ' "numbers.Real" ("float")\n'
- ' These represent machine-level double precision floating '
- 'point\n'
- ' numbers. You are at the mercy of the underlying machine\n'
- ' architecture (and C or Java implementation) for the '
- 'accepted\n'
- ' range and handling of overflow. Python does not support '
- 'single-\n'
- ' precision floating point numbers; the savings in processor '
- 'and\n'
- ' memory usage that are usually the reason for using these '
- 'are\n'
- ' dwarfed by the overhead of using objects in Python, so '
- 'there is\n'
- ' no reason to complicate the language with two kinds of '
- 'floating\n'
- ' point numbers.\n'
- '\n'
- ' "numbers.Complex" ("complex")\n'
- ' These represent complex numbers as a pair of machine-level\n'
- ' double precision floating point numbers. The same caveats '
- 'apply\n'
- ' as for floating point numbers. The real and imaginary parts '
- 'of a\n'
- ' complex number "z" can be retrieved through the read-only\n'
- ' attributes "z.real" and "z.imag".\n'
- '\n'
- 'Sequences\n'
- ' These represent finite ordered sets indexed by non-negative\n'
- ' numbers. The built-in function "len()" returns the number of '
- 'items\n'
- ' of a sequence. When the length of a sequence is *n*, the index '
- 'set\n'
- ' contains the numbers 0, 1, ..., *n*-1. Item *i* of sequence '
- '*a* is\n'
- ' selected by "a[i]".\n'
- '\n'
- ' Sequences also support slicing: "a[i:j]" selects all items '
- 'with\n'
- ' index *k* such that *i* "<=" *k* "<" *j*. When used as an\n'
- ' expression, a slice is a sequence of the same type. This '
- 'implies\n'
- ' that the index set is renumbered so that it starts at 0.\n'
- '\n'
- ' Some sequences also support "extended slicing" with a third '
- '"step"\n'
- ' parameter: "a[i:j:k]" selects all items of *a* with index *x* '
- 'where\n'
- ' "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n'
- '\n'
- ' Sequences are distinguished according to their mutability:\n'
- '\n'
- ' Immutable sequences\n'
- ' An object of an immutable sequence type cannot change once '
- 'it is\n'
- ' created. (If the object contains references to other '
- 'objects,\n'
- ' these other objects may be mutable and may be changed; '
- 'however,\n'
- ' the collection of objects directly referenced by an '
- 'immutable\n'
- ' object cannot change.)\n'
- '\n'
- ' The following types are immutable sequences:\n'
- '\n'
- ' Strings\n'
- ' A string is a sequence of values that represent Unicode '
- 'code\n'
- ' points. All the code points in the range "U+0000 - '
- 'U+10FFFF"\n'
- " can be represented in a string. Python doesn't have a "
- '"char"\n'
- ' type; instead, every code point in the string is '
- 'represented\n'
- ' as a string object with length "1". The built-in '
- 'function\n'
- ' "ord()" converts a code point from its string form to '
- 'an\n'
- ' integer in the range "0 - 10FFFF"; "chr()" converts an\n'
- ' integer in the range "0 - 10FFFF" to the corresponding '
- 'length\n'
- ' "1" string object. "str.encode()" can be used to convert '
- 'a\n'
- ' "str" to "bytes" using the given text encoding, and\n'
- ' "bytes.decode()" can be used to achieve the opposite.\n'
- '\n'
- ' Tuples\n'
- ' The items of a tuple are arbitrary Python objects. '
- 'Tuples of\n'
- ' two or more items are formed by comma-separated lists '
- 'of\n'
- " expressions. A tuple of one item (a 'singleton') can "
- 'be\n'
- ' formed by affixing a comma to an expression (an '
- 'expression by\n'
- ' itself does not create a tuple, since parentheses must '
- 'be\n'
- ' usable for grouping of expressions). An empty tuple can '
- 'be\n'
- ' formed by an empty pair of parentheses.\n'
- '\n'
- ' Bytes\n'
- ' A bytes object is an immutable array. The items are '
- '8-bit\n'
- ' bytes, represented by integers in the range 0 <= x < '
- '256.\n'
- ' Bytes literals (like "b\'abc\'") and the built-in '
- 'function\n'
- ' "bytes()" can be used to construct bytes objects. '
- 'Also,\n'
- ' bytes objects can be decoded to strings via the '
- '"decode()"\n'
- ' method.\n'
- '\n'
- ' Mutable sequences\n'
- ' Mutable sequences can be changed after they are created. '
- 'The\n'
- ' subscription and slicing notations can be used as the '
- 'target of\n'
- ' assignment and "del" (delete) statements.\n'
- '\n'
- ' There are currently two intrinsic mutable sequence types:\n'
- '\n'
- ' Lists\n'
- ' The items of a list are arbitrary Python objects. Lists '
- 'are\n'
- ' formed by placing a comma-separated list of expressions '
- 'in\n'
- ' square brackets. (Note that there are no special cases '
- 'needed\n'
- ' to form lists of length 0 or 1.)\n'
- '\n'
- ' Byte Arrays\n'
- ' A bytearray object is a mutable array. They are created '
- 'by\n'
- ' the built-in "bytearray()" constructor. Aside from '
- 'being\n'
- ' mutable (and hence unhashable), byte arrays otherwise '
- 'provide\n'
- ' the same interface and functionality as immutable bytes\n'
- ' objects.\n'
- '\n'
- ' The extension module "array" provides an additional example '
- 'of a\n'
- ' mutable sequence type, as does the "collections" module.\n'
- '\n'
- 'Set types\n'
- ' These represent unordered, finite sets of unique, immutable\n'
- ' objects. As such, they cannot be indexed by any subscript. '
- 'However,\n'
- ' they can be iterated over, and the built-in function "len()"\n'
- ' returns the number of items in a set. Common uses for sets are '
- 'fast\n'
- ' membership testing, removing duplicates from a sequence, and\n'
- ' computing mathematical operations such as intersection, '
- 'union,\n'
- ' difference, and symmetric difference.\n'
- '\n'
- ' For set elements, the same immutability rules apply as for\n'
- ' dictionary keys. Note that numeric types obey the normal rules '
- 'for\n'
- ' numeric comparison: if two numbers compare equal (e.g., "1" '
- 'and\n'
- ' "1.0"), only one of them can be contained in a set.\n'
- '\n'
- ' There are currently two intrinsic set types:\n'
- '\n'
- ' Sets\n'
- ' These represent a mutable set. They are created by the '
- 'built-in\n'
- ' "set()" constructor and can be modified afterwards by '
- 'several\n'
- ' methods, such as "add()".\n'
- '\n'
- ' Frozen sets\n'
- ' These represent an immutable set. They are created by the\n'
- ' built-in "frozenset()" constructor. As a frozenset is '
- 'immutable\n'
- ' and *hashable*, it can be used again as an element of '
- 'another\n'
- ' set, or as a dictionary key.\n'
- '\n'
- 'Mappings\n'
- ' These represent finite sets of objects indexed by arbitrary '
- 'index\n'
- ' sets. The subscript notation "a[k]" selects the item indexed '
- 'by "k"\n'
- ' from the mapping "a"; this can be used in expressions and as '
- 'the\n'
- ' target of assignments or "del" statements. The built-in '
- 'function\n'
- ' "len()" returns the number of items in a mapping.\n'
- '\n'
- ' There is currently a single intrinsic mapping type:\n'
- '\n'
- ' Dictionaries\n'
- ' These represent finite sets of objects indexed by nearly\n'
- ' arbitrary values. The only types of values not acceptable '
- 'as\n'
- ' keys are values containing lists or dictionaries or other\n'
- ' mutable types that are compared by value rather than by '
- 'object\n'
- ' identity, the reason being that the efficient '
- 'implementation of\n'
- " dictionaries requires a key's hash value to remain "
- 'constant.\n'
- ' Numeric types used for keys obey the normal rules for '
- 'numeric\n'
- ' comparison: if two numbers compare equal (e.g., "1" and '
- '"1.0")\n'
- ' then they can be used interchangeably to index the same\n'
- ' dictionary entry.\n'
- '\n'
- ' Dictionaries are mutable; they can be created by the '
- '"{...}"\n'
- ' notation (see section *Dictionary displays*).\n'
- '\n'
- ' The extension modules "dbm.ndbm" and "dbm.gnu" provide\n'
- ' additional examples of mapping types, as does the '
- '"collections"\n'
- ' module.\n'
- '\n'
- 'Callable types\n'
- ' These are the types to which the function call operation (see\n'
- ' section *Calls*) can be applied:\n'
- '\n'
- ' User-defined functions\n'
- ' A user-defined function object is created by a function\n'
- ' definition (see section *Function definitions*). It should '
- 'be\n'
- ' called with an argument list containing the same number of '
- 'items\n'
- " as the function's formal parameter list.\n"
- '\n'
- ' Special attributes:\n'
- '\n'
- ' '
- '+---------------------------+---------------------------------+-------------+\n'
- ' | Attribute | '
- 'Meaning | |\n'
- ' '
- '+===========================+=================================+=============+\n'
- ' | "__doc__" | The function\'s '
- 'documentation | Writable |\n'
- ' | | string, or "None" '
- 'if | |\n'
- ' | | unavailable; not inherited '
- 'by | |\n'
- ' | | '
- 'subclasses | |\n'
- ' '
- '+---------------------------+---------------------------------+-------------+\n'
- ' | "__name__" | The function\'s '
- 'name | Writable |\n'
- ' '
- '+---------------------------+---------------------------------+-------------+\n'
- ' | "__qualname__" | The function\'s *qualified '
- 'name* | Writable |\n'
- ' | | New in version '
- '3.3. | |\n'
- ' '
- '+---------------------------+---------------------------------+-------------+\n'
- ' | "__module__" | The name of the module '
- 'the | Writable |\n'
- ' | | function was defined in, '
- 'or | |\n'
- ' | | "None" if '
- 'unavailable. | |\n'
- ' '
- '+---------------------------+---------------------------------+-------------+\n'
- ' | "__defaults__" | A tuple containing '
- 'default | Writable |\n'
- ' | | argument values for '
- 'those | |\n'
- ' | | arguments that have '
- 'defaults, | |\n'
- ' | | or "None" if no arguments '
- 'have | |\n'
- ' | | a default '
- 'value | |\n'
- ' '
- '+---------------------------+---------------------------------+-------------+\n'
- ' | "__code__" | The code object '
- 'representing | Writable |\n'
- ' | | the compiled function '
- 'body. | |\n'
- ' '
- '+---------------------------+---------------------------------+-------------+\n'
- ' | "__globals__" | A reference to the '
- 'dictionary | Read-only |\n'
- ' | | that holds the '
- "function's | |\n"
- ' | | global variables --- the '
- 'global | |\n'
- ' | | namespace of the module '
- 'in | |\n'
- ' | | which the function was '
- 'defined. | |\n'
- ' '
- '+---------------------------+---------------------------------+-------------+\n'
- ' | "__dict__" | The namespace '
- 'supporting | Writable |\n'
- ' | | arbitrary function '
- 'attributes. | |\n'
- ' '
- '+---------------------------+---------------------------------+-------------+\n'
- ' | "__closure__" | "None" or a tuple of cells '
- 'that | Read-only |\n'
- ' | | contain bindings for '
- 'the | |\n'
- " | | function's free "
- 'variables. | |\n'
- ' '
- '+---------------------------+---------------------------------+-------------+\n'
- ' | "__annotations__" | A dict containing '
- 'annotations | Writable |\n'
- ' | | of parameters. The keys of '
- 'the | |\n'
- ' | | dict are the parameter '
- 'names, | |\n'
- ' | | and "\'return\'" for the '
- 'return | |\n'
- ' | | annotation, if '
- 'provided. | |\n'
- ' '
- '+---------------------------+---------------------------------+-------------+\n'
- ' | "__kwdefaults__" | A dict containing defaults '
- 'for | Writable |\n'
- ' | | keyword-only '
- 'parameters. | |\n'
- ' '
- '+---------------------------+---------------------------------+-------------+\n'
- '\n'
- ' Most of the attributes labelled "Writable" check the type '
- 'of the\n'
- ' assigned value.\n'
- '\n'
- ' Function objects also support getting and setting '
- 'arbitrary\n'
- ' attributes, which can be used, for example, to attach '
- 'metadata\n'
- ' to functions. Regular attribute dot-notation is used to '
- 'get and\n'
- ' set such attributes. *Note that the current implementation '
- 'only\n'
- ' supports function attributes on user-defined functions. '
- 'Function\n'
- ' attributes on built-in functions may be supported in the\n'
- ' future.*\n'
- '\n'
- " Additional information about a function's definition can "
- 'be\n'
- ' retrieved from its code object; see the description of '
- 'internal\n'
- ' types below.\n'
- '\n'
- ' Instance methods\n'
- ' An instance method object combines a class, a class '
- 'instance and\n'
- ' any callable object (normally a user-defined function).\n'
- '\n'
- ' Special read-only attributes: "__self__" is the class '
- 'instance\n'
- ' object, "__func__" is the function object; "__doc__" is '
- 'the\n'
- ' method\'s documentation (same as "__func__.__doc__"); '
- '"__name__"\n'
- ' is the method name (same as "__func__.__name__"); '
- '"__module__"\n'
- ' is the name of the module the method was defined in, or '
- '"None"\n'
- ' if unavailable.\n'
- '\n'
- ' Methods also support accessing (but not setting) the '
- 'arbitrary\n'
- ' function attributes on the underlying function object.\n'
- '\n'
- ' User-defined method objects may be created when getting an\n'
- ' attribute of a class (perhaps via an instance of that '
- 'class), if\n'
- ' that attribute is a user-defined function object or a '
- 'class\n'
- ' method object.\n'
- '\n'
- ' When an instance method object is created by retrieving a '
- 'user-\n'
- ' defined function object from a class via one of its '
- 'instances,\n'
- ' its "__self__" attribute is the instance, and the method '
- 'object\n'
- ' is said to be bound. The new method\'s "__func__" '
- 'attribute is\n'
- ' the original function object.\n'
- '\n'
- ' When a user-defined method object is created by retrieving\n'
- ' another method object from a class or instance, the '
- 'behaviour is\n'
- ' the same as for a function object, except that the '
- '"__func__"\n'
- ' attribute of the new instance is not the original method '
- 'object\n'
- ' but its "__func__" attribute.\n'
- '\n'
- ' When an instance method object is created by retrieving a '
- 'class\n'
- ' method object from a class or instance, its "__self__" '
- 'attribute\n'
- ' is the class itself, and its "__func__" attribute is the\n'
- ' function object underlying the class method.\n'
- '\n'
- ' When an instance method object is called, the underlying\n'
- ' function ("__func__") is called, inserting the class '
- 'instance\n'
- ' ("__self__") in front of the argument list. For instance, '
- 'when\n'
- ' "C" is a class which contains a definition for a function '
- '"f()",\n'
- ' and "x" is an instance of "C", calling "x.f(1)" is '
- 'equivalent to\n'
- ' calling "C.f(x, 1)".\n'
- '\n'
- ' When an instance method object is derived from a class '
- 'method\n'
- ' object, the "class instance" stored in "__self__" will '
- 'actually\n'
- ' be the class itself, so that calling either "x.f(1)" or '
- '"C.f(1)"\n'
- ' is equivalent to calling "f(C,1)" where "f" is the '
- 'underlying\n'
- ' function.\n'
- '\n'
- ' Note that the transformation from function object to '
- 'instance\n'
- ' method object happens each time the attribute is retrieved '
- 'from\n'
- ' the instance. In some cases, a fruitful optimization is '
- 'to\n'
- ' assign the attribute to a local variable and call that '
- 'local\n'
- ' variable. Also notice that this transformation only happens '
- 'for\n'
- ' user-defined functions; other callable objects (and all '
- 'non-\n'
- ' callable objects) are retrieved without transformation. It '
- 'is\n'
- ' also important to note that user-defined functions which '
- 'are\n'
- ' attributes of a class instance are not converted to bound\n'
- ' methods; this *only* happens when the function is an '
- 'attribute\n'
- ' of the class.\n'
- '\n'
- ' Generator functions\n'
- ' A function or method which uses the "yield" statement (see\n'
- ' section *The yield statement*) is called a *generator '
- 'function*.\n'
- ' Such a function, when called, always returns an iterator '
- 'object\n'
- ' which can be used to execute the body of the function: '
- 'calling\n'
- ' the iterator\'s "iterator.__next__()" method will cause '
- 'the\n'
- ' function to execute until it provides a value using the '
- '"yield"\n'
- ' statement. When the function executes a "return" statement '
- 'or\n'
- ' falls off the end, a "StopIteration" exception is raised '
- 'and the\n'
- ' iterator will have reached the end of the set of values to '
- 'be\n'
- ' returned.\n'
- '\n'
- ' Coroutine functions\n'
- ' A function or method which is defined using "async def" is\n'
- ' called a *coroutine function*. Such a function, when '
- 'called,\n'
- ' returns a *coroutine* object. It may contain "await"\n'
- ' expressions, as well as "async with" and "async for" '
- 'statements.\n'
- ' See also the *Coroutine Objects* section.\n'
- '\n'
- ' Built-in functions\n'
- ' A built-in function object is a wrapper around a C '
- 'function.\n'
- ' Examples of built-in functions are "len()" and '
- '"math.sin()"\n'
- ' ("math" is a standard built-in module). The number and type '
- 'of\n'
- ' the arguments are determined by the C function. Special '
- 'read-\n'
- ' only attributes: "__doc__" is the function\'s '
- 'documentation\n'
- ' string, or "None" if unavailable; "__name__" is the '
- "function's\n"
- ' name; "__self__" is set to "None" (but see the next item);\n'
- ' "__module__" is the name of the module the function was '
- 'defined\n'
- ' in or "None" if unavailable.\n'
- '\n'
- ' Built-in methods\n'
- ' This is really a different disguise of a built-in function, '
- 'this\n'
- ' time containing an object passed to the C function as an\n'
- ' implicit extra argument. An example of a built-in method '
- 'is\n'
- ' "alist.append()", assuming *alist* is a list object. In '
- 'this\n'
- ' case, the special read-only attribute "__self__" is set to '
- 'the\n'
- ' object denoted by *alist*.\n'
- '\n'
- ' Classes\n'
- ' Classes are callable. These objects normally act as '
- 'factories\n'
- ' for new instances of themselves, but variations are '
- 'possible for\n'
- ' class types that override "__new__()". The arguments of '
- 'the\n'
- ' call are passed to "__new__()" and, in the typical case, '
- 'to\n'
- ' "__init__()" to initialize the new instance.\n'
- '\n'
- ' Class Instances\n'
- ' Instances of arbitrary classes can be made callable by '
- 'defining\n'
- ' a "__call__()" method in their class.\n'
- '\n'
- 'Modules\n'
- ' Modules are a basic organizational unit of Python code, and '
- 'are\n'
- ' created by the *import system* as invoked either by the '
- '"import"\n'
- ' statement (see "import"), or by calling functions such as\n'
- ' "importlib.import_module()" and built-in "__import__()". A '
- 'module\n'
- ' object has a namespace implemented by a dictionary object '
- '(this is\n'
- ' the dictionary referenced by the "__globals__" attribute of\n'
- ' functions defined in the module). Attribute references are\n'
- ' translated to lookups in this dictionary, e.g., "m.x" is '
- 'equivalent\n'
- ' to "m.__dict__["x"]". A module object does not contain the '
- 'code\n'
- " object used to initialize the module (since it isn't needed "
- 'once\n'
- ' the initialization is done).\n'
- '\n'
- " Attribute assignment updates the module's namespace "
- 'dictionary,\n'
- ' e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n'
- '\n'
- ' Special read-only attribute: "__dict__" is the module\'s '
- 'namespace\n'
- ' as a dictionary object.\n'
- '\n'
- ' **CPython implementation detail:** Because of the way CPython\n'
- ' clears module dictionaries, the module dictionary will be '
- 'cleared\n'
- ' when the module falls out of scope even if the dictionary '
- 'still has\n'
- ' live references. To avoid this, copy the dictionary or keep '
- 'the\n'
- ' module around while using its dictionary directly.\n'
- '\n'
- ' Predefined (writable) attributes: "__name__" is the module\'s '
- 'name;\n'
- ' "__doc__" is the module\'s documentation string, or "None" if\n'
- ' unavailable; "__file__" is the pathname of the file from which '
- 'the\n'
- ' module was loaded, if it was loaded from a file. The '
- '"__file__"\n'
- ' attribute may be missing for certain types of modules, such as '
- 'C\n'
- ' modules that are statically linked into the interpreter; for\n'
- ' extension modules loaded dynamically from a shared library, it '
- 'is\n'
- ' the pathname of the shared library file.\n'
- '\n'
- 'Custom classes\n'
- ' Custom class types are typically created by class definitions '
- '(see\n'
- ' section *Class definitions*). A class has a namespace '
- 'implemented\n'
- ' by a dictionary object. Class attribute references are '
- 'translated\n'
- ' to lookups in this dictionary, e.g., "C.x" is translated to\n'
- ' "C.__dict__["x"]" (although there are a number of hooks which '
- 'allow\n'
- ' for other means of locating attributes). When the attribute '
- 'name is\n'
- ' not found there, the attribute search continues in the base\n'
- ' classes. This search of the base classes uses the C3 method\n'
- ' resolution order which behaves correctly even in the presence '
- 'of\n'
- " 'diamond' inheritance structures where there are multiple\n"
- ' inheritance paths leading back to a common ancestor. '
- 'Additional\n'
- ' details on the C3 MRO used by Python can be found in the\n'
- ' documentation accompanying the 2.3 release at\n'
- ' https://www.python.org/download/releases/2.3/mro/.\n'
- '\n'
- ' When a class attribute reference (for class "C", say) would '
- 'yield a\n'
- ' class method object, it is transformed into an instance '
- 'method\n'
- ' object whose "__self__" attributes is "C". When it would '
- 'yield a\n'
- ' static method object, it is transformed into the object '
- 'wrapped by\n'
- ' the static method object. See section *Implementing '
- 'Descriptors*\n'
- ' for another way in which attributes retrieved from a class '
- 'may\n'
- ' differ from those actually contained in its "__dict__".\n'
- '\n'
- " Class attribute assignments update the class's dictionary, "
- 'never\n'
- ' the dictionary of a base class.\n'
- '\n'
- ' A class object can be called (see above) to yield a class '
- 'instance\n'
- ' (see below).\n'
- '\n'
- ' Special attributes: "__name__" is the class name; "__module__" '
- 'is\n'
- ' the module name in which the class was defined; "__dict__" is '
- 'the\n'
- ' dictionary containing the class\'s namespace; "__bases__" is a '
- 'tuple\n'
- ' (possibly empty or a singleton) containing the base classes, '
- 'in the\n'
- ' order of their occurrence in the base class list; "__doc__" is '
- 'the\n'
- " class's documentation string, or None if undefined.\n"
- '\n'
- 'Class instances\n'
- ' A class instance is created by calling a class object (see '
- 'above).\n'
- ' A class instance has a namespace implemented as a dictionary '
- 'which\n'
- ' is the first place in which attribute references are '
- 'searched.\n'
- " When an attribute is not found there, and the instance's class "
- 'has\n'
- ' an attribute by that name, the search continues with the '
- 'class\n'
- ' attributes. If a class attribute is found that is a '
- 'user-defined\n'
- ' function object, it is transformed into an instance method '
- 'object\n'
- ' whose "__self__" attribute is the instance. Static method '
- 'and\n'
- ' class method objects are also transformed; see above under\n'
- ' "Classes". See section *Implementing Descriptors* for another '
- 'way\n'
- ' in which attributes of a class retrieved via its instances '
- 'may\n'
- " differ from the objects actually stored in the class's "
- '"__dict__".\n'
- " If no class attribute is found, and the object's class has a\n"
- ' "__getattr__()" method, that is called to satisfy the lookup.\n'
- '\n'
- " Attribute assignments and deletions update the instance's\n"
- " dictionary, never a class's dictionary. If the class has a\n"
- ' "__setattr__()" or "__delattr__()" method, this is called '
- 'instead\n'
- ' of updating the instance dictionary directly.\n'
- '\n'
- ' Class instances can pretend to be numbers, sequences, or '
- 'mappings\n'
- ' if they have methods with certain special names. See section\n'
- ' *Special method names*.\n'
- '\n'
- ' Special attributes: "__dict__" is the attribute dictionary;\n'
- ' "__class__" is the instance\'s class.\n'
- '\n'
- 'I/O objects (also known as file objects)\n'
- ' A *file object* represents an open file. Various shortcuts '
- 'are\n'
- ' available to create file objects: the "open()" built-in '
- 'function,\n'
- ' and also "os.popen()", "os.fdopen()", and the "makefile()" '
- 'method\n'
- ' of socket objects (and perhaps by other functions or methods\n'
- ' provided by extension modules).\n'
- '\n'
- ' The objects "sys.stdin", "sys.stdout" and "sys.stderr" are\n'
- ' initialized to file objects corresponding to the '
- "interpreter's\n"
- ' standard input, output and error streams; they are all open in '
- 'text\n'
- ' mode and therefore follow the interface defined by the\n'
- ' "io.TextIOBase" abstract class.\n'
- '\n'
- 'Internal types\n'
- ' A few types used internally by the interpreter are exposed to '
- 'the\n'
- ' user. Their definitions may change with future versions of '
- 'the\n'
- ' interpreter, but they are mentioned here for completeness.\n'
- '\n'
- ' Code objects\n'
- ' Code objects represent *byte-compiled* executable Python '
- 'code,\n'
- ' or *bytecode*. The difference between a code object and a\n'
- ' function object is that the function object contains an '
- 'explicit\n'
- " reference to the function's globals (the module in which it "
- 'was\n'
- ' defined), while a code object contains no context; also '
- 'the\n'
- ' default argument values are stored in the function object, '
- 'not\n'
- ' in the code object (because they represent values '
- 'calculated at\n'
- ' run-time). Unlike function objects, code objects are '
- 'immutable\n'
- ' and contain no references (directly or indirectly) to '
- 'mutable\n'
- ' objects.\n'
- '\n'
- ' Special read-only attributes: "co_name" gives the function '
- 'name;\n'
- ' "co_argcount" is the number of positional arguments '
- '(including\n'
- ' arguments with default values); "co_nlocals" is the number '
- 'of\n'
- ' local variables used by the function (including '
- 'arguments);\n'
- ' "co_varnames" is a tuple containing the names of the local\n'
- ' variables (starting with the argument names); "co_cellvars" '
- 'is a\n'
- ' tuple containing the names of local variables that are\n'
- ' referenced by nested functions; "co_freevars" is a tuple\n'
- ' containing the names of free variables; "co_code" is a '
- 'string\n'
- ' representing the sequence of bytecode instructions; '
- '"co_consts"\n'
- ' is a tuple containing the literals used by the bytecode;\n'
- ' "co_names" is a tuple containing the names used by the '
- 'bytecode;\n'
- ' "co_filename" is the filename from which the code was '
- 'compiled;\n'
- ' "co_firstlineno" is the first line number of the function;\n'
- ' "co_lnotab" is a string encoding the mapping from bytecode\n'
- ' offsets to line numbers (for details see the source code of '
- 'the\n'
- ' interpreter); "co_stacksize" is the required stack size\n'
- ' (including local variables); "co_flags" is an integer '
- 'encoding a\n'
- ' number of flags for the interpreter.\n'
- '\n'
- ' The following flag bits are defined for "co_flags": bit '
- '"0x04"\n'
- ' is set if the function uses the "*arguments" syntax to '
- 'accept an\n'
- ' arbitrary number of positional arguments; bit "0x08" is set '
- 'if\n'
- ' the function uses the "**keywords" syntax to accept '
- 'arbitrary\n'
- ' keyword arguments; bit "0x20" is set if the function is a\n'
- ' generator.\n'
- '\n'
- ' Future feature declarations ("from __future__ import '
- 'division")\n'
- ' also use bits in "co_flags" to indicate whether a code '
- 'object\n'
- ' was compiled with a particular feature enabled: bit '
- '"0x2000" is\n'
- ' set if the function was compiled with future division '
- 'enabled;\n'
- ' bits "0x10" and "0x1000" were used in earlier versions of\n'
- ' Python.\n'
- '\n'
- ' Other bits in "co_flags" are reserved for internal use.\n'
- '\n'
- ' If a code object represents a function, the first item in\n'
- ' "co_consts" is the documentation string of the function, '
- 'or\n'
- ' "None" if undefined.\n'
- '\n'
- ' Frame objects\n'
- ' Frame objects represent execution frames. They may occur '
- 'in\n'
- ' traceback objects (see below).\n'
- '\n'
- ' Special read-only attributes: "f_back" is to the previous '
- 'stack\n'
- ' frame (towards the caller), or "None" if this is the '
- 'bottom\n'
- ' stack frame; "f_code" is the code object being executed in '
- 'this\n'
- ' frame; "f_locals" is the dictionary used to look up local\n'
- ' variables; "f_globals" is used for global variables;\n'
- ' "f_builtins" is used for built-in (intrinsic) names; '
- '"f_lasti"\n'
- ' gives the precise instruction (this is an index into the\n'
- ' bytecode string of the code object).\n'
- '\n'
- ' Special writable attributes: "f_trace", if not "None", is '
- 'a\n'
- ' function called at the start of each source code line (this '
- 'is\n'
- ' used by the debugger); "f_lineno" is the current line '
- 'number of\n'
- ' the frame --- writing to this from within a trace function '
- 'jumps\n'
- ' to the given line (only for the bottom-most frame). A '
- 'debugger\n'
- ' can implement a Jump command (aka Set Next Statement) by '
- 'writing\n'
- ' to f_lineno.\n'
- '\n'
- ' Frame objects support one method:\n'
- '\n'
- ' frame.clear()\n'
- '\n'
- ' This method clears all references to local variables '
- 'held by\n'
- ' the frame. Also, if the frame belonged to a generator, '
- 'the\n'
- ' generator is finalized. This helps break reference '
- 'cycles\n'
- ' involving frame objects (for example when catching an\n'
- ' exception and storing its traceback for later use).\n'
- '\n'
- ' "RuntimeError" is raised if the frame is currently '
- 'executing.\n'
- '\n'
- ' New in version 3.4.\n'
- '\n'
- ' Traceback objects\n'
- ' Traceback objects represent a stack trace of an exception. '
- 'A\n'
- ' traceback object is created when an exception occurs. When '
- 'the\n'
- ' search for an exception handler unwinds the execution '
- 'stack, at\n'
- ' each unwound level a traceback object is inserted in front '
- 'of\n'
- ' the current traceback. When an exception handler is '
- 'entered,\n'
- ' the stack trace is made available to the program. (See '
- 'section\n'
- ' *The try statement*.) It is accessible as the third item of '
- 'the\n'
- ' tuple returned by "sys.exc_info()". When the program '
- 'contains no\n'
- ' suitable handler, the stack trace is written (nicely '
- 'formatted)\n'
- ' to the standard error stream; if the interpreter is '
- 'interactive,\n'
- ' it is also made available to the user as '
- '"sys.last_traceback".\n'
- '\n'
- ' Special read-only attributes: "tb_next" is the next level '
- 'in the\n'
- ' stack trace (towards the frame where the exception '
- 'occurred), or\n'
- ' "None" if there is no next level; "tb_frame" points to the\n'
- ' execution frame of the current level; "tb_lineno" gives the '
- 'line\n'
- ' number where the exception occurred; "tb_lasti" indicates '
- 'the\n'
- ' precise instruction. The line number and last instruction '
- 'in\n'
- ' the traceback may differ from the line number of its frame\n'
- ' object if the exception occurred in a "try" statement with '
- 'no\n'
- ' matching except clause or with a finally clause.\n'
- '\n'
- ' Slice objects\n'
- ' Slice objects are used to represent slices for '
- '"__getitem__()"\n'
- ' methods. They are also created by the built-in "slice()"\n'
- ' function.\n'
- '\n'
- ' Special read-only attributes: "start" is the lower bound; '
- '"stop"\n'
- ' is the upper bound; "step" is the step value; each is '
- '"None" if\n'
- ' omitted. These attributes can have any type.\n'
- '\n'
- ' Slice objects support one method:\n'
- '\n'
- ' slice.indices(self, length)\n'
- '\n'
- ' This method takes a single integer argument *length* '
- 'and\n'
- ' computes information about the slice that the slice '
- 'object\n'
- ' would describe if applied to a sequence of *length* '
- 'items.\n'
- ' It returns a tuple of three integers; respectively these '
- 'are\n'
- ' the *start* and *stop* indices and the *step* or stride\n'
- ' length of the slice. Missing or out-of-bounds indices '
- 'are\n'
- ' handled in a manner consistent with regular slices.\n'
- '\n'
- ' Static method objects\n'
- ' Static method objects provide a way of defeating the\n'
- ' transformation of function objects to method objects '
- 'described\n'
- ' above. A static method object is a wrapper around any '
- 'other\n'
- ' object, usually a user-defined method object. When a '
- 'static\n'
- ' method object is retrieved from a class or a class '
- 'instance, the\n'
- ' object actually returned is the wrapped object, which is '
- 'not\n'
- ' subject to any further transformation. Static method '
- 'objects are\n'
- ' not themselves callable, although the objects they wrap '
- 'usually\n'
- ' are. Static method objects are created by the built-in\n'
- ' "staticmethod()" constructor.\n'
- '\n'
- ' Class method objects\n'
- ' A class method object, like a static method object, is a '
- 'wrapper\n'
- ' around another object that alters the way in which that '
- 'object\n'
- ' is retrieved from classes and class instances. The '
- 'behaviour of\n'
- ' class method objects upon such retrieval is described '
- 'above,\n'
- ' under "User-defined methods". Class method objects are '
- 'created\n'
- ' by the built-in "classmethod()" constructor.\n',
- 'typesfunctions': '\n'
- 'Functions\n'
- '*********\n'
- '\n'
- 'Function objects are created by function definitions. '
- 'The only\n'
- 'operation on a function object is to call it: '
- '"func(argument-list)".\n'
- '\n'
- 'There are really two flavors of function objects: '
- 'built-in functions\n'
- 'and user-defined functions. Both support the same '
- 'operation (to call\n'
- 'the function), but the implementation is different, '
- 'hence the\n'
- 'different object types.\n'
- '\n'
- 'See *Function definitions* for more information.\n',
- 'typesmapping': '\n'
- 'Mapping Types --- "dict"\n'
- '************************\n'
- '\n'
- 'A *mapping* object maps *hashable* values to arbitrary '
- 'objects.\n'
- 'Mappings are mutable objects. There is currently only one '
- 'standard\n'
- 'mapping type, the *dictionary*. (For other containers see '
- 'the built-\n'
- 'in "list", "set", and "tuple" classes, and the '
- '"collections" module.)\n'
- '\n'
- "A dictionary's keys are *almost* arbitrary values. Values "
- 'that are\n'
- 'not *hashable*, that is, values containing lists, '
- 'dictionaries or\n'
- 'other mutable types (that are compared by value rather '
- 'than by object\n'
- 'identity) may not be used as keys. Numeric types used for '
- 'keys obey\n'
- 'the normal rules for numeric comparison: if two numbers '
- 'compare equal\n'
- '(such as "1" and "1.0") then they can be used '
- 'interchangeably to index\n'
- 'the same dictionary entry. (Note however, that since '
- 'computers store\n'
- 'floating-point numbers as approximations it is usually '
- 'unwise to use\n'
- 'them as dictionary keys.)\n'
- '\n'
- 'Dictionaries can be created by placing a comma-separated '
- 'list of "key:\n'
- 'value" pairs within braces, for example: "{\'jack\': 4098, '
- "'sjoerd':\n"
- '4127}" or "{4098: \'jack\', 4127: \'sjoerd\'}", or by the '
- '"dict"\n'
- 'constructor.\n'
- '\n'
- 'class class dict(**kwarg)\n'
- 'class class dict(mapping, **kwarg)\n'
- 'class class dict(iterable, **kwarg)\n'
- '\n'
- ' Return a new dictionary initialized from an optional '
- 'positional\n'
- ' argument and a possibly empty set of keyword '
- 'arguments.\n'
- '\n'
- ' If no positional argument is given, an empty dictionary '
- 'is created.\n'
- ' If a positional argument is given and it is a mapping '
- 'object, a\n'
- ' dictionary is created with the same key-value pairs as '
- 'the mapping\n'
- ' object. Otherwise, the positional argument must be an '
- '*iterable*\n'
- ' object. Each item in the iterable must itself be an '
- 'iterable with\n'
- ' exactly two objects. The first object of each item '
- 'becomes a key\n'
- ' in the new dictionary, and the second object the '
- 'corresponding\n'
- ' value. If a key occurs more than once, the last value '
- 'for that key\n'
- ' becomes the corresponding value in the new dictionary.\n'
- '\n'
- ' If keyword arguments are given, the keyword arguments '
- 'and their\n'
- ' values are added to the dictionary created from the '
- 'positional\n'
- ' argument. If a key being added is already present, the '
- 'value from\n'
- ' the keyword argument replaces the value from the '
- 'positional\n'
- ' argument.\n'
- '\n'
- ' To illustrate, the following examples all return a '
- 'dictionary equal\n'
- ' to "{"one": 1, "two": 2, "three": 3}":\n'
- '\n'
- ' >>> a = dict(one=1, two=2, three=3)\n'
- " >>> b = {'one': 1, 'two': 2, 'three': 3}\n"
- " >>> c = dict(zip(['one', 'two', 'three'], [1, 2, "
- '3]))\n'
- " >>> d = dict([('two', 2), ('one', 1), ('three', "
- '3)])\n'
- " >>> e = dict({'three': 3, 'one': 1, 'two': 2})\n"
- ' >>> a == b == c == d == e\n'
- ' True\n'
- '\n'
- ' Providing keyword arguments as in the first example '
- 'only works for\n'
- ' keys that are valid Python identifiers. Otherwise, any '
- 'valid keys\n'
- ' can be used.\n'
- '\n'
- ' These are the operations that dictionaries support (and '
- 'therefore,\n'
- ' custom mapping types should support too):\n'
- '\n'
- ' len(d)\n'
- '\n'
- ' Return the number of items in the dictionary *d*.\n'
- '\n'
- ' d[key]\n'
- '\n'
- ' Return the item of *d* with key *key*. Raises a '
- '"KeyError" if\n'
- ' *key* is not in the map.\n'
- '\n'
- ' If a subclass of dict defines a method '
- '"__missing__()" and *key*\n'
- ' is not present, the "d[key]" operation calls that '
- 'method with\n'
- ' the key *key* as argument. The "d[key]" operation '
- 'then returns\n'
- ' or raises whatever is returned or raised by the\n'
- ' "__missing__(key)" call. No other operations or '
- 'methods invoke\n'
- ' "__missing__()". If "__missing__()" is not defined, '
- '"KeyError"\n'
- ' is raised. "__missing__()" must be a method; it '
- 'cannot be an\n'
- ' instance variable:\n'
- '\n'
- ' >>> class Counter(dict):\n'
- ' ... def __missing__(self, key):\n'
- ' ... return 0\n'
- ' >>> c = Counter()\n'
- " >>> c['red']\n"
- ' 0\n'
- " >>> c['red'] += 1\n"
- " >>> c['red']\n"
- ' 1\n'
- '\n'
- ' The example above shows part of the implementation '
- 'of\n'
- ' "collections.Counter". A different "__missing__" '
- 'method is used\n'
- ' by "collections.defaultdict".\n'
- '\n'
- ' d[key] = value\n'
- '\n'
- ' Set "d[key]" to *value*.\n'
- '\n'
- ' del d[key]\n'
- '\n'
- ' Remove "d[key]" from *d*. Raises a "KeyError" if '
- '*key* is not\n'
- ' in the map.\n'
- '\n'
- ' key in d\n'
- '\n'
- ' Return "True" if *d* has a key *key*, else "False".\n'
- '\n'
- ' key not in d\n'
- '\n'
- ' Equivalent to "not key in d".\n'
- '\n'
- ' iter(d)\n'
- '\n'
- ' Return an iterator over the keys of the dictionary. '
- 'This is a\n'
- ' shortcut for "iter(d.keys())".\n'
- '\n'
- ' clear()\n'
- '\n'
- ' Remove all items from the dictionary.\n'
- '\n'
- ' copy()\n'
- '\n'
- ' Return a shallow copy of the dictionary.\n'
- '\n'
- ' classmethod fromkeys(seq[, value])\n'
- '\n'
- ' Create a new dictionary with keys from *seq* and '
- 'values set to\n'
- ' *value*.\n'
- '\n'
- ' "fromkeys()" is a class method that returns a new '
- 'dictionary.\n'
- ' *value* defaults to "None".\n'
- '\n'
- ' get(key[, default])\n'
- '\n'
- ' Return the value for *key* if *key* is in the '
- 'dictionary, else\n'
- ' *default*. If *default* is not given, it defaults to '
- '"None", so\n'
- ' that this method never raises a "KeyError".\n'
- '\n'
- ' items()\n'
- '\n'
- ' Return a new view of the dictionary\'s items ("(key, '
- 'value)"\n'
- ' pairs). See the *documentation of view objects*.\n'
- '\n'
- ' keys()\n'
- '\n'
- " Return a new view of the dictionary's keys. See "
- 'the\n'
- ' *documentation of view objects*.\n'
- '\n'
- ' pop(key[, default])\n'
- '\n'
- ' If *key* is in the dictionary, remove it and return '
- 'its value,\n'
- ' else return *default*. If *default* is not given '
- 'and *key* is\n'
- ' not in the dictionary, a "KeyError" is raised.\n'
- '\n'
- ' popitem()\n'
- '\n'
- ' Remove and return an arbitrary "(key, value)" pair '
- 'from the\n'
- ' dictionary.\n'
- '\n'
- ' "popitem()" is useful to destructively iterate over '
- 'a\n'
- ' dictionary, as often used in set algorithms. If the '
- 'dictionary\n'
- ' is empty, calling "popitem()" raises a "KeyError".\n'
- '\n'
- ' setdefault(key[, default])\n'
- '\n'
- ' If *key* is in the dictionary, return its value. If '
- 'not, insert\n'
- ' *key* with a value of *default* and return '
- '*default*. *default*\n'
- ' defaults to "None".\n'
- '\n'
- ' update([other])\n'
- '\n'
- ' Update the dictionary with the key/value pairs from '
- '*other*,\n'
- ' overwriting existing keys. Return "None".\n'
- '\n'
- ' "update()" accepts either another dictionary object '
- 'or an\n'
- ' iterable of key/value pairs (as tuples or other '
- 'iterables of\n'
- ' length two). If keyword arguments are specified, '
- 'the dictionary\n'
- ' is then updated with those key/value pairs: '
- '"d.update(red=1,\n'
- ' blue=2)".\n'
- '\n'
- ' values()\n'
- '\n'
- " Return a new view of the dictionary's values. See "
- 'the\n'
- ' *documentation of view objects*.\n'
- '\n'
- ' Dictionaries compare equal if and only if they have the '
- 'same "(key,\n'
- ' value)" pairs. Order comparisons (\'<\', \'<=\', '
- "'>=', '>') raise\n"
- ' "TypeError".\n'
- '\n'
- 'See also: "types.MappingProxyType" can be used to create a '
- 'read-only\n'
- ' view of a "dict".\n'
- '\n'
- '\n'
- 'Dictionary view objects\n'
- '=======================\n'
- '\n'
- 'The objects returned by "dict.keys()", "dict.values()" '
- 'and\n'
- '"dict.items()" are *view objects*. They provide a dynamic '
- 'view on the\n'
- "dictionary's entries, which means that when the dictionary "
- 'changes,\n'
- 'the view reflects these changes.\n'
- '\n'
- 'Dictionary views can be iterated over to yield their '
- 'respective data,\n'
- 'and support membership tests:\n'
- '\n'
- 'len(dictview)\n'
- '\n'
- ' Return the number of entries in the dictionary.\n'
- '\n'
- 'iter(dictview)\n'
- '\n'
- ' Return an iterator over the keys, values or items '
- '(represented as\n'
- ' tuples of "(key, value)") in the dictionary.\n'
- '\n'
- ' Keys and values are iterated over in an arbitrary order '
- 'which is\n'
- ' non-random, varies across Python implementations, and '
- 'depends on\n'
- " the dictionary's history of insertions and deletions. "
- 'If keys,\n'
- ' values and items views are iterated over with no '
- 'intervening\n'
- ' modifications to the dictionary, the order of items '
- 'will directly\n'
- ' correspond. This allows the creation of "(value, key)" '
- 'pairs using\n'
- ' "zip()": "pairs = zip(d.values(), d.keys())". Another '
- 'way to\n'
- ' create the same list is "pairs = [(v, k) for (k, v) in '
- 'd.items()]".\n'
- '\n'
- ' Iterating views while adding or deleting entries in the '
- 'dictionary\n'
- ' may raise a "RuntimeError" or fail to iterate over all '
- 'entries.\n'
- '\n'
- 'x in dictview\n'
- '\n'
- ' Return "True" if *x* is in the underlying dictionary\'s '
- 'keys, values\n'
- ' or items (in the latter case, *x* should be a "(key, '
- 'value)"\n'
- ' tuple).\n'
- '\n'
- 'Keys views are set-like since their entries are unique and '
- 'hashable.\n'
- 'If all values are hashable, so that "(key, value)" pairs '
- 'are unique\n'
- 'and hashable, then the items view is also set-like. '
- '(Values views are\n'
- 'not treated as set-like since the entries are generally '
- 'not unique.)\n'
- 'For set-like views, all of the operations defined for the '
- 'abstract\n'
- 'base class "collections.abc.Set" are available (for '
- 'example, "==",\n'
- '"<", or "^").\n'
- '\n'
- 'An example of dictionary view usage:\n'
- '\n'
- " >>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, "
- "'spam': 500}\n"
- ' >>> keys = dishes.keys()\n'
- ' >>> values = dishes.values()\n'
- '\n'
- ' >>> # iteration\n'
- ' >>> n = 0\n'
- ' >>> for val in values:\n'
- ' ... n += val\n'
- ' >>> print(n)\n'
- ' 504\n'
- '\n'
- ' >>> # keys and values are iterated over in the same '
- 'order\n'
- ' >>> list(keys)\n'
- " ['eggs', 'bacon', 'sausage', 'spam']\n"
- ' >>> list(values)\n'
- ' [2, 1, 1, 500]\n'
- '\n'
- ' >>> # view objects are dynamic and reflect dict '
- 'changes\n'
- " >>> del dishes['eggs']\n"
- " >>> del dishes['sausage']\n"
- ' >>> list(keys)\n'
- " ['spam', 'bacon']\n"
- '\n'
- ' >>> # set operations\n'
- " >>> keys & {'eggs', 'bacon', 'salad'}\n"
- " {'bacon'}\n"
- " >>> keys ^ {'sausage', 'juice'}\n"
- " {'juice', 'sausage', 'bacon', 'spam'}\n",
- 'typesmethods': '\n'
- 'Methods\n'
- '*******\n'
- '\n'
- 'Methods are functions that are called using the attribute '
- 'notation.\n'
- 'There are two flavors: built-in methods (such as '
- '"append()" on lists)\n'
- 'and class instance methods. Built-in methods are '
- 'described with the\n'
- 'types that support them.\n'
- '\n'
- 'If you access a method (a function defined in a class '
- 'namespace)\n'
- 'through an instance, you get a special object: a *bound '
- 'method* (also\n'
- 'called *instance method*) object. When called, it will add '
- 'the "self"\n'
- 'argument to the argument list. Bound methods have two '
- 'special read-\n'
- 'only attributes: "m.__self__" is the object on which the '
- 'method\n'
- 'operates, and "m.__func__" is the function implementing '
- 'the method.\n'
- 'Calling "m(arg-1, arg-2, ..., arg-n)" is completely '
- 'equivalent to\n'
- 'calling "m.__func__(m.__self__, arg-1, arg-2, ..., '
- 'arg-n)".\n'
- '\n'
- 'Like function objects, bound method objects support '
- 'getting arbitrary\n'
- 'attributes. However, since method attributes are actually '
- 'stored on\n'
- 'the underlying function object ("meth.__func__"), setting '
- 'method\n'
- 'attributes on bound methods is disallowed. Attempting to '
- 'set an\n'
- 'attribute on a method results in an "AttributeError" being '
- 'raised. In\n'
- 'order to set a method attribute, you need to explicitly '
- 'set it on the\n'
- 'underlying function object:\n'
- '\n'
- ' >>> class C:\n'
- ' ... def method(self):\n'
- ' ... pass\n'
- ' ...\n'
- ' >>> c = C()\n'
- " >>> c.method.whoami = 'my name is method' # can't set "
- 'on the method\n'
- ' Traceback (most recent call last):\n'
- ' File "<stdin>", line 1, in <module>\n'
- " AttributeError: 'method' object has no attribute "
- "'whoami'\n"
- " >>> c.method.__func__.whoami = 'my name is method'\n"
- ' >>> c.method.whoami\n'
- " 'my name is method'\n"
- '\n'
- 'See *The standard type hierarchy* for more information.\n',
- 'typesmodules': '\n'
- 'Modules\n'
- '*******\n'
- '\n'
- 'The only special operation on a module is attribute '
- 'access: "m.name",\n'
- 'where *m* is a module and *name* accesses a name defined '
- "in *m*'s\n"
- 'symbol table. Module attributes can be assigned to. (Note '
- 'that the\n'
- '"import" statement is not, strictly speaking, an operation '
- 'on a module\n'
- 'object; "import foo" does not require a module object '
- 'named *foo* to\n'
- 'exist, rather it requires an (external) *definition* for a '
- 'module\n'
- 'named *foo* somewhere.)\n'
- '\n'
- 'A special attribute of every module is "__dict__". This is '
- 'the\n'
- "dictionary containing the module's symbol table. Modifying "
- 'this\n'
- "dictionary will actually change the module's symbol table, "
- 'but direct\n'
- 'assignment to the "__dict__" attribute is not possible '
- '(you can write\n'
- '"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", '
- "but you can't\n"
- 'write "m.__dict__ = {}"). Modifying "__dict__" directly '
- 'is not\n'
- 'recommended.\n'
- '\n'
- 'Modules built into the interpreter are written like this: '
- '"<module\n'
- '\'sys\' (built-in)>". If loaded from a file, they are '
- 'written as\n'
- '"<module \'os\' from '
- '\'/usr/local/lib/pythonX.Y/os.pyc\'>".\n',
- 'typesseq': '\n'
- 'Sequence Types --- "list", "tuple", "range"\n'
- '*******************************************\n'
- '\n'
- 'There are three basic sequence types: lists, tuples, and '
- 'range\n'
- 'objects. Additional sequence types tailored for processing of '
- '*binary\n'
- 'data* and *text strings* are described in dedicated sections.\n'
- '\n'
- '\n'
- 'Common Sequence Operations\n'
- '==========================\n'
- '\n'
- 'The operations in the following table are supported by most '
- 'sequence\n'
- 'types, both mutable and immutable. The '
- '"collections.abc.Sequence" ABC\n'
- 'is provided to make it easier to correctly implement these '
- 'operations\n'
- 'on custom sequence types.\n'
- '\n'
- 'This table lists the sequence operations sorted in ascending '
- 'priority.\n'
- 'In the table, *s* and *t* are sequences of the same type, *n*, '
- '*i*,\n'
- '*j* and *k* are integers and *x* is an arbitrary object that '
- 'meets any\n'
- 'type and value restrictions imposed by *s*.\n'
- '\n'
- 'The "in" and "not in" operations have the same priorities as '
- 'the\n'
- 'comparison operations. The "+" (concatenation) and "*" '
- '(repetition)\n'
- 'operations have the same priority as the corresponding '
- 'numeric\n'
- 'operations.\n'
- '\n'
- '+----------------------------+----------------------------------+------------+\n'
- '| Operation | '
- 'Result | Notes |\n'
- '+============================+==================================+============+\n'
- '| "x in s" | "True" if an item of *s* '
- 'is | (1) |\n'
- '| | equal to *x*, else '
- '"False" | |\n'
- '+----------------------------+----------------------------------+------------+\n'
- '| "x not in s" | "False" if an item of *s* '
- 'is | (1) |\n'
- '| | equal to *x*, else '
- '"True" | |\n'
- '+----------------------------+----------------------------------+------------+\n'
- '| "s + t" | the concatenation of *s* and '
- '*t* | (6)(7) |\n'
- '+----------------------------+----------------------------------+------------+\n'
- '| "s * n" or "n * s" | *n* shallow copies of '
- '*s* | (2)(7) |\n'
- '| | '
- 'concatenated | |\n'
- '+----------------------------+----------------------------------+------------+\n'
- '| "s[i]" | *i*th item of *s*, origin '
- '0 | (3) |\n'
- '+----------------------------+----------------------------------+------------+\n'
- '| "s[i:j]" | slice of *s* from *i* to '
- '*j* | (3)(4) |\n'
- '+----------------------------+----------------------------------+------------+\n'
- '| "s[i:j:k]" | slice of *s* from *i* to '
- '*j* | (3)(5) |\n'
- '| | with step '
- '*k* | |\n'
- '+----------------------------+----------------------------------+------------+\n'
- '| "len(s)" | length of '
- '*s* | |\n'
- '+----------------------------+----------------------------------+------------+\n'
- '| "min(s)" | smallest item of '
- '*s* | |\n'
- '+----------------------------+----------------------------------+------------+\n'
- '| "max(s)" | largest item of '
- '*s* | |\n'
- '+----------------------------+----------------------------------+------------+\n'
- '| "s.index(x[, i[, j]])" | index of the first occurrence '
- 'of | (8) |\n'
- '| | *x* in *s* (at or after '
- 'index | |\n'
- '| | *i* and before index '
- '*j*) | |\n'
- '+----------------------------+----------------------------------+------------+\n'
- '| "s.count(x)" | total number of occurrences '
- 'of | |\n'
- '| | *x* in '
- '*s* | |\n'
- '+----------------------------+----------------------------------+------------+\n'
- '\n'
- 'Sequences of the same type also support comparisons. In '
- 'particular,\n'
- 'tuples and lists are compared lexicographically by comparing\n'
- 'corresponding elements. This means that to compare equal, '
- 'every\n'
- 'element must compare equal and the two sequences must be of '
- 'the same\n'
- 'type and have the same length. (For full details see '
- '*Comparisons* in\n'
- 'the language reference.)\n'
- '\n'
- 'Notes:\n'
- '\n'
- '1. While the "in" and "not in" operations are used only for '
- 'simple\n'
- ' containment testing in the general case, some specialised '
- 'sequences\n'
- ' (such as "str", "bytes" and "bytearray") also use them for\n'
- ' subsequence testing:\n'
- '\n'
- ' >>> "gg" in "eggs"\n'
- ' True\n'
- '\n'
- '2. Values of *n* less than "0" are treated as "0" (which '
- 'yields an\n'
- ' empty sequence of the same type as *s*). Note also that '
- 'the copies\n'
- ' are shallow; nested structures are not copied. This often '
- 'haunts\n'
- ' new Python programmers; consider:\n'
- '\n'
- ' >>> lists = [[]] * 3\n'
- ' >>> lists\n'
- ' [[], [], []]\n'
- ' >>> lists[0].append(3)\n'
- ' >>> lists\n'
- ' [[3], [3], [3]]\n'
- '\n'
- ' What has happened is that "[[]]" is a one-element list '
- 'containing\n'
- ' an empty list, so all three elements of "[[]] * 3" are '
- '(pointers\n'
- ' to) this single empty list. Modifying any of the elements '
- 'of\n'
- ' "lists" modifies this single list. You can create a list '
- 'of\n'
- ' different lists this way:\n'
- '\n'
- ' >>> lists = [[] for i in range(3)]\n'
- ' >>> lists[0].append(3)\n'
- ' >>> lists[1].append(5)\n'
- ' >>> lists[2].append(7)\n'
- ' >>> lists\n'
- ' [[3], [5], [7]]\n'
- '\n'
- '3. If *i* or *j* is negative, the index is relative to the end '
- 'of\n'
- ' the string: "len(s) + i" or "len(s) + j" is substituted. '
- 'But note\n'
- ' that "-0" is still "0".\n'
- '\n'
- '4. The slice of *s* from *i* to *j* is defined as the sequence '
- 'of\n'
- ' items with index *k* such that "i <= k < j". If *i* or *j* '
- 'is\n'
- ' greater than "len(s)", use "len(s)". If *i* is omitted or '
- '"None",\n'
- ' use "0". If *j* is omitted or "None", use "len(s)". If '
- '*i* is\n'
- ' greater than or equal to *j*, the slice is empty.\n'
- '\n'
- '5. The slice of *s* from *i* to *j* with step *k* is defined '
- 'as the\n'
- ' sequence of items with index "x = i + n*k" such that "0 <= '
- 'n <\n'
- ' (j-i)/k". In other words, the indices are "i", "i+k", '
- '"i+2*k",\n'
- ' "i+3*k" and so on, stopping when *j* is reached (but never\n'
- ' including *j*). If *i* or *j* is greater than "len(s)", '
- 'use\n'
- ' "len(s)". If *i* or *j* are omitted or "None", they become '
- '"end"\n'
- ' values (which end depends on the sign of *k*). Note, *k* '
- 'cannot be\n'
- ' zero. If *k* is "None", it is treated like "1".\n'
- '\n'
- '6. Concatenating immutable sequences always results in a new\n'
- ' object. This means that building up a sequence by repeated\n'
- ' concatenation will have a quadratic runtime cost in the '
- 'total\n'
- ' sequence length. To get a linear runtime cost, you must '
- 'switch to\n'
- ' one of the alternatives below:\n'
- '\n'
- ' * if concatenating "str" objects, you can build a list and '
- 'use\n'
- ' "str.join()" at the end or else write to a "io.StringIO" '
- 'instance\n'
- ' and retrieve its value when complete\n'
- '\n'
- ' * if concatenating "bytes" objects, you can similarly use\n'
- ' "bytes.join()" or "io.BytesIO", or you can do in-place\n'
- ' concatenation with a "bytearray" object. "bytearray" '
- 'objects are\n'
- ' mutable and have an efficient overallocation mechanism\n'
- '\n'
- ' * if concatenating "tuple" objects, extend a "list" '
- 'instead\n'
- '\n'
- ' * for other types, investigate the relevant class '
- 'documentation\n'
- '\n'
- '7. Some sequence types (such as "range") only support item\n'
- " sequences that follow specific patterns, and hence don't "
- 'support\n'
- ' sequence concatenation or repetition.\n'
- '\n'
- '8. "index" raises "ValueError" when *x* is not found in *s*. '
- 'When\n'
- ' supported, the additional arguments to the index method '
- 'allow\n'
- ' efficient searching of subsections of the sequence. Passing '
- 'the\n'
- ' extra arguments is roughly equivalent to using '
- '"s[i:j].index(x)",\n'
- ' only without copying any data and with the returned index '
- 'being\n'
- ' relative to the start of the sequence rather than the start '
- 'of the\n'
- ' slice.\n'
- '\n'
- '\n'
- 'Immutable Sequence Types\n'
- '========================\n'
- '\n'
- 'The only operation that immutable sequence types generally '
- 'implement\n'
- 'that is not also implemented by mutable sequence types is '
- 'support for\n'
- 'the "hash()" built-in.\n'
- '\n'
- 'This support allows immutable sequences, such as "tuple" '
- 'instances, to\n'
- 'be used as "dict" keys and stored in "set" and "frozenset" '
- 'instances.\n'
- '\n'
- 'Attempting to hash an immutable sequence that contains '
- 'unhashable\n'
- 'values will result in "TypeError".\n'
- '\n'
- '\n'
- 'Mutable Sequence Types\n'
- '======================\n'
- '\n'
- 'The operations in the following table are defined on mutable '
- 'sequence\n'
- 'types. The "collections.abc.MutableSequence" ABC is provided '
- 'to make\n'
- 'it easier to correctly implement these operations on custom '
- 'sequence\n'
- 'types.\n'
- '\n'
- 'In the table *s* is an instance of a mutable sequence type, '
- '*t* is any\n'
- 'iterable object and *x* is an arbitrary object that meets any '
- 'type and\n'
- 'value restrictions imposed by *s* (for example, "bytearray" '
- 'only\n'
- 'accepts integers that meet the value restriction "0 <= x <= '
- '255").\n'
- '\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| Operation | '
- 'Result | Notes |\n'
- '+================================+==================================+=======================+\n'
- '| "s[i] = x" | item *i* of *s* is replaced '
- 'by | |\n'
- '| | '
- '*x* | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s[i:j] = t" | slice of *s* from *i* to '
- '*j* is | |\n'
- '| | replaced by the contents of '
- 'the | |\n'
- '| | iterable '
- '*t* | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "del s[i:j]" | same as "s[i:j] = '
- '[]" | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s[i:j:k] = t" | the elements of "s[i:j:k]" '
- 'are | (1) |\n'
- '| | replaced by those of '
- '*t* | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "del s[i:j:k]" | removes the elements '
- 'of | |\n'
- '| | "s[i:j:k]" from the '
- 'list | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.append(x)" | appends *x* to the end of '
- 'the | |\n'
- '| | sequence (same '
- 'as | |\n'
- '| | "s[len(s):len(s)] = '
- '[x]") | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.clear()" | removes all items from "s" '
- '(same | (5) |\n'
- '| | as "del '
- 's[:]") | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.copy()" | creates a shallow copy of '
- '"s" | (5) |\n'
- '| | (same as '
- '"s[:]") | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.extend(t)" | extends *s* with the '
- 'contents of | |\n'
- '| | *t* (same as '
- '"s[len(s):len(s)] = | |\n'
- '| | '
- 't") | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.insert(i, x)" | inserts *x* into *s* at '
- 'the | |\n'
- '| | index given by *i* (same '
- 'as | |\n'
- '| | "s[i:i] = '
- '[x]") | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.pop([i])" | retrieves the item at *i* '
- 'and | (2) |\n'
- '| | also removes it from '
- '*s* | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.remove(x)" | remove the first item from '
- '*s* | (3) |\n'
- '| | where "s[i] == '
- 'x" | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.reverse()" | reverses the items of *s* '
- 'in | (4) |\n'
- '| | '
- 'place | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '\n'
- 'Notes:\n'
- '\n'
- '1. *t* must have the same length as the slice it is '
- 'replacing.\n'
- '\n'
- '2. The optional argument *i* defaults to "-1", so that by '
- 'default\n'
- ' the last item is removed and returned.\n'
- '\n'
- '3. "remove" raises "ValueError" when *x* is not found in *s*.\n'
- '\n'
- '4. The "reverse()" method modifies the sequence in place for\n'
- ' economy of space when reversing a large sequence. To '
- 'remind users\n'
- ' that it operates by side effect, it does not return the '
- 'reversed\n'
- ' sequence.\n'
- '\n'
- '5. "clear()" and "copy()" are included for consistency with '
- 'the\n'
- " interfaces of mutable containers that don't support "
- 'slicing\n'
- ' operations (such as "dict" and "set")\n'
- '\n'
- ' New in version 3.3: "clear()" and "copy()" methods.\n'
- '\n'
- '\n'
- 'Lists\n'
- '=====\n'
- '\n'
- 'Lists are mutable sequences, typically used to store '
- 'collections of\n'
- 'homogeneous items (where the precise degree of similarity will '
- 'vary by\n'
- 'application).\n'
- '\n'
- 'class class list([iterable])\n'
- '\n'
- ' Lists may be constructed in several ways:\n'
- '\n'
- ' * Using a pair of square brackets to denote the empty list: '
- '"[]"\n'
- '\n'
- ' * Using square brackets, separating items with commas: '
- '"[a]",\n'
- ' "[a, b, c]"\n'
- '\n'
- ' * Using a list comprehension: "[x for x in iterable]"\n'
- '\n'
- ' * Using the type constructor: "list()" or "list(iterable)"\n'
- '\n'
- ' The constructor builds a list whose items are the same and '
- 'in the\n'
- " same order as *iterable*'s items. *iterable* may be either "
- 'a\n'
- ' sequence, a container that supports iteration, or an '
- 'iterator\n'
- ' object. If *iterable* is already a list, a copy is made '
- 'and\n'
- ' returned, similar to "iterable[:]". For example, '
- '"list(\'abc\')"\n'
- ' returns "[\'a\', \'b\', \'c\']" and "list( (1, 2, 3) )" '
- 'returns "[1, 2,\n'
- ' 3]". If no argument is given, the constructor creates a new '
- 'empty\n'
- ' list, "[]".\n'
- '\n'
- ' Many other operations also produce lists, including the '
- '"sorted()"\n'
- ' built-in.\n'
- '\n'
- ' Lists implement all of the *common* and *mutable* sequence\n'
- ' operations. Lists also provide the following additional '
- 'method:\n'
- '\n'
- ' sort(*, key=None, reverse=None)\n'
- '\n'
- ' This method sorts the list in place, using only "<" '
- 'comparisons\n'
- ' between items. Exceptions are not suppressed - if any '
- 'comparison\n'
- ' operations fail, the entire sort operation will fail '
- '(and the\n'
- ' list will likely be left in a partially modified '
- 'state).\n'
- '\n'
- ' "sort()" accepts two arguments that can only be passed '
- 'by\n'
- ' keyword (*keyword-only arguments*):\n'
- '\n'
- ' *key* specifies a function of one argument that is used '
- 'to\n'
- ' extract a comparison key from each list element (for '
- 'example,\n'
- ' "key=str.lower"). The key corresponding to each item in '
- 'the list\n'
- ' is calculated once and then used for the entire sorting '
- 'process.\n'
- ' The default value of "None" means that list items are '
- 'sorted\n'
- ' directly without calculating a separate key value.\n'
- '\n'
- ' The "functools.cmp_to_key()" utility is available to '
- 'convert a\n'
- ' 2.x style *cmp* function to a *key* function.\n'
- '\n'
- ' *reverse* is a boolean value. If set to "True", then '
- 'the list\n'
- ' elements are sorted as if each comparison were '
- 'reversed.\n'
- '\n'
- ' This method modifies the sequence in place for economy '
- 'of space\n'
- ' when sorting a large sequence. To remind users that it '
- 'operates\n'
- ' by side effect, it does not return the sorted sequence '
- '(use\n'
- ' "sorted()" to explicitly request a new sorted list '
- 'instance).\n'
- '\n'
- ' The "sort()" method is guaranteed to be stable. A sort '
- 'is\n'
- ' stable if it guarantees not to change the relative order '
- 'of\n'
- ' elements that compare equal --- this is helpful for '
- 'sorting in\n'
- ' multiple passes (for example, sort by department, then '
- 'by salary\n'
- ' grade).\n'
- '\n'
- ' **CPython implementation detail:** While a list is being '
- 'sorted,\n'
- ' the effect of attempting to mutate, or even inspect, the '
- 'list is\n'
- ' undefined. The C implementation of Python makes the '
- 'list appear\n'
- ' empty for the duration, and raises "ValueError" if it '
- 'can detect\n'
- ' that the list has been mutated during a sort.\n'
- '\n'
- '\n'
- 'Tuples\n'
- '======\n'
- '\n'
- 'Tuples are immutable sequences, typically used to store '
- 'collections of\n'
- 'heterogeneous data (such as the 2-tuples produced by the '
- '"enumerate()"\n'
- 'built-in). Tuples are also used for cases where an immutable '
- 'sequence\n'
- 'of homogeneous data is needed (such as allowing storage in a '
- '"set" or\n'
- '"dict" instance).\n'
- '\n'
- 'class class tuple([iterable])\n'
- '\n'
- ' Tuples may be constructed in a number of ways:\n'
- '\n'
- ' * Using a pair of parentheses to denote the empty tuple: '
- '"()"\n'
- '\n'
- ' * Using a trailing comma for a singleton tuple: "a," or '
- '"(a,)"\n'
- '\n'
- ' * Separating items with commas: "a, b, c" or "(a, b, c)"\n'
- '\n'
- ' * Using the "tuple()" built-in: "tuple()" or '
- '"tuple(iterable)"\n'
- '\n'
- ' The constructor builds a tuple whose items are the same and '
- 'in the\n'
- " same order as *iterable*'s items. *iterable* may be either "
- 'a\n'
- ' sequence, a container that supports iteration, or an '
- 'iterator\n'
- ' object. If *iterable* is already a tuple, it is returned\n'
- ' unchanged. For example, "tuple(\'abc\')" returns "(\'a\', '
- '\'b\', \'c\')"\n'
- ' and "tuple( [1, 2, 3] )" returns "(1, 2, 3)". If no '
- 'argument is\n'
- ' given, the constructor creates a new empty tuple, "()".\n'
- '\n'
- ' Note that it is actually the comma which makes a tuple, not '
- 'the\n'
- ' parentheses. The parentheses are optional, except in the '
- 'empty\n'
- ' tuple case, or when they are needed to avoid syntactic '
- 'ambiguity.\n'
- ' For example, "f(a, b, c)" is a function call with three '
- 'arguments,\n'
- ' while "f((a, b, c))" is a function call with a 3-tuple as '
- 'the sole\n'
- ' argument.\n'
- '\n'
- ' Tuples implement all of the *common* sequence operations.\n'
- '\n'
- 'For heterogeneous collections of data where access by name is '
- 'clearer\n'
- 'than access by index, "collections.namedtuple()" may be a '
- 'more\n'
- 'appropriate choice than a simple tuple object.\n'
- '\n'
- '\n'
- 'Ranges\n'
- '======\n'
- '\n'
- 'The "range" type represents an immutable sequence of numbers '
- 'and is\n'
- 'commonly used for looping a specific number of times in "for" '
- 'loops.\n'
- '\n'
- 'class class range(stop)\n'
- 'class class range(start, stop[, step])\n'
- '\n'
- ' The arguments to the range constructor must be integers '
- '(either\n'
- ' built-in "int" or any object that implements the '
- '"__index__"\n'
- ' special method). If the *step* argument is omitted, it '
- 'defaults to\n'
- ' "1". If the *start* argument is omitted, it defaults to '
- '"0". If\n'
- ' *step* is zero, "ValueError" is raised.\n'
- '\n'
- ' For a positive *step*, the contents of a range "r" are '
- 'determined\n'
- ' by the formula "r[i] = start + step*i" where "i >= 0" and '
- '"r[i] <\n'
- ' stop".\n'
- '\n'
- ' For a negative *step*, the contents of the range are still\n'
- ' determined by the formula "r[i] = start + step*i", but the\n'
- ' constraints are "i >= 0" and "r[i] > stop".\n'
- '\n'
- ' A range object will be empty if "r[0]" does not meet the '
- 'value\n'
- ' constraint. Ranges do support negative indices, but these '
- 'are\n'
- ' interpreted as indexing from the end of the sequence '
- 'determined by\n'
- ' the positive indices.\n'
- '\n'
- ' Ranges containing absolute values larger than "sys.maxsize" '
- 'are\n'
- ' permitted but some features (such as "len()") may raise\n'
- ' "OverflowError".\n'
- '\n'
- ' Range examples:\n'
- '\n'
- ' >>> list(range(10))\n'
- ' [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n'
- ' >>> list(range(1, 11))\n'
- ' [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n'
- ' >>> list(range(0, 30, 5))\n'
- ' [0, 5, 10, 15, 20, 25]\n'
- ' >>> list(range(0, 10, 3))\n'
- ' [0, 3, 6, 9]\n'
- ' >>> list(range(0, -10, -1))\n'
- ' [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n'
- ' >>> list(range(0))\n'
- ' []\n'
- ' >>> list(range(1, 0))\n'
- ' []\n'
- '\n'
- ' Ranges implement all of the *common* sequence operations '
- 'except\n'
- ' concatenation and repetition (due to the fact that range '
- 'objects\n'
- ' can only represent sequences that follow a strict pattern '
- 'and\n'
- ' repetition and concatenation will usually violate that '
- 'pattern).\n'
- '\n'
- 'The advantage of the "range" type over a regular "list" or '
- '"tuple" is\n'
- 'that a "range" object will always take the same (small) amount '
- 'of\n'
- 'memory, no matter the size of the range it represents (as it '
- 'only\n'
- 'stores the "start", "stop" and "step" values, calculating '
- 'individual\n'
- 'items and subranges as needed).\n'
- '\n'
- 'Range objects implement the "collections.abc.Sequence" ABC, '
- 'and\n'
- 'provide features such as containment tests, element index '
- 'lookup,\n'
- 'slicing and support for negative indices (see *Sequence Types '
- '---\n'
- 'list, tuple, range*):\n'
- '\n'
- '>>> r = range(0, 20, 2)\n'
- '>>> r\n'
- 'range(0, 20, 2)\n'
- '>>> 11 in r\n'
- 'False\n'
- '>>> 10 in r\n'
- 'True\n'
- '>>> r.index(10)\n'
- '5\n'
- '>>> r[5]\n'
- '10\n'
- '>>> r[:5]\n'
- 'range(0, 10, 2)\n'
- '>>> r[-1]\n'
- '18\n'
- '\n'
- 'Testing range objects for equality with "==" and "!=" compares '
- 'them as\n'
- 'sequences. That is, two range objects are considered equal if '
- 'they\n'
- 'represent the same sequence of values. (Note that two range '
- 'objects\n'
- 'that compare equal might have different "start", "stop" and '
- '"step"\n'
- 'attributes, for example "range(0) == range(2, 1, 3)" or '
- '"range(0, 3,\n'
- '2) == range(0, 4, 2)".)\n'
- '\n'
- 'Changed in version 3.2: Implement the Sequence ABC. Support '
- 'slicing\n'
- 'and negative indices. Test "int" objects for membership in '
- 'constant\n'
- 'time instead of iterating through all items.\n'
- '\n'
- "Changed in version 3.3: Define '==' and '!=' to compare range "
- 'objects\n'
- 'based on the sequence of values they define (instead of '
- 'comparing\n'
- 'based on object identity).\n'
- '\n'
- 'New in version 3.3: The "start", "stop" and "step" '
- 'attributes.\n',
- 'typesseq-mutable': '\n'
- 'Mutable Sequence Types\n'
- '**********************\n'
- '\n'
- 'The operations in the following table are defined on '
- 'mutable sequence\n'
- 'types. The "collections.abc.MutableSequence" ABC is '
- 'provided to make\n'
- 'it easier to correctly implement these operations on '
- 'custom sequence\n'
- 'types.\n'
- '\n'
- 'In the table *s* is an instance of a mutable sequence '
- 'type, *t* is any\n'
- 'iterable object and *x* is an arbitrary object that '
- 'meets any type and\n'
- 'value restrictions imposed by *s* (for example, '
- '"bytearray" only\n'
- 'accepts integers that meet the value restriction "0 <= '
- 'x <= 255").\n'
- '\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| Operation | '
- 'Result | '
- 'Notes |\n'
- '+================================+==================================+=======================+\n'
- '| "s[i] = x" | item *i* of *s* is '
- 'replaced by | |\n'
- '| | '
- '*x* '
- '| |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s[i:j] = t" | slice of *s* from '
- '*i* to *j* is | |\n'
- '| | replaced by the '
- 'contents of the | |\n'
- '| | iterable '
- '*t* | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "del s[i:j]" | same as "s[i:j] = '
- '[]" | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s[i:j:k] = t" | the elements of '
- '"s[i:j:k]" are | (1) |\n'
- '| | replaced by those '
- 'of *t* | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "del s[i:j:k]" | removes the '
- 'elements of | |\n'
- '| | "s[i:j:k]" from the '
- 'list | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.append(x)" | appends *x* to the '
- 'end of the | |\n'
- '| | sequence (same '
- 'as | |\n'
- '| | "s[len(s):len(s)] = '
- '[x]") | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.clear()" | removes all items '
- 'from "s" (same | (5) |\n'
- '| | as "del '
- 's[:]") | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.copy()" | creates a shallow '
- 'copy of "s" | (5) |\n'
- '| | (same as '
- '"s[:]") | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.extend(t)" | extends *s* with '
- 'the contents of | |\n'
- '| | *t* (same as '
- '"s[len(s):len(s)] = | |\n'
- '| | '
- 't") '
- '| |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.insert(i, x)" | inserts *x* into '
- '*s* at the | |\n'
- '| | index given by *i* '
- '(same as | |\n'
- '| | "s[i:i] = '
- '[x]") | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.pop([i])" | retrieves the item '
- 'at *i* and | (2) |\n'
- '| | also removes it '
- 'from *s* | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.remove(x)" | remove the first '
- 'item from *s* | (3) |\n'
- '| | where "s[i] == '
- 'x" | |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.reverse()" | reverses the items '
- 'of *s* in | (4) |\n'
- '| | '
- 'place '
- '| |\n'
- '+--------------------------------+----------------------------------+-----------------------+\n'
- '\n'
- 'Notes:\n'
- '\n'
- '1. *t* must have the same length as the slice it is '
- 'replacing.\n'
- '\n'
- '2. The optional argument *i* defaults to "-1", so that '
- 'by default\n'
- ' the last item is removed and returned.\n'
- '\n'
- '3. "remove" raises "ValueError" when *x* is not found '
- 'in *s*.\n'
- '\n'
- '4. The "reverse()" method modifies the sequence in '
- 'place for\n'
- ' economy of space when reversing a large sequence. '
- 'To remind users\n'
- ' that it operates by side effect, it does not return '
- 'the reversed\n'
- ' sequence.\n'
- '\n'
- '5. "clear()" and "copy()" are included for consistency '
- 'with the\n'
- " interfaces of mutable containers that don't support "
- 'slicing\n'
- ' operations (such as "dict" and "set")\n'
- '\n'
- ' New in version 3.3: "clear()" and "copy()" '
- 'methods.\n',
- 'unary': '\n'
- 'Unary arithmetic and bitwise operations\n'
- '***************************************\n'
- '\n'
- 'All unary arithmetic and bitwise operations have the same '
- 'priority:\n'
- '\n'
- ' u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n'
- '\n'
- 'The unary "-" (minus) operator yields the negation of its '
- 'numeric\n'
- 'argument.\n'
- '\n'
- 'The unary "+" (plus) operator yields its numeric argument '
- 'unchanged.\n'
- '\n'
- 'The unary "~" (invert) operator yields the bitwise inversion of '
- 'its\n'
- 'integer argument. The bitwise inversion of "x" is defined as\n'
- '"-(x+1)". It only applies to integral numbers.\n'
- '\n'
- 'In all three cases, if the argument does not have the proper '
- 'type, a\n'
- '"TypeError" exception is raised.\n',
- 'while': '\n'
- 'The "while" statement\n'
- '*********************\n'
- '\n'
- 'The "while" statement is used for repeated execution as long as '
- 'an\n'
- 'expression is true:\n'
- '\n'
- ' while_stmt ::= "while" expression ":" suite\n'
- ' ["else" ":" suite]\n'
- '\n'
- 'This repeatedly tests the expression and, if it is true, executes '
- 'the\n'
- 'first suite; if the expression is false (which may be the first '
- 'time\n'
- 'it is tested) the suite of the "else" clause, if present, is '
- 'executed\n'
- 'and the loop terminates.\n'
- '\n'
- 'A "break" statement executed in the first suite terminates the '
- 'loop\n'
- 'without executing the "else" clause\'s suite. A "continue" '
- 'statement\n'
- 'executed in the first suite skips the rest of the suite and goes '
- 'back\n'
- 'to testing the expression.\n',
- 'with': '\n'
- 'The "with" statement\n'
- '********************\n'
- '\n'
- 'The "with" statement is used to wrap the execution of a block '
- 'with\n'
- 'methods defined by a context manager (see section *With Statement\n'
- 'Context Managers*). This allows common '
- '"try"..."except"..."finally"\n'
- 'usage patterns to be encapsulated for convenient reuse.\n'
- '\n'
- ' with_stmt ::= "with" with_item ("," with_item)* ":" suite\n'
- ' with_item ::= expression ["as" target]\n'
- '\n'
- 'The execution of the "with" statement with one "item" proceeds as\n'
- 'follows:\n'
- '\n'
- '1. The context expression (the expression given in the '
- '"with_item")\n'
- ' is evaluated to obtain a context manager.\n'
- '\n'
- '2. The context manager\'s "__exit__()" is loaded for later use.\n'
- '\n'
- '3. The context manager\'s "__enter__()" method is invoked.\n'
- '\n'
- '4. If a target was included in the "with" statement, the return\n'
- ' value from "__enter__()" is assigned to it.\n'
- '\n'
- ' Note: The "with" statement guarantees that if the '
- '"__enter__()"\n'
- ' method returns without an error, then "__exit__()" will '
- 'always be\n'
- ' called. Thus, if an error occurs during the assignment to '
- 'the\n'
- ' target list, it will be treated the same as an error '
- 'occurring\n'
- ' within the suite would be. See step 6 below.\n'
- '\n'
- '5. The suite is executed.\n'
- '\n'
- '6. The context manager\'s "__exit__()" method is invoked. If an\n'
- ' exception caused the suite to be exited, its type, value, and\n'
- ' traceback are passed as arguments to "__exit__()". Otherwise, '
- 'three\n'
- ' "None" arguments are supplied.\n'
- '\n'
- ' If the suite was exited due to an exception, and the return '
- 'value\n'
- ' from the "__exit__()" method was false, the exception is '
- 'reraised.\n'
- ' If the return value was true, the exception is suppressed, and\n'
- ' execution continues with the statement following the "with"\n'
- ' statement.\n'
- '\n'
- ' If the suite was exited for any reason other than an exception, '
- 'the\n'
- ' return value from "__exit__()" is ignored, and execution '
- 'proceeds\n'
- ' at the normal location for the kind of exit that was taken.\n'
- '\n'
- 'With more than one item, the context managers are processed as if\n'
- 'multiple "with" statements were nested:\n'
- '\n'
- ' with A() as a, B() as b:\n'
- ' suite\n'
- '\n'
- 'is equivalent to\n'
- '\n'
- ' with A() as a:\n'
- ' with B() as b:\n'
- ' suite\n'
- '\n'
- 'Changed in version 3.1: Support for multiple context expressions.\n'
- '\n'
- 'See also: **PEP 0343** - The "with" statement\n'
- '\n'
- ' The specification, background, and examples for the Python '
- '"with"\n'
- ' statement.\n',
- 'yield': '\n'
- 'The "yield" statement\n'
- '*********************\n'
- '\n'
- ' yield_stmt ::= yield_expression\n'
- '\n'
- 'A "yield" statement is semantically equivalent to a *yield\n'
- 'expression*. The yield statement can be used to omit the '
- 'parentheses\n'
- 'that would otherwise be required in the equivalent yield '
- 'expression\n'
- 'statement. For example, the yield statements\n'
- '\n'
- ' yield <expr>\n'
- ' yield from <expr>\n'
- '\n'
- 'are equivalent to the yield expression statements\n'
- '\n'
- ' (yield <expr>)\n'
- ' (yield from <expr>)\n'
- '\n'
- 'Yield expressions and statements are only used when defining a\n'
- '*generator* function, and are only used in the body of the '
- 'generator\n'
- 'function. Using yield in a function definition is sufficient to '
- 'cause\n'
- 'that definition to create a generator function instead of a '
- 'normal\n'
- 'function.\n'
- '\n'
- 'For full details of "yield" semantics, refer to the *Yield\n'
- 'expressions* section.\n'}
+# Autogenerated by Sphinx on Sat May 23 17:38:41 2015
+topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names. In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O). The current code generator emits no code for an\nassert statement when optimization is requested at compile time. Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n',
+ 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n | "*" target\n\n(See section *Primaries* for the syntax definitions for\n*attributeref*, *subscription*, and *slicing*.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list, optionally enclosed in\nparentheses or square brackets, is recursively defined as follows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The\n object must be an iterable with the same number of items as there\n are targets in the target list, and the items are assigned, from\n left to right, to the corresponding targets.\n\n * If the target list contains one target prefixed with an\n asterisk, called a "starred" target: The object must be a sequence\n with at least as many items as there are targets in the target\n list, minus one. The first items of the sequence are assigned,\n from left to right, to the targets before the starred target. The\n final items of the sequence are assigned to the targets after the\n starred target. A list of the remaining items in the sequence is\n then assigned to the starred target (the list can be empty).\n\n * Else: The object must be a sequence with the same number of\n items as there are targets in the target list, and the items are\n assigned, from left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a "global" or "nonlocal" statement\n in the current code block: the name is bound to the object in the\n current local namespace.\n\n * Otherwise: the name is bound to the object in the global\n namespace or the outer namespace determined by "nonlocal",\n respectively.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in\n square brackets: The object must be an iterable with the same number\n of items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, "TypeError" is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily "AttributeError").\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n "a.x" can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target "a.x" is always\n set as an instance attribute, creating it if necessary. Thus, the\n two occurrences of "a.x" do not necessarily refer to the same\n attribute: if the RHS expression refers to a class attribute, the\n LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield an integer. If it is negative, the sequence\'s\n length is added to it. The resulting value must be a nonnegative\n integer less than the sequence\'s length, and the sequence is asked\n to assign the assigned object to its item with that index. If the\n index is out of range, "IndexError" is raised (assignment to a\n subscripted sequence cannot add new items to a list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n For user-defined objects, the "__setitem__()" method is called with\n appropriate arguments.\n\n* If the target is a slicing: The primary expression in the\n reference is evaluated. It should yield a mutable sequence object\n (such as a list). The assigned object should be a sequence object\n of the same type. Next, the lower and upper bound expressions are\n evaluated, insofar they are present; defaults are zero and the\n sequence\'s length. The bounds should evaluate to integers. If\n either bound is negative, the sequence\'s length is added to it. The\n resulting bounds are clipped to lie between zero and the sequence\'s\n length, inclusive. Finally, the sequence object is asked to replace\n the slice with the items of the assigned sequence. The length of\n the slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the target\n sequence allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nAlthough the definition of assignment implies that overlaps between\nthe left-hand side and the right-hand side are \'simultanenous\' (for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables occur left-to-right, sometimes\nresulting in confusion. For instance, the following program prints\n"[0, 2]":\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2 # i is updated, then x[i] is updated\n print(x)\n\nSee also: **PEP 3132** - Extended Iterable Unpacking\n\n The specification for the "*target" feature.\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "@=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions of the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nUnlike normal assignments, augmented assignments evaluate the left-\nhand side *before* evaluating the right-hand side. For example, "a[i]\n+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and performs\nthe addition, and lastly, it writes the result back to "a[i]".\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same *caveat about\nclass and instance attributes* applies as for regular assignments.\n',
+ 'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a "NameError" exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name, with leading underscores removed and a single underscore\ninserted, in front of the name. For example, the identifier "__spam"\noccurring in a class named "Ham" will be transformed to "_Ham__spam".\nThis transformation is independent of the syntactical context in which\nthe identifier is used. If the transformed name is extremely long\n(longer than 255 characters), implementation defined truncation may\nhappen. If the class name consists only of underscores, no\ntransformation is done.\n',
+ 'atom-literals': u"\nLiterals\n********\n\nPython supports string and bytes literals and various numeric\nliterals:\n\n literal ::= stringliteral | bytesliteral\n | integer | floatnumber | imagnumber\n\nEvaluation of a literal yields an object of the given type (string,\nbytes, integer, floating point number, complex number) with the given\nvalue. The value may be approximated in the case of floating point\nand imaginary (complex) literals. See section *Literals* for details.\n\nAll literals correspond to immutable data types, and hence the\nobject's identity is less important than its value. Multiple\nevaluations of literals with the same value (either the same\noccurrence in the program text or a different occurrence) may obtain\nthe same object or a different object with the same value.\n",
+ 'attribute-access': u'\nCustomizing attribute access\n****************************\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control over attribute access.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See *Special method lookup*.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should call the base class method with the same name, for example,\n "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\nobject.__dir__(self)\n\n Called when "dir()" is called on the object. A sequence must be\n returned. "dir()" converts the returned sequence to a list and\n sorts it.\n\n\nImplementing Descriptors\n========================\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\nThe attribute "__objclass__" is interpreted by the "inspect" module as\nspecifying the class where this object was defined (setting this\nappropriately can assist in runtime introspection of dynamic class\nattributes). For callables, it may indicate that an instance of the\ngiven type (or a subclass) is expected or required as the first\npositional argument (for example, CPython sets this attribute for\nunbound methods that are implemented in C).\n\n\nInvoking Descriptors\n====================\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called.\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to an object instance, "a.x" is transformed into the\n call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a class, "A.x" is transformed into the call:\n "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n=========\n\nBy default, instances of classes have a dictionary for attribute\nstorage. This wastes space for objects having very few instance\nvariables. The space consumption can become acute when creating large\nnumbers of instances.\n\nThe default can be overridden by defining *__slots__* in a class\ndefinition. The *__slots__* declaration takes a sequence of instance\nvariables and reserves just enough space in each instance to hold a\nvalue for each variable. Space is saved because *__dict__* is not\ncreated for each instance.\n\nobject.__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. *__slots__*\n reserves space for the declared variables and prevents the\n automatic creation of *__dict__* and *__weakref__* for each\n instance.\n\n\nNotes on using *__slots__*\n--------------------------\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (*Implementing Descriptors*) for each variable name. As\n a result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "int", "bytes" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n',
+ 'attribute-references': u'\nAttribute references\n********************\n\nAn attribute reference is a primary followed by a period and a name:\n\n attributeref ::= primary "." identifier\n\nThe primary must evaluate to an object of a type that supports\nattribute references, which most objects do. This object is then\nasked to produce the attribute whose name is the identifier. This\nproduction can be customized by overriding the "__getattr__()" method.\nIf this attribute is not available, the exception "AttributeError" is\nraised. Otherwise, the type and value of the object produced is\ndetermined by the object. Multiple evaluations of the same attribute\nreference may yield different objects.\n',
+ 'augassign': u'\nAugmented assignment statements\n*******************************\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "@=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions of the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nUnlike normal assignments, augmented assignments evaluate the left-\nhand side *before* evaluating the right-hand side. For example, "a[i]\n+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and performs\nthe addition, and lastly, it writes the result back to "a[i]".\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same *caveat about\nclass and instance attributes* applies as for regular assignments.\n',
+ 'binary': u'\nBinary arithmetic operations\n****************************\n\nThe binary arithmetic operations have the conventional priority\nlevels. Note that some of these operations also apply to certain non-\nnumeric types. Apart from the power operator, there are only two\nlevels, one for multiplicative operators and one for additive\noperators:\n\n m_expr ::= u_expr | m_expr "*" u_expr | m_expr "@" m_expr |\n m_expr "//" u_expr| m_expr "/" u_expr |\n m_expr "%" u_expr\n a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr\n\nThe "*" (multiplication) operator yields the product of its arguments.\nThe arguments must either both be numbers, or one argument must be an\ninteger and the other must be a sequence. In the former case, the\nnumbers are converted to a common type and then multiplied together.\nIn the latter case, sequence repetition is performed; a negative\nrepetition factor yields an empty sequence.\n\nThe "@" (at) operator is intended to be used for matrix\nmultiplication. No builtin Python types implement this operator.\n\nNew in version 3.5.\n\nThe "/" (division) and "//" (floor division) operators yield the\nquotient of their arguments. The numeric arguments are first\nconverted to a common type. Division of integers yields a float, while\nfloor division of integers results in an integer; the result is that\nof mathematical division with the \'floor\' function applied to the\nresult. Division by zero raises the "ZeroDivisionError" exception.\n\nThe "%" (modulo) operator yields the remainder from the division of\nthe first argument by the second. The numeric arguments are first\nconverted to a common type. A zero right argument raises the\n"ZeroDivisionError" exception. The arguments may be floating point\nnumbers, e.g., "3.14%0.7" equals "0.34" (since "3.14" equals "4*0.7 +\n0.34".) The modulo operator always yields a result with the same sign\nas its second operand (or zero); the absolute value of the result is\nstrictly smaller than the absolute value of the second operand [1].\n\nThe floor division and modulo operators are connected by the following\nidentity: "x == (x//y)*y + (x%y)". Floor division and modulo are also\nconnected with the built-in function "divmod()": "divmod(x, y) ==\n(x//y, x%y)". [2].\n\nIn addition to performing the modulo operation on numbers, the "%"\noperator is also overloaded by string objects to perform old-style\nstring formatting (also known as interpolation). The syntax for\nstring formatting is described in the Python Library Reference,\nsection *printf-style String Formatting*.\n\nThe floor division operator, the modulo operator, and the "divmod()"\nfunction are not defined for complex numbers. Instead, convert to a\nfloating point number using the "abs()" function if appropriate.\n\nThe "+" (addition) operator yields the sum of its arguments. The\narguments must either both be numbers or both be sequences of the same\ntype. In the former case, the numbers are converted to a common type\nand then added together. In the latter case, the sequences are\nconcatenated.\n\nThe "-" (subtraction) operator yields the difference of its arguments.\nThe numeric arguments are first converted to a common type.\n',
+ 'bitwise': u'\nBinary bitwise operations\n*************************\n\nEach of the three bitwise operations has a different priority level:\n\n and_expr ::= shift_expr | and_expr "&" shift_expr\n xor_expr ::= and_expr | xor_expr "^" and_expr\n or_expr ::= xor_expr | or_expr "|" xor_expr\n\nThe "&" operator yields the bitwise AND of its arguments, which must\nbe integers.\n\nThe "^" operator yields the bitwise XOR (exclusive OR) of its\narguments, which must be integers.\n\nThe "|" operator yields the bitwise (inclusive) OR of its arguments,\nwhich must be integers.\n',
+ 'bltin-code-objects': u'\nCode Objects\n************\n\nCode objects are used by the implementation to represent "pseudo-\ncompiled" executable Python code such as a function body. They differ\nfrom function objects because they don\'t contain a reference to their\nglobal execution environment. Code objects are returned by the built-\nin "compile()" function and can be extracted from function objects\nthrough their "__code__" attribute. See also the "code" module.\n\nA code object can be executed or evaluated by passing it (instead of a\nsource string) to the "exec()" or "eval()" built-in functions.\n\nSee *The standard type hierarchy* for more information.\n',
+ 'bltin-ellipsis-object': u'\nThe Ellipsis Object\n*******************\n\nThis object is commonly used by slicing (see *Slicings*). It supports\nno special operations. There is exactly one ellipsis object, named\n"Ellipsis" (a built-in name). "type(Ellipsis)()" produces the\n"Ellipsis" singleton.\n\nIt is written as "Ellipsis" or "...".\n',
+ 'bltin-null-object': u'\nThe Null Object\n***************\n\nThis object is returned by functions that don\'t explicitly return a\nvalue. It supports no special operations. There is exactly one null\nobject, named "None" (a built-in name). "type(None)()" produces the\nsame singleton.\n\nIt is written as "None".\n',
+ 'bltin-type-objects': u'\nType Objects\n************\n\nType objects represent the various object types. An object\'s type is\naccessed by the built-in function "type()". There are no special\noperations on types. The standard module "types" defines names for\nall standard built-in types.\n\nTypes are written like this: "<class \'int\'>".\n',
+ 'booleans': u'\nBoolean operations\n******************\n\n or_test ::= and_test | or_test "or" and_test\n and_test ::= not_test | and_test "and" not_test\n not_test ::= comparison | "not" not_test\n\nIn the context of Boolean operations, and also when expressions are\nused by control flow statements, the following values are interpreted\nas false: "False", "None", numeric zero of all types, and empty\nstrings and containers (including strings, tuples, lists,\ndictionaries, sets and frozensets). All other values are interpreted\nas true. User-defined objects can customize their truth value by\nproviding a "__bool__()" method.\n\nThe operator "not" yields "True" if its argument is false, "False"\notherwise.\n\nThe expression "x and y" first evaluates *x*; if *x* is false, its\nvalue is returned; otherwise, *y* is evaluated and the resulting value\nis returned.\n\nThe expression "x or y" first evaluates *x*; if *x* is true, its value\nis returned; otherwise, *y* is evaluated and the resulting value is\nreturned.\n\n(Note that neither "and" nor "or" restrict the value and type they\nreturn to "False" and "True", but rather return the last evaluated\nargument. This is sometimes useful, e.g., if "s" is a string that\nshould be replaced by a default value if it is empty, the expression\n"s or \'foo\'" yields the desired value. Because "not" has to create a\nnew value, it returns a boolean value regardless of the type of its\nargument (for example, "not \'foo\'" produces "False" rather than "\'\'".)\n',
+ 'break': u'\nThe "break" statement\n*********************\n\n break_stmt ::= "break"\n\n"break" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition within that\nloop.\n\nIt terminates the nearest enclosing loop, skipping the optional "else"\nclause if the loop has one.\n\nIf a "for" loop is terminated by "break", the loop control target\nkeeps its current value.\n\nWhen "break" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nloop.\n',
+ 'callable-types': u'\nEmulating callable objects\n**************************\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n',
+ 'calls': u'\nCalls\n*****\n\nA call calls a callable object (e.g., a *function*) with a possibly\nempty series of *arguments*:\n\n call ::= primary "(" [argument_list [","] | comprehension] ")"\n argument_list ::= positional_arguments ["," keyword_arguments]\n ["," "*" expression] ["," keyword_arguments]\n ["," "**" expression]\n | keyword_arguments ["," "*" expression]\n ["," keyword_arguments] ["," "**" expression]\n | "*" expression ["," keyword_arguments] ["," "**" expression]\n | "**" expression\n positional_arguments ::= expression ("," expression)*\n keyword_arguments ::= keyword_item ("," keyword_item)*\n keyword_item ::= identifier "=" expression\n\nAn optional trailing comma may be present after the positional and\nkeyword arguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and all objects having a\n"__call__()" method are callable). All argument expressions are\nevaluated before the call is attempted. Please refer to section\n*Function definitions* for the syntax of formal *parameter* lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a "TypeError" exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is "None", it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a "TypeError"\nexception is raised. Otherwise, the list of filled slots is used as\nthe argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use "PyArg_ParseTuple()" to parse\ntheir arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "*identifier" is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "**identifier" is present; in this case, that formal\nparameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax "*expression" appears in the function call, "expression"\nmust evaluate to an iterable. Elements from this iterable are treated\nas if they were additional positional arguments; if there are\npositional arguments *x1*, ..., *xN*, and "expression" evaluates to a\nsequence *y1*, ..., *yM*, this is equivalent to a call with M+N\npositional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n\nA consequence of this is that although the "*expression" syntax may\nappear *after* some keyword arguments, it is processed *before* the\nkeyword arguments (and the "**expression" argument, if any -- see\nbelow). So:\n\n >>> def f(a, b):\n ... print(a, b)\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "<stdin>", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the "*expression" syntax\nto be used in the same call, so in practice this confusion does not\narise.\n\nIf the syntax "**expression" appears in the function call,\n"expression" must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments. In the case of a keyword\nappearing in both "expression" and as an explicit keyword argument, a\n"TypeError" exception is raised.\n\nFormal parameters using the syntax "*identifier" or "**identifier"\ncannot be used as positional argument slots or as keyword argument\nnames.\n\nA call always returns some value, possibly "None", unless it raises an\nexception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n *Function definitions*. When the code block executes a "return"\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see *Built-in Functions* for\n the descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a "__call__()" method; the effect is then the\n same as if that method was called.\n',
+ 'class': u'\nClass definitions\n*****************\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [parameter_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class "object"; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with "self.name = value". Both class and\ninstance attributes are accessible through the notation ""self.name"",\nand an instance attribute hides a class attribute with the same name\nwhen accessed in this way. Class attributes can be used as defaults\nfor instance attributes, but using mutable values there can lead to\nunexpected results. *Descriptors* can be used to create instance\nvariables with different implementation details.\n\nSee also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** -\n Class Decorators\n',
+ 'comparisons': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects need not have the same type. If both are\nnumbers, they are converted to a common type. Otherwise, the "==" and\n"!=" operators *always* consider objects of different types to be\nunequal, while the "<", ">", ">=" and "<=" operators raise a\n"TypeError" when comparing objects of different types that do not\nimplement these operators for the given pair of types. You can\ncontrol comparison behavior of objects of non-built-in types by\ndefining rich comparison methods like "__gt__()", described in section\n*Basic customization*.\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* The values "float(\'NaN\')" and "Decimal(\'NaN\')" are special. They\n are identical to themselves, "x is x" but are not equal to\n themselves, "x != x". Additionally, comparing any value to a\n not-a-number value will return "False". For example, both "3 <\n float(\'NaN\')" and "float(\'NaN\') < 3" will return "False".\n\n* Bytes objects are compared lexicographically using the numeric\n values of their elements.\n\n* Strings are compared lexicographically using the numeric\n equivalents (the result of the built-in function "ord()") of their\n characters. [3] String and bytes object can\'t be compared!\n\n* Tuples and lists are compared lexicographically using comparison\n of corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, "[1,2,x] <= [1,2,y]" has the same\n value as "x <= y". If the corresponding element does not exist, the\n shorter sequence is ordered first (for example, "[1,2] < [1,2,3]").\n\n* Mappings (dictionaries) compare equal if and only if they have the\n same "(key, value)" pairs. Order comparisons "(\'<\', \'<=\', \'>=\',\n \'>\')" raise "TypeError".\n\n* Sets and frozensets define comparison operators to mean subset and\n superset tests. Those relations do not define total orderings (the\n two sets "{1,2}" and {2,3} are not equal, nor subsets of one\n another, nor supersets of one another). Accordingly, sets are not\n appropriate arguments for functions which depend on total ordering.\n For example, "min()", "max()", and "sorted()" produce undefined\n results given a list of sets as inputs.\n\n* Most other objects of built-in types compare unequal unless they\n are the same object; the choice whether one object is considered\n smaller or larger than another one is made arbitrarily but\n consistently within one execution of a program.\n\nComparison of objects of differing types depends on whether either of\nthe types provide explicit support for the comparison. Most numeric\ntypes can be compared with one another. When cross-type comparison is\nnot supported, the comparison method returns "NotImplemented".\n\nThe operators "in" and "not in" test for membership. "x in s"\nevaluates to true if *x* is a member of *s*, and false otherwise. "x\nnot in s" returns the negation of "x in s". All built-in sequences\nand set types support this as well as dictionary, for which "in" tests\nwhether the dictionary has a given key. For container types such as\nlist, tuple, set, frozenset, dict, or collections.deque, the\nexpression "x in y" is equivalent to "any(x is e or x == e for e in\ny)".\n\nFor the string and bytes types, "x in y" is true if and only if *x* is\na substring of *y*. An equivalent test is "y.find(x) != -1". Empty\nstrings are always considered to be a substring of any other string,\nso """ in "abc"" will return "True".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. "x is not y"\nyields the inverse truth value. [4]\n',
+ 'compound': u'\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe "if", "while" and "for" statements implement traditional control\nflow constructs. "try" specifies exception handlers and/or cleanup\ncode for a group of statements, while the "with" statement allows the\nexecution of initialization and finalization code around a block of\ncode. Function and class definitions are also syntactically compound\nstatements.\n\nA compound statement consists of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of a suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which "if" clause a following "else" clause would belong:\n\n if test1: if test2: print(x)\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n"print()" calls are executed:\n\n if x < y < z: print(x); print(y); print(z)\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n | async_with_stmt\n | async_for_stmt\n | async_funcdef\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a "NEWLINE" possibly followed by a\n"DEDENT". Also note that optional continuation clauses always begin\nwith a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling "else"\' problem is solved in Python by\nrequiring nested "if" statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe "if" statement\n==================\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n\n\nThe "while" statement\n=====================\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n\n\nThe "for" statement\n===================\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order returned by the iterator. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a "StopIteration" exception),\nthe suite in the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there is no next\nitem.\n\nThe for-loop makes assignments to the variables(s) in the target list.\nThis overwrites all previous assignments to those variables including\nthose made in the suite of the for-loop:\n\n for i in range(10):\n print(i)\n i = 5 # this will not affect the for-loop\n # because i will be overwritten with the next\n # index in the range\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, they will not have been assigned to at\nall by the loop. Hint: the built-in function "range()" returns an\niterator of integers suitable to emulate the effect of Pascal\'s "for i\n:= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe "try" statement\n===================\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the "as" keyword in that except clause, if\npresent, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using "as target", it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n del N\n\nThis means the exception must be assigned to a different name to be\nable to refer to it after the except clause. Exceptions are cleared\nbecause with the traceback attached to them, they form a reference\ncycle with the stack frame, keeping all locals in that frame alive\nuntil the next garbage collection occurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the "sys" module and can be accessed via\n"sys.exc_info()". "sys.exc_info()" returns a 3-tuple consisting of the\nexception class, the exception instance and a traceback object (see\nsection *The standard type hierarchy*) identifying the point in the\nprogram where the exception occurred. "sys.exc_info()" values are\nrestored to their previous values (before the call) when returning\nfrom a function that handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception it is re-raised at the end of the "finally"\nclause. If the "finally" clause raises another exception, the saved\nexception is set as the context of the new exception. If the "finally"\nclause executes a "return" or "break" statement, the saved exception\nis discarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the "raise" statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe "with" statement\n====================\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [parameter_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n | "*" [parameter] ("," defparameter)* ["," "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the ""*"" must also have a default value --- this\nis a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated from left to right when the\nfunction definition is executed.** This means that the expression is\nevaluated once, when the function is defined, and that the same "pre-\ncomputed" value is used for each call. This is especially important\nto understand when a default parameter is a mutable object, such as a\nlist or a dictionary: if the function modifies the object (e.g. by\nappending an item to a list), the default value is in effect modified.\nThis is generally not what was intended. A way around this is to use\n"None" as the default, and explicitly test for it in the body of the\nfunction, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n""*identifier"" is present, it is initialized to a tuple receiving any\nexcess positional parameters, defaulting to the empty tuple. If the\nform ""**identifier"" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after ""*"" or ""*identifier"" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "": expression"" following\nthe parameter name. Any parameter may have an annotation even those\nof the form "*identifier" or "**identifier". Functions may have\n"return" annotation of the form ""-> expression"" after the parameter\nlist. These annotations can be any valid Python expression and are\nevaluated when the function definition is executed. Annotations may\nbe evaluated in a different order than they appear in the source code.\nThe presence of annotations does not change the semantics of a\nfunction. The annotation values are available as values of a\ndictionary keyed by the parameters\' names in the "__annotations__"\nattribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section *Lambdas*. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nstatement executed inside a function definition defines a local\nfunction that can be returned or passed around. Free variables used\nin the nested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\nSee also: **PEP 3107** - Function Annotations\n\n The original specification for function annotations.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [parameter_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class "object"; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with "self.name = value". Both class and\ninstance attributes are accessible through the notation ""self.name"",\nand an instance attribute hides a class attribute with the same name\nwhen accessed in this way. Class attributes can be used as defaults\nfor instance attributes, but using mutable values there can lead to\nunexpected results. *Descriptors* can be used to create instance\nvariables with different implementation details.\n\nSee also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** -\n Class Decorators\n\n\nCoroutines\n==========\n\n\nCoroutine function definition\n-----------------------------\n\n async_funcdef ::= "async" funcdef\n\nExecution of Python coroutines can be suspended and resumed at many\npoints (see *coroutine*.) "await" expressions, "async for" and "async\nwith" can only be used in their bodies.\n\nFunctions defined with "async def" syntax are always coroutine\nfunctions, even if they do not contain "await" or "async" keywords.\n\nIt is a "SyntaxError" to use "yield" expressions in coroutines.\n\nNew in version 3.5.\n\n\nThe "async for" statement\n-------------------------\n\n async_for_stmt ::= "async" for_stmt\n\nAn *asynchronous iterable* is able to call asynchronous code in its\n*iter* implementation, and *asynchronous iterator* can call\nasynchronous code in its *next* method.\n\nThe "async for" statement allows convenient iteration over\nasynchronous iterators.\n\nThe following code:\n\n async for TARGET in ITER:\n BLOCK\n else:\n BLOCK2\n\nIs semantically equivalent to:\n\n iter = (ITER)\n iter = await type(iter).__aiter__(iter)\n running = True\n while running:\n try:\n TARGET = await type(iter).__anext__(iter)\n except StopAsyncIteration:\n running = False\n else:\n BLOCK\n else:\n BLOCK2\n\nSee also "__aiter__()" and "__anext__()" for details.\n\nNew in version 3.5.\n\n\nThe "async with" statement\n--------------------------\n\n async_with_stmt ::= "async" with_stmt\n\nAn *asynchronous context manager* is a *context manager* that is able\nto suspend execution in its *enter* and *exit* methods.\n\nThe following code:\n\n async with EXPR as VAR:\n BLOCK\n\nIs semantically equivalent to:\n\n mgr = (EXPR)\n aexit = type(mgr).__aexit__\n aenter = type(mgr).__aenter__(mgr)\n exc = True\n\n VAR = await aenter\n try:\n BLOCK\n except:\n if not await aexit(mgr, *sys.exc_info()):\n raise\n else:\n await aexit(mgr, None, None, None)\n\nSee also "__aenter__()" and "__aexit__()" for details.\n\nNew in version 3.5.\n\nSee also: **PEP 492** - Coroutines with async and await syntax\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\n there is a "finally" clause which happens to raise another\n exception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\n an exception or the execution of a "return", "continue", or\n "break" statement.\n\n[3] A string literal appearing as the first statement in the\n function body is transformed into the function\'s "__doc__"\n attribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s "__doc__" item and\n therefore the class\'s *docstring*.\n',
+ 'context-managers': u'\nWith Statement Context Managers\n*******************************\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section *The with\nstatement*), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n',
+ 'continue': u'\nThe "continue" statement\n************************\n\n continue_stmt ::= "continue"\n\n"continue" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition or "finally"\nclause within that loop. It continues with the next cycle of the\nnearest enclosing loop.\n\nWhen "continue" passes control out of a "try" statement with a\n"finally" clause, that "finally" clause is executed before really\nstarting the next loop cycle.\n',
+ 'conversions': u'\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," this means\nthat the operator implementation for built-in types works as follows:\n\n* If either argument is a complex number, the other is converted to\n complex;\n\n* otherwise, if either argument is a floating point number, the\n other is converted to floating point;\n\n* otherwise, both must be integers and no conversion is necessary.\n\nSome additional rules apply for certain operators (e.g., a string as a\nleft argument to the \'%\' operator). Extensions must define their own\nconversion behavior.\n',
+ 'customization': u'\nBasic customization\n*******************\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customise\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_info()[2]" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the second can be resolved by freeing the reference to the\n traceback object when it is no longer useful, and the third can\n be resolved by storing "None" in "sys.last_traceback". Circular\n references which are garbage are detected and cleaned up when the\n cyclic garbage collector is enabled (it\'s on by default). Refer\n to the documentation for the "gc" module for more information\n about this topic.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function to compute the "official"\n string representation of an object. If at all possible, this\n should look like a valid Python expression that could be used to\n recreate an object with the same value (given an appropriate\n environment). If this is not possible, a string of the form\n "<...some useful description...>" should be returned. The return\n value must be a string object. If a class defines "__repr__()" but\n not "__str__()", then "__repr__()" is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by "str(object)" and the built-in functions "format()" and\n "print()" to compute the "informal" or nicely printable string\n representation of an object. The return value must be a *string*\n object.\n\n This method differs from "object.__repr__()" in that there is no\n expectation that "__str__()" return a valid Python expression: a\n more convenient or concise representation can be used.\n\n The default implementation defined by the built-in type "object"\n calls "object.__repr__()".\n\nobject.__bytes__(self)\n\n Called by "bytes()" to compute a byte-string representation of an\n object. This should return a "bytes" object.\n\nobject.__format__(self, format_spec)\n\n Called by the "format()" built-in function (and by extension, the\n "str.format()" method of class "str") to produce a "formatted"\n string representation of an object. The "format_spec" argument is a\n string that contains a description of the formatting options\n desired. The interpretation of the "format_spec" argument is up to\n the type implementing "__format__()", however most classes will\n either delegate formatting to one of the built-in types, or use a\n similar formatting option syntax.\n\n See *Format Specification Mini-Language* for a description of the\n standard formatting syntax.\n\n The return value must be a string object.\n\n Changed in version 3.4: The __format__ method of "object" itself\n raises a "TypeError" if passed any non-empty string.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n These are the so-called "rich comparison" methods. The\n correspondence between operator symbols and method names is as\n follows: "x<y" calls "x.__lt__(y)", "x<=y" calls "x.__le__(y)",\n "x==y" calls "x.__eq__(y)", "x!=y" calls "x.__ne__(y)", "x>y" calls\n "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n There are no implied relationships among the comparison operators.\n The truth of "x==y" does not imply that "x!=y" is false.\n Accordingly, when defining "__eq__()", one should also define\n "__ne__()" so that the operators will behave as expected. See the\n paragraph on "__hash__()" for some important notes on creating\n *hashable* objects which support custom comparison operations and\n are usable as dictionary keys.\n\n There are no swapped-argument versions of these methods (to be used\n when the left argument does not support the operation but the right\n argument does); rather, "__lt__()" and "__gt__()" are each other\'s\n reflection, "__le__()" and "__ge__()" are each other\'s reflection,\n and "__eq__()" and "__ne__()" are their own reflection.\n\n Arguments to rich comparison methods are never coerced.\n\n To automatically generate ordering operations from a single root\n operation, see "functools.total_ordering()".\n\nobject.__hash__(self)\n\n Called by built-in function "hash()" and for operations on members\n of hashed collections including "set", "frozenset", and "dict".\n "__hash__()" should return an integer. The only required property\n is that objects which compare equal have the same hash value; it is\n advised to somehow mix together (e.g. using exclusive or) the hash\n values for the components of the object that also play a part in\n comparison of objects.\n\n Note: "hash()" truncates the value returned from an object\'s\n custom "__hash__()" method to the size of a "Py_ssize_t". This\n is typically 8 bytes on 64-bit builds and 4 bytes on 32-bit\n builds. If an object\'s "__hash__()" must interoperate on builds\n of different bit sizes, be sure to check the width on all\n supported builds. An easy way to do this is with "python -c\n "import sys; print(sys.hash_info.width)""\n\n If a class does not define an "__eq__()" method it should not\n define a "__hash__()" operation either; if it defines "__eq__()"\n but not "__hash__()", its instances will not be usable as items in\n hashable collections. If a class defines mutable objects and\n implements an "__eq__()" method, it should not implement\n "__hash__()", since the implementation of hashable collections\n requires that a key\'s hash value is immutable (if the object\'s hash\n value changes, it will be in the wrong hash bucket).\n\n User-defined classes have "__eq__()" and "__hash__()" methods by\n default; with them, all objects compare unequal (except with\n themselves) and "x.__hash__()" returns an appropriate value such\n that "x == y" implies both that "x is y" and "hash(x) == hash(y)".\n\n A class that overrides "__eq__()" and does not define "__hash__()"\n will have its "__hash__()" implicitly set to "None". When the\n "__hash__()" method of a class is "None", instances of the class\n will raise an appropriate "TypeError" when a program attempts to\n retrieve their hash value, and will also be correctly identified as\n unhashable when checking "isinstance(obj, collections.Hashable").\n\n If a class that overrides "__eq__()" needs to retain the\n implementation of "__hash__()" from a parent class, the interpreter\n must be told this explicitly by setting "__hash__ =\n <ParentClass>.__hash__".\n\n If a class that does not override "__eq__()" wishes to suppress\n hash support, it should include "__hash__ = None" in the class\n definition. A class which defines its own "__hash__()" that\n explicitly raises a "TypeError" would be incorrectly identified as\n hashable by an "isinstance(obj, collections.Hashable)" call.\n\n Note: By default, the "__hash__()" values of str, bytes and\n datetime objects are "salted" with an unpredictable random value.\n Although they remain constant within an individual Python\n process, they are not predictable between repeated invocations of\n Python.This is intended to provide protection against a denial-\n of-service caused by carefully-chosen inputs that exploit the\n worst case performance of a dict insertion, O(n^2) complexity.\n See http://www.ocert.org/advisories/ocert-2011-003.html for\n details.Changing hash values affects the iteration order of\n dicts, sets and other mappings. Python has never made guarantees\n about this ordering (and it typically varies between 32-bit and\n 64-bit builds).See also "PYTHONHASHSEED".\n\n Changed in version 3.3: Hash randomization is enabled by default.\n\nobject.__bool__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True". When this method is not\n defined, "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__bool__()", all its instances are\n considered true.\n',
+ 'debugger': u'\n"pdb" --- The Python Debugger\n*****************************\n\n**Source code:** Lib/pdb.py\n\n======================================================================\n\nThe module "pdb" defines an interactive source code debugger for\nPython programs. It supports setting (conditional) breakpoints and\nsingle stepping at the source line level, inspection of stack frames,\nsource code listing, and evaluation of arbitrary Python code in the\ncontext of any stack frame. It also supports post-mortem debugging\nand can be called under program control.\n\nThe debugger is extensible -- it is actually defined as the class\n"Pdb". This is currently undocumented but easily understood by reading\nthe source. The extension interface uses the modules "bdb" and "cmd".\n\nThe debugger\'s prompt is "(Pdb)". Typical usage to run a program under\ncontrol of the debugger is:\n\n >>> import pdb\n >>> import mymodule\n >>> pdb.run(\'mymodule.test()\')\n > <string>(0)?()\n (Pdb) continue\n > <string>(1)?()\n (Pdb) continue\n NameError: \'spam\'\n > <string>(1)?()\n (Pdb)\n\nChanged in version 3.3: Tab-completion via the "readline" module is\navailable for commands and command arguments, e.g. the current global\nand local names are offered as arguments of the "p" command.\n\n"pdb.py" can also be invoked as a script to debug other scripts. For\nexample:\n\n python3 -m pdb myscript.py\n\nWhen invoked as a script, pdb will automatically enter post-mortem\ndebugging if the program being debugged exits abnormally. After post-\nmortem debugging (or after normal exit of the program), pdb will\nrestart the program. Automatic restarting preserves pdb\'s state (such\nas breakpoints) and in most cases is more useful than quitting the\ndebugger upon program\'s exit.\n\nNew in version 3.2: "pdb.py" now accepts a "-c" option that executes\ncommands as if given in a ".pdbrc" file, see *Debugger Commands*.\n\nThe typical usage to break into the debugger from a running program is\nto insert\n\n import pdb; pdb.set_trace()\n\nat the location you want to break into the debugger. You can then\nstep through the code following this statement, and continue running\nwithout the debugger using the "continue" command.\n\nThe typical usage to inspect a crashed program is:\n\n >>> import pdb\n >>> import mymodule\n >>> mymodule.test()\n Traceback (most recent call last):\n File "<stdin>", line 1, in ?\n File "./mymodule.py", line 4, in test\n test2()\n File "./mymodule.py", line 3, in test2\n print(spam)\n NameError: spam\n >>> pdb.pm()\n > ./mymodule.py(3)test2()\n -> print(spam)\n (Pdb)\n\nThe module defines the following functions; each enters the debugger\nin a slightly different way:\n\npdb.run(statement, globals=None, locals=None)\n\n Execute the *statement* (given as a string or a code object) under\n debugger control. The debugger prompt appears before any code is\n executed; you can set breakpoints and type "continue", or you can\n step through the statement using "step" or "next" (all these\n commands are explained below). The optional *globals* and *locals*\n arguments specify the environment in which the code is executed; by\n default the dictionary of the module "__main__" is used. (See the\n explanation of the built-in "exec()" or "eval()" functions.)\n\npdb.runeval(expression, globals=None, locals=None)\n\n Evaluate the *expression* (given as a string or a code object)\n under debugger control. When "runeval()" returns, it returns the\n value of the expression. Otherwise this function is similar to\n "run()".\n\npdb.runcall(function, *args, **kwds)\n\n Call the *function* (a function or method object, not a string)\n with the given arguments. When "runcall()" returns, it returns\n whatever the function call returned. The debugger prompt appears\n as soon as the function is entered.\n\npdb.set_trace()\n\n Enter the debugger at the calling stack frame. This is useful to\n hard-code a breakpoint at a given point in a program, even if the\n code is not otherwise being debugged (e.g. when an assertion\n fails).\n\npdb.post_mortem(traceback=None)\n\n Enter post-mortem debugging of the given *traceback* object. If no\n *traceback* is given, it uses the one of the exception that is\n currently being handled (an exception must be being handled if the\n default is to be used).\n\npdb.pm()\n\n Enter post-mortem debugging of the traceback found in\n "sys.last_traceback".\n\nThe "run*" functions and "set_trace()" are aliases for instantiating\nthe "Pdb" class and calling the method of the same name. If you want\nto access further features, you have to do this yourself:\n\nclass class pdb.Pdb(completekey=\'tab\', stdin=None, stdout=None, skip=None, nosigint=False)\n\n "Pdb" is the debugger class.\n\n The *completekey*, *stdin* and *stdout* arguments are passed to the\n underlying "cmd.Cmd" class; see the description there.\n\n The *skip* argument, if given, must be an iterable of glob-style\n module name patterns. The debugger will not step into frames that\n originate in a module that matches one of these patterns. [1]\n\n By default, Pdb sets a handler for the SIGINT signal (which is sent\n when the user presses Ctrl-C on the console) when you give a\n "continue" command. This allows you to break into the debugger\n again by pressing Ctrl-C. If you want Pdb not to touch the SIGINT\n handler, set *nosigint* tot true.\n\n Example call to enable tracing with *skip*:\n\n import pdb; pdb.Pdb(skip=[\'django.*\']).set_trace()\n\n New in version 3.1: The *skip* argument.\n\n New in version 3.2: The *nosigint* argument. Previously, a SIGINT\n handler was never set by Pdb.\n\n run(statement, globals=None, locals=None)\n runeval(expression, globals=None, locals=None)\n runcall(function, *args, **kwds)\n set_trace()\n\n See the documentation for the functions explained above.\n\n\nDebugger Commands\n=================\n\nThe commands recognized by the debugger are listed below. Most\ncommands can be abbreviated to one or two letters as indicated; e.g.\n"h(elp)" means that either "h" or "help" can be used to enter the help\ncommand (but not "he" or "hel", nor "H" or "Help" or "HELP").\nArguments to commands must be separated by whitespace (spaces or\ntabs). Optional arguments are enclosed in square brackets ("[]") in\nthe command syntax; the square brackets must not be typed.\nAlternatives in the command syntax are separated by a vertical bar\n("|").\n\nEntering a blank line repeats the last command entered. Exception: if\nthe last command was a "list" command, the next 11 lines are listed.\n\nCommands that the debugger doesn\'t recognize are assumed to be Python\nstatements and are executed in the context of the program being\ndebugged. Python statements can also be prefixed with an exclamation\npoint ("!"). This is a powerful way to inspect the program being\ndebugged; it is even possible to change a variable or call a function.\nWhen an exception occurs in such a statement, the exception name is\nprinted but the debugger\'s state is not changed.\n\nThe debugger supports *aliases*. Aliases can have parameters which\nallows one a certain level of adaptability to the context under\nexamination.\n\nMultiple commands may be entered on a single line, separated by ";;".\n(A single ";" is not used as it is the separator for multiple commands\nin a line that is passed to the Python parser.) No intelligence is\napplied to separating the commands; the input is split at the first\n";;" pair, even if it is in the middle of a quoted string.\n\nIf a file ".pdbrc" exists in the user\'s home directory or in the\ncurrent directory, it is read in and executed as if it had been typed\nat the debugger prompt. This is particularly useful for aliases. If\nboth files exist, the one in the home directory is read first and\naliases defined there can be overridden by the local file.\n\nChanged in version 3.2: ".pdbrc" can now contain commands that\ncontinue debugging, such as "continue" or "next". Previously, these\ncommands had no effect.\n\nh(elp) [command]\n\n Without argument, print the list of available commands. With a\n *command* as argument, print help about that command. "help pdb"\n displays the full documentation (the docstring of the "pdb"\n module). Since the *command* argument must be an identifier, "help\n exec" must be entered to get help on the "!" command.\n\nw(here)\n\n Print a stack trace, with the most recent frame at the bottom. An\n arrow indicates the current frame, which determines the context of\n most commands.\n\nd(own) [count]\n\n Move the current frame *count* (default one) levels down in the\n stack trace (to a newer frame).\n\nu(p) [count]\n\n Move the current frame *count* (default one) levels up in the stack\n trace (to an older frame).\n\nb(reak) [([filename:]lineno | function) [, condition]]\n\n With a *lineno* argument, set a break there in the current file.\n With a *function* argument, set a break at the first executable\n statement within that function. The line number may be prefixed\n with a filename and a colon, to specify a breakpoint in another\n file (probably one that hasn\'t been loaded yet). The file is\n searched on "sys.path". Note that each breakpoint is assigned a\n number to which all the other breakpoint commands refer.\n\n If a second argument is present, it is an expression which must\n evaluate to true before the breakpoint is honored.\n\n Without argument, list all breaks, including for each breakpoint,\n the number of times that breakpoint has been hit, the current\n ignore count, and the associated condition if any.\n\ntbreak [([filename:]lineno | function) [, condition]]\n\n Temporary breakpoint, which is removed automatically when it is\n first hit. The arguments are the same as for "break".\n\ncl(ear) [filename:lineno | bpnumber [bpnumber ...]]\n\n With a *filename:lineno* argument, clear all the breakpoints at\n this line. With a space separated list of breakpoint numbers, clear\n those breakpoints. Without argument, clear all breaks (but first\n ask confirmation).\n\ndisable [bpnumber [bpnumber ...]]\n\n Disable the breakpoints given as a space separated list of\n breakpoint numbers. Disabling a breakpoint means it cannot cause\n the program to stop execution, but unlike clearing a breakpoint, it\n remains in the list of breakpoints and can be (re-)enabled.\n\nenable [bpnumber [bpnumber ...]]\n\n Enable the breakpoints specified.\n\nignore bpnumber [count]\n\n Set the ignore count for the given breakpoint number. If count is\n omitted, the ignore count is set to 0. A breakpoint becomes active\n when the ignore count is zero. When non-zero, the count is\n decremented each time the breakpoint is reached and the breakpoint\n is not disabled and any associated condition evaluates to true.\n\ncondition bpnumber [condition]\n\n Set a new *condition* for the breakpoint, an expression which must\n evaluate to true before the breakpoint is honored. If *condition*\n is absent, any existing condition is removed; i.e., the breakpoint\n is made unconditional.\n\ncommands [bpnumber]\n\n Specify a list of commands for breakpoint number *bpnumber*. The\n commands themselves appear on the following lines. Type a line\n containing just "end" to terminate the commands. An example:\n\n (Pdb) commands 1\n (com) p some_variable\n (com) end\n (Pdb)\n\n To remove all commands from a breakpoint, type commands and follow\n it immediately with "end"; that is, give no commands.\n\n With no *bpnumber* argument, commands refers to the last breakpoint\n set.\n\n You can use breakpoint commands to start your program up again.\n Simply use the continue command, or step, or any other command that\n resumes execution.\n\n Specifying any command resuming execution (currently continue,\n step, next, return, jump, quit and their abbreviations) terminates\n the command list (as if that command was immediately followed by\n end). This is because any time you resume execution (even with a\n simple next or step), you may encounter another breakpoint--which\n could have its own command list, leading to ambiguities about which\n list to execute.\n\n If you use the \'silent\' command in the command list, the usual\n message about stopping at a breakpoint is not printed. This may be\n desirable for breakpoints that are to print a specific message and\n then continue. If none of the other commands print anything, you\n see no sign that the breakpoint was reached.\n\ns(tep)\n\n Execute the current line, stop at the first possible occasion\n (either in a function that is called or on the next line in the\n current function).\n\nn(ext)\n\n Continue execution until the next line in the current function is\n reached or it returns. (The difference between "next" and "step"\n is that "step" stops inside a called function, while "next"\n executes called functions at (nearly) full speed, only stopping at\n the next line in the current function.)\n\nunt(il) [lineno]\n\n Without argument, continue execution until the line with a number\n greater than the current one is reached.\n\n With a line number, continue execution until a line with a number\n greater or equal to that is reached. In both cases, also stop when\n the current frame returns.\n\n Changed in version 3.2: Allow giving an explicit line number.\n\nr(eturn)\n\n Continue execution until the current function returns.\n\nc(ont(inue))\n\n Continue execution, only stop when a breakpoint is encountered.\n\nj(ump) lineno\n\n Set the next line that will be executed. Only available in the\n bottom-most frame. This lets you jump back and execute code again,\n or jump forward to skip code that you don\'t want to run.\n\n It should be noted that not all jumps are allowed -- for instance\n it is not possible to jump into the middle of a "for" loop or out\n of a "finally" clause.\n\nl(ist) [first[, last]]\n\n List source code for the current file. Without arguments, list 11\n lines around the current line or continue the previous listing.\n With "." as argument, list 11 lines around the current line. With\n one argument, list 11 lines around at that line. With two\n arguments, list the given range; if the second argument is less\n than the first, it is interpreted as a count.\n\n The current line in the current frame is indicated by "->". If an\n exception is being debugged, the line where the exception was\n originally raised or propagated is indicated by ">>", if it differs\n from the current line.\n\n New in version 3.2: The ">>" marker.\n\nll | longlist\n\n List all source code for the current function or frame.\n Interesting lines are marked as for "list".\n\n New in version 3.2.\n\na(rgs)\n\n Print the argument list of the current function.\n\np expression\n\n Evaluate the *expression* in the current context and print its\n value.\n\n Note: "print()" can also be used, but is not a debugger command\n --- this executes the Python "print()" function.\n\npp expression\n\n Like the "p" command, except the value of the expression is pretty-\n printed using the "pprint" module.\n\nwhatis expression\n\n Print the type of the *expression*.\n\nsource expression\n\n Try to get source code for the given object and display it.\n\n New in version 3.2.\n\ndisplay [expression]\n\n Display the value of the expression if it changed, each time\n execution stops in the current frame.\n\n Without expression, list all display expressions for the current\n frame.\n\n New in version 3.2.\n\nundisplay [expression]\n\n Do not display the expression any more in the current frame.\n Without expression, clear all display expressions for the current\n frame.\n\n New in version 3.2.\n\ninteract\n\n Start an interative interpreter (using the "code" module) whose\n global namespace contains all the (global and local) names found in\n the current scope.\n\n New in version 3.2.\n\nalias [name [command]]\n\n Create an alias called *name* that executes *command*. The command\n must *not* be enclosed in quotes. Replaceable parameters can be\n indicated by "%1", "%2", and so on, while "%*" is replaced by all\n the parameters. If no command is given, the current alias for\n *name* is shown. If no arguments are given, all aliases are listed.\n\n Aliases may be nested and can contain anything that can be legally\n typed at the pdb prompt. Note that internal pdb commands *can* be\n overridden by aliases. Such a command is then hidden until the\n alias is removed. Aliasing is recursively applied to the first\n word of the command line; all other words in the line are left\n alone.\n\n As an example, here are two useful aliases (especially when placed\n in the ".pdbrc" file):\n\n # Print instance variables (usage "pi classInst")\n alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])\n # Print instance variables in self\n alias ps pi self\n\nunalias name\n\n Delete the specified alias.\n\n! statement\n\n Execute the (one-line) *statement* in the context of the current\n stack frame. The exclamation point can be omitted unless the first\n word of the statement resembles a debugger command. To set a\n global variable, you can prefix the assignment command with a\n "global" statement on the same line, e.g.:\n\n (Pdb) global list_options; list_options = [\'-l\']\n (Pdb)\n\nrun [args ...]\nrestart [args ...]\n\n Restart the debugged Python program. If an argument is supplied,\n it is split with "shlex" and the result is used as the new\n "sys.argv". History, breakpoints, actions and debugger options are\n preserved. "restart" is an alias for "run".\n\nq(uit)\n\n Quit from the debugger. The program being executed is aborted.\n\n-[ Footnotes ]-\n\n[1] Whether a frame is considered to originate in a certain module\n is determined by the "__name__" in the frame globals.\n',
+ 'del': u'\nThe "del" statement\n*******************\n\n del_stmt ::= "del" target_list\n\nDeletion is recursively defined very similar to the way assignment is\ndefined. Rather than spelling it out in full details, here are some\nhints.\n\nDeletion of a target list recursively deletes each target, from left\nto right.\n\nDeletion of a name removes the binding of that name from the local or\nglobal namespace, depending on whether the name occurs in a "global"\nstatement in the same code block. If the name is unbound, a\n"NameError" exception will be raised.\n\nDeletion of attribute references, subscriptions and slicings is passed\nto the primary object involved; deletion of a slicing is in general\nequivalent to assignment of an empty slice of the right type (but even\nthis is determined by the sliced object).\n\nChanged in version 3.2: Previously it was illegal to delete a name\nfrom the local namespace if it occurs as a free variable in a nested\nblock.\n',
+ 'dict': u'\nDictionary displays\n*******************\n\nA dictionary display is a possibly empty series of key/datum pairs\nenclosed in curly braces:\n\n dict_display ::= "{" [key_datum_list | dict_comprehension] "}"\n key_datum_list ::= key_datum ("," key_datum)* [","]\n key_datum ::= expression ":" expression\n dict_comprehension ::= expression ":" expression comp_for\n\nA dictionary display yields a new dictionary object.\n\nIf a comma-separated sequence of key/datum pairs is given, they are\nevaluated from left to right to define the entries of the dictionary:\neach key object is used as a key into the dictionary to store the\ncorresponding datum. This means that you can specify the same key\nmultiple times in the key/datum list, and the final dictionary\'s value\nfor that key will be the last one given.\n\nA dict comprehension, in contrast to list and set comprehensions,\nneeds two expressions separated with a colon followed by the usual\n"for" and "if" clauses. When the comprehension is run, the resulting\nkey and value elements are inserted in the new dictionary in the order\nthey are produced.\n\nRestrictions on the types of the key values are listed earlier in\nsection *The standard type hierarchy*. (To summarize, the key type\nshould be *hashable*, which excludes all mutable objects.) Clashes\nbetween duplicate keys are not detected; the last datum (textually\nrightmost in the display) stored for a given key value prevails.\n',
+ 'dynamic-features': u'\nInteraction with dynamic features\n*********************************\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nThe "eval()" and "exec()" functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe "exec()" and "eval()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n',
+ 'else': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n',
+ 'exceptions': u'\nExceptions\n**********\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nNote: Exception messages are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section *The try\nstatement* and "raise" statement in section *The raise statement*.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n',
+ 'execmodel': u'\nExecution model\n***************\n\n\nNaming and binding\n==================\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\nas a command line argument to the interpreter) is a code block. A\nscript command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block. The string argument passed\nto the built-in functions "eval()" and "exec()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes comprehensions and generator\nexpressions since they are implemented using a function scope. This\nmeans that the following will fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block,\nunless declared as "nonlocal". If a name is bound at the module\nlevel, it is a global variable. (The variables of the module code\nblock are local and global.) If a variable is used in a code block\nbut not defined there, it is a *free variable*.\n\nWhen a name is not found at all, a "NameError" exception is raised.\nIf the name refers to a local variable that has not been bound, an\n"UnboundLocalError" exception is raised. "UnboundLocalError" is a\nsubclass of "NameError".\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, or after\n"as" in a "with" statement or "except" clause. The "import" statement\nof the form "from ... import *" binds all names defined in the\nimported module, except those beginning with an underscore. This form\nmay only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name).\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the "global" statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "builtins". The global namespace is searched first. If\nthe name is not found there, the builtins namespace is searched. The\n"global" statement must precede all uses of the name.\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "builtins"; when in any\nother module, "__builtins__" is an alias for the dictionary of the\n"builtins" module itself. "__builtins__" can be set to a user-created\ndictionary to create a weak form of restricted execution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "builtins" module and modify its attributes appropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n---------------------------------\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nThe "eval()" and "exec()" functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe "exec()" and "eval()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n\n\nExceptions\n==========\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nNote: Exception messages are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section *The try\nstatement* and "raise" statement in section *The raise statement*.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n',
+ 'exprlists': u'\nExpression lists\n****************\n\n expression_list ::= expression ( "," expression )* [","]\n\nAn expression list containing at least one comma yields a tuple. The\nlength of the tuple is the number of expressions in the list. The\nexpressions are evaluated from left to right.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases. A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: "()".)\n',
+ 'floating': u'\nFloating point literals\n***********************\n\nFloating point literals are described by the following lexical\ndefinitions:\n\n floatnumber ::= pointfloat | exponentfloat\n pointfloat ::= [intpart] fraction | intpart "."\n exponentfloat ::= (intpart | pointfloat) exponent\n intpart ::= digit+\n fraction ::= "." digit+\n exponent ::= ("e" | "E") ["+" | "-"] digit+\n\nNote that the integer and exponent parts are always interpreted using\nradix 10. For example, "077e010" is legal, and denotes the same number\nas "77e10". The allowed range of floating point literals is\nimplementation-dependent. Some examples of floating point literals:\n\n 3.14 10. .001 1e100 3.14e-10 0e0\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator "-" and the\nliteral "1".\n',
+ 'for': u'\nThe "for" statement\n*******************\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order returned by the iterator. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a "StopIteration" exception),\nthe suite in the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there is no next\nitem.\n\nThe for-loop makes assignments to the variables(s) in the target list.\nThis overwrites all previous assignments to those variables including\nthose made in the suite of the for-loop:\n\n for i in range(10):\n print(i)\n i = 5 # this will not affect the for-loop\n # because i will be overwritten with the next\n # index in the range\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, they will not have been assigned to at\nall by the loop. Hint: the built-in function "range()" returns an\niterator of integers suitable to emulate the effect of Pascal\'s "for i\n:= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n',
+ 'formatstrings': u'\nFormat String Syntax\n********************\n\nThe "str.format()" method and the "Formatter" class share the same\nsyntax for format strings (although in the case of "Formatter",\nsubclasses can define their own format string syntax).\n\nFormat strings contain "replacement fields" surrounded by curly braces\n"{}". Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output. If you need to include\na brace character in the literal text, it can be escaped by doubling:\n"{{" and "}}".\n\nThe grammar for a replacement field is as follows:\n\n replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"\n field_name ::= arg_name ("." attribute_name | "[" element_index "]")*\n arg_name ::= [identifier | integer]\n attribute_name ::= identifier\n element_index ::= integer | index_string\n index_string ::= <any source character except "]"> +\n conversion ::= "r" | "s" | "a"\n format_spec ::= <described in the next section>\n\nIn less formal terms, the replacement field can start with a\n*field_name* that specifies the object whose value is to be formatted\nand inserted into the output instead of the replacement field. The\n*field_name* is optionally followed by a *conversion* field, which is\npreceded by an exclamation point "\'!\'", and a *format_spec*, which is\npreceded by a colon "\':\'". These specify a non-default format for the\nreplacement value.\n\nSee also the *Format Specification Mini-Language* section.\n\nThe *field_name* itself begins with an *arg_name* that is either a\nnumber or a keyword. If it\'s a number, it refers to a positional\nargument, and if it\'s a keyword, it refers to a named keyword\nargument. If the numerical arg_names in a format string are 0, 1, 2,\n... in sequence, they can all be omitted (not just some) and the\nnumbers 0, 1, 2, ... will be automatically inserted in that order.\nBecause *arg_name* is not quote-delimited, it is not possible to\nspecify arbitrary dictionary keys (e.g., the strings "\'10\'" or\n"\':-]\'") within a format string. The *arg_name* can be followed by any\nnumber of index or attribute expressions. An expression of the form\n"\'.name\'" selects the named attribute using "getattr()", while an\nexpression of the form "\'[index]\'" does an index lookup using\n"__getitem__()".\n\nChanged in version 3.1: The positional argument specifiers can be\nomitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n\nSome simple format string examples:\n\n "First, thou shalt count to {0}" # References first positional argument\n "Bring me a {}" # Implicitly references the first positional argument\n "From {} to {}" # Same as "From {0} to {1}"\n "My quest is {name}" # References keyword argument \'name\'\n "Weight in tons {0.weight}" # \'weight\' attribute of first positional arg\n "Units destroyed: {players[0]}" # First element of keyword argument \'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the "__format__()"\nmethod of the value itself. However, in some cases it is desirable to\nforce a type to be formatted as a string, overriding its own\ndefinition of formatting. By converting the value to a string before\ncalling "__format__()", the normal formatting logic is bypassed.\n\nThree conversion flags are currently supported: "\'!s\'" which calls\n"str()" on the value, "\'!r\'" which calls "repr()" and "\'!a\'" which\ncalls "ascii()".\n\nSome examples:\n\n "Harold\'s a clever {0!s}" # Calls str() on the argument first\n "Bring out the holy {name!r}" # Calls repr() on the argument first\n "More {!a}" # Calls ascii() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on. Each value type can define its\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields can contain only a field\nname; conversion flags and format specifications are not allowed. The\nreplacement fields within the format_spec are substituted before the\n*format_spec* string is interpreted. This allows the formatting of a\nvalue to be dynamically specified.\n\nSee the *Format examples* section for some examples.\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see *Format String Syntax*). They can also be passed directly to the\nbuilt-in "format()" function. Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string ("""") produces\nthe same result as if you had called "str()" on the value. A non-empty\nformat string typically modifies the result.\n\nThe general form of a *standard format specifier* is:\n\n format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]\n fill ::= <any character>\n align ::= "<" | ">" | "=" | "^"\n sign ::= "+" | "-" | " "\n width ::= integer\n precision ::= integer\n type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n\nIf a valid *align* value is specified, it can be preceded by a *fill*\ncharacter that can be any character and defaults to a space if\nomitted. Note that it is not possible to use "{" and "}" as *fill*\nchar while using the "str.format()" method; this limitation however\ndoesn\'t affect the "format()" function.\n\nThe meaning of the various alignment options is as follows:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'<\'" | Forces the field to be left-aligned within the available |\n | | space (this is the default for most objects). |\n +-----------+------------------------------------------------------------+\n | "\'>\'" | Forces the field to be right-aligned within the available |\n | | space (this is the default for numbers). |\n +-----------+------------------------------------------------------------+\n | "\'=\'" | Forces the padding to be placed after the sign (if any) |\n | | but before the digits. This is used for printing fields |\n | | in the form \'+000000120\'. This alignment option is only |\n | | valid for numeric types. |\n +-----------+------------------------------------------------------------+\n | "\'^\'" | Forces the field to be centered within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'+\'" | indicates that a sign should be used for both positive as |\n | | well as negative numbers. |\n +-----------+------------------------------------------------------------+\n | "\'-\'" | indicates that a sign should be used only for negative |\n | | numbers (this is the default behavior). |\n +-----------+------------------------------------------------------------+\n | space | indicates that a leading space should be used on positive |\n | | numbers, and a minus sign on negative numbers. |\n +-----------+------------------------------------------------------------+\n\nThe "\'#\'" option causes the "alternate form" to be used for the\nconversion. The alternate form is defined differently for different\ntypes. This option is only valid for integer, float, complex and\nDecimal types. For integers, when binary, octal, or hexadecimal output\nis used, this option adds the prefix respective "\'0b\'", "\'0o\'", or\n"\'0x\'" to the output value. For floats, complex and Decimal the\nalternate form causes the result of the conversion to always contain a\ndecimal-point character, even if no digits follow it. Normally, a\ndecimal-point character appears in the result of these conversions\nonly if a digit follows it. In addition, for "\'g\'" and "\'G\'"\nconversions, trailing zeros are not removed from the result.\n\nThe "\',\'" option signals the use of a comma for a thousands separator.\nFor a locale aware separator, use the "\'n\'" integer presentation type\ninstead.\n\nChanged in version 3.1: Added the "\',\'" option (see also **PEP 378**).\n\n*width* is a decimal integer defining the minimum field width. If not\nspecified, then the field width will be determined by the content.\n\nPreceding the *width* field by a zero ("\'0\'") character enables sign-\naware zero-padding for numeric types. This is equivalent to a *fill*\ncharacter of "\'0\'" with an *alignment* type of "\'=\'".\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value\nformatted with "\'f\'" and "\'F\'", or before and after the decimal point\nfor a floating point value formatted with "\'g\'" or "\'G\'". For non-\nnumber types the field indicates the maximum field size - in other\nwords, how many characters will be used from the field content. The\n*precision* is not allowed for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available string presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'s\'" | String format. This is the default type for strings and |\n | | may be omitted. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'s\'". |\n +-----------+------------------------------------------------------------+\n\nThe available integer presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'b\'" | Binary format. Outputs the number in base 2. |\n +-----------+------------------------------------------------------------+\n | "\'c\'" | Character. Converts the integer to the corresponding |\n | | unicode character before printing. |\n +-----------+------------------------------------------------------------+\n | "\'d\'" | Decimal Integer. Outputs the number in base 10. |\n +-----------+------------------------------------------------------------+\n | "\'o\'" | Octal format. Outputs the number in base 8. |\n +-----------+------------------------------------------------------------+\n | "\'x\'" | Hex format. Outputs the number in base 16, using lower- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'X\'" | Hex format. Outputs the number in base 16, using upper- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'d\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'d\'". |\n +-----------+------------------------------------------------------------+\n\nIn addition to the above presentation types, integers can be formatted\nwith the floating point presentation types listed below (except "\'n\'"\nand None). When doing so, "float()" is used to convert the integer to\na floating point number before formatting.\n\nThe available presentation types for floating point and decimal values\nare:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'e\'" | Exponent notation. Prints the number in scientific |\n | | notation using the letter \'e\' to indicate the exponent. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'E\'" | Exponent notation. Same as "\'e\'" except it uses an upper |\n | | case \'E\' as the separator character. |\n +-----------+------------------------------------------------------------+\n | "\'f\'" | Fixed point. Displays the number as a fixed-point number. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'F\'" | Fixed point. Same as "\'f\'", but converts "nan" to "NAN" |\n | | and "inf" to "INF". |\n +-----------+------------------------------------------------------------+\n | "\'g\'" | General format. For a given precision "p >= 1", this |\n | | rounds the number to "p" significant digits and then |\n | | formats the result in either fixed-point format or in |\n | | scientific notation, depending on its magnitude. The |\n | | precise rules are as follows: suppose that the result |\n | | formatted with presentation type "\'e\'" and precision "p-1" |\n | | would have exponent "exp". Then if "-4 <= exp < p", the |\n | | number is formatted with presentation type "\'f\'" and |\n | | precision "p-1-exp". Otherwise, the number is formatted |\n | | with presentation type "\'e\'" and precision "p-1". In both |\n | | cases insignificant trailing zeros are removed from the |\n | | significand, and the decimal point is also removed if |\n | | there are no remaining digits following it. Positive and |\n | | negative infinity, positive and negative zero, and nans, |\n | | are formatted as "inf", "-inf", "0", "-0" and "nan" |\n | | respectively, regardless of the precision. A precision of |\n | | "0" is treated as equivalent to a precision of "1". The |\n | | default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'G\'" | General format. Same as "\'g\'" except switches to "\'E\'" if |\n | | the number gets too large. The representations of infinity |\n | | and NaN are uppercased, too. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'g\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | "\'%\'" | Percentage. Multiplies the number by 100 and displays in |\n | | fixed ("\'f\'") format, followed by a percent sign. |\n +-----------+------------------------------------------------------------+\n | None | Similar to "\'g\'", except that fixed-point notation, when |\n | | used, has at least one digit past the decimal point. The |\n | | default precision is as high as needed to represent the |\n | | particular value. The overall effect is to match the |\n | | output of "str()" as altered by the other format |\n | | modifiers. |\n +-----------+------------------------------------------------------------+\n\n\nFormat examples\n===============\n\nThis section contains examples of the new format syntax and comparison\nwith the old "%"-formatting.\n\nIn most of the cases the syntax is similar to the old "%"-formatting,\nwith the addition of the "{}" and with ":" used instead of "%". For\nexample, "\'%03.2f\'" can be translated to "\'{:03.2f}\'".\n\nThe new format syntax also supports new and different options, shown\nin the follow examples.\n\nAccessing arguments by position:\n\n >>> \'{0}, {1}, {2}\'.format(\'a\', \'b\', \'c\')\n \'a, b, c\'\n >>> \'{}, {}, {}\'.format(\'a\', \'b\', \'c\') # 3.1+ only\n \'a, b, c\'\n >>> \'{2}, {1}, {0}\'.format(\'a\', \'b\', \'c\')\n \'c, b, a\'\n >>> \'{2}, {1}, {0}\'.format(*\'abc\') # unpacking argument sequence\n \'c, b, a\'\n >>> \'{0}{1}{0}\'.format(\'abra\', \'cad\') # arguments\' indices can be repeated\n \'abracadabra\'\n\nAccessing arguments by name:\n\n >>> \'Coordinates: {latitude}, {longitude}\'.format(latitude=\'37.24N\', longitude=\'-115.81W\')\n \'Coordinates: 37.24N, -115.81W\'\n >>> coord = {\'latitude\': \'37.24N\', \'longitude\': \'-115.81W\'}\n >>> \'Coordinates: {latitude}, {longitude}\'.format(**coord)\n \'Coordinates: 37.24N, -115.81W\'\n\nAccessing arguments\' attributes:\n\n >>> c = 3-5j\n >>> (\'The complex number {0} is formed from the real part {0.real} \'\n ... \'and the imaginary part {0.imag}.\').format(c)\n \'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.\'\n >>> class Point:\n ... def __init__(self, x, y):\n ... self.x, self.y = x, y\n ... def __str__(self):\n ... return \'Point({self.x}, {self.y})\'.format(self=self)\n ...\n >>> str(Point(4, 2))\n \'Point(4, 2)\'\n\nAccessing arguments\' items:\n\n >>> coord = (3, 5)\n >>> \'X: {0[0]}; Y: {0[1]}\'.format(coord)\n \'X: 3; Y: 5\'\n\nReplacing "%s" and "%r":\n\n >>> "repr() shows quotes: {!r}; str() doesn\'t: {!s}".format(\'test1\', \'test2\')\n "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n\nAligning the text and specifying a width:\n\n >>> \'{:<30}\'.format(\'left aligned\')\n \'left aligned \'\n >>> \'{:>30}\'.format(\'right aligned\')\n \' right aligned\'\n >>> \'{:^30}\'.format(\'centered\')\n \' centered \'\n >>> \'{:*^30}\'.format(\'centered\') # use \'*\' as a fill char\n \'***********centered***********\'\n\nReplacing "%+f", "%-f", and "% f" and specifying a sign:\n\n >>> \'{:+f}; {:+f}\'.format(3.14, -3.14) # show it always\n \'+3.140000; -3.140000\'\n >>> \'{: f}; {: f}\'.format(3.14, -3.14) # show a space for positive numbers\n \' 3.140000; -3.140000\'\n >>> \'{:-f}; {:-f}\'.format(3.14, -3.14) # show only the minus -- same as \'{:f}; {:f}\'\n \'3.140000; -3.140000\'\n\nReplacing "%x" and "%o" and converting the value to different bases:\n\n >>> # format also supports binary numbers\n >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}".format(42)\n \'int: 42; hex: 2a; oct: 52; bin: 101010\'\n >>> # with 0x, 0o, or 0b as prefix:\n >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42)\n \'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010\'\n\nUsing the comma as a thousands separator:\n\n >>> \'{:,}\'.format(1234567890)\n \'1,234,567,890\'\n\nExpressing a percentage:\n\n >>> points = 19\n >>> total = 22\n >>> \'Correct answers: {:.2%}\'.format(points/total)\n \'Correct answers: 86.36%\'\n\nUsing type-specific formatting:\n\n >>> import datetime\n >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n >>> \'{:%Y-%m-%d %H:%M:%S}\'.format(d)\n \'2010-07-04 12:15:58\'\n\nNesting arguments and more complex examples:\n\n >>> for align, text in zip(\'<^>\', [\'left\', \'center\', \'right\']):\n ... \'{0:{fill}{align}16}\'.format(text, fill=align, align=align)\n ...\n \'left<<<<<<<<<<<<\'\n \'^^^^^center^^^^^\'\n \'>>>>>>>>>>>right\'\n >>>\n >>> octets = [192, 168, 0, 1]\n >>> \'{:02X}{:02X}{:02X}{:02X}\'.format(*octets)\n \'C0A80001\'\n >>> int(_, 16)\n 3232235521\n >>>\n >>> width = 5\n >>> for num in range(5,12): #doctest: +NORMALIZE_WHITESPACE\n ... for base in \'dXob\':\n ... print(\'{0:{width}{base}}\'.format(num, base=base, width=width), end=\' \')\n ... print()\n ...\n 5 5 5 101\n 6 6 6 110\n 7 7 7 111\n 8 8 10 1000\n 9 9 11 1001\n 10 A 12 1010\n 11 B 13 1011\n',
+ 'function': u'\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [parameter_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n | "*" [parameter] ("," defparameter)* ["," "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the ""*"" must also have a default value --- this\nis a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated from left to right when the\nfunction definition is executed.** This means that the expression is\nevaluated once, when the function is defined, and that the same "pre-\ncomputed" value is used for each call. This is especially important\nto understand when a default parameter is a mutable object, such as a\nlist or a dictionary: if the function modifies the object (e.g. by\nappending an item to a list), the default value is in effect modified.\nThis is generally not what was intended. A way around this is to use\n"None" as the default, and explicitly test for it in the body of the\nfunction, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n""*identifier"" is present, it is initialized to a tuple receiving any\nexcess positional parameters, defaulting to the empty tuple. If the\nform ""**identifier"" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after ""*"" or ""*identifier"" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "": expression"" following\nthe parameter name. Any parameter may have an annotation even those\nof the form "*identifier" or "**identifier". Functions may have\n"return" annotation of the form ""-> expression"" after the parameter\nlist. These annotations can be any valid Python expression and are\nevaluated when the function definition is executed. Annotations may\nbe evaluated in a different order than they appear in the source code.\nThe presence of annotations does not change the semantics of a\nfunction. The annotation values are available as values of a\ndictionary keyed by the parameters\' names in the "__annotations__"\nattribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section *Lambdas*. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nstatement executed inside a function definition defines a local\nfunction that can be returned or passed around. Free variables used\nin the nested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\nSee also: **PEP 3107** - Function Annotations\n\n The original specification for function annotations.\n',
+ 'global': u'\nThe "global" statement\n**********************\n\n global_stmt ::= "global" identifier ("," identifier)*\n\nThe "global" statement is a declaration which holds for the entire\ncurrent code block. It means that the listed identifiers are to be\ninterpreted as globals. It would be impossible to assign to a global\nvariable without "global", although free variables may refer to\nglobals without being declared global.\n\nNames listed in a "global" statement must not be used in the same code\nblock textually preceding that "global" statement.\n\nNames listed in a "global" statement must not be defined as formal\nparameters or in a "for" loop control target, "class" definition,\nfunction definition, or "import" statement.\n\n**CPython implementation detail:** The current implementation does not\nenforce the two restrictions, but programs should not abuse this\nfreedom, as future implementations may enforce them or silently change\nthe meaning of the program.\n\n**Programmer\'s note:** the "global" is a directive to the parser. It\napplies only to code parsed at the same time as the "global"\nstatement. In particular, a "global" statement contained in a string\nor code object supplied to the built-in "exec()" function does not\naffect the code block *containing* the function call, and code\ncontained in such a string is unaffected by "global" statements in the\ncode containing the function call. The same applies to the "eval()"\nand "compile()" functions.\n',
+ 'id-classes': u'\nReserved classes of identifiers\n*******************************\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "builtins" module. When not\n in interactive mode, "_" has no special meaning and is not defined.\n See section *The import statement*.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the *Special method names* section\n and elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section *Identifiers (Names)*.\n',
+ 'identifiers': u'\nIdentifiers and keywords\n************************\n\nIdentifiers (also referred to as *names*) are described by the\nfollowing lexical definitions.\n\nThe syntax of identifiers in Python is based on the Unicode standard\nannex UAX-31, with elaboration and changes as defined below; see also\n**PEP 3131** for further details.\n\nWithin the ASCII range (U+0001..U+007F), the valid characters for\nidentifiers are the same as in Python 2.x: the uppercase and lowercase\nletters "A" through "Z", the underscore "_" and, except for the first\ncharacter, the digits "0" through "9".\n\nPython 3.0 introduces additional characters from outside the ASCII\nrange (see **PEP 3131**). For these characters, the classification\nuses the version of the Unicode Character Database as included in the\n"unicodedata" module.\n\nIdentifiers are unlimited in length. Case is significant.\n\n identifier ::= xid_start xid_continue*\n id_start ::= <all characters in general categories Lu, Ll, Lt, Lm, Lo, Nl, the underscore, and characters with the Other_ID_Start property>\n id_continue ::= <all characters in id_start, plus characters in the categories Mn, Mc, Nd, Pc and others with the Other_ID_Continue property>\n xid_start ::= <all characters in id_start whose NFKC normalization is in "id_start xid_continue*">\n xid_continue ::= <all characters in id_continue whose NFKC normalization is in "id_continue*">\n\nThe Unicode category codes mentioned above stand for:\n\n* *Lu* - uppercase letters\n\n* *Ll* - lowercase letters\n\n* *Lt* - titlecase letters\n\n* *Lm* - modifier letters\n\n* *Lo* - other letters\n\n* *Nl* - letter numbers\n\n* *Mn* - nonspacing marks\n\n* *Mc* - spacing combining marks\n\n* *Nd* - decimal numbers\n\n* *Pc* - connector punctuations\n\n* *Other_ID_Start* - explicit list of characters in PropList.txt to\n support backwards compatibility\n\n* *Other_ID_Continue* - likewise\n\nAll identifiers are converted into the normal form NFKC while parsing;\ncomparison of identifiers is based on NFKC.\n\nA non-normative HTML file listing all valid identifier characters for\nUnicode 4.1 can be found at http://www.dcl.hpi.uni-\npotsdam.de/home/loewis/table-3131.html.\n\n\nKeywords\n========\n\nThe following identifiers are used as reserved words, or *keywords* of\nthe language, and cannot be used as ordinary identifiers. They must\nbe spelled exactly as written here:\n\n False class finally is return\n None continue for lambda try\n True def from nonlocal while\n and del global not with\n as elif if or yield\n assert else import pass\n break except in raise\n\n\nReserved classes of identifiers\n===============================\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "builtins" module. When not\n in interactive mode, "_" has no special meaning and is not defined.\n See section *The import statement*.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the *Special method names* section\n and elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section *Identifiers (Names)*.\n',
+ 'if': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n',
+ 'imaginary': u'\nImaginary literals\n******************\n\nImaginary literals are described by the following lexical definitions:\n\n imagnumber ::= (floatnumber | intpart) ("j" | "J")\n\nAn imaginary literal yields a complex number with a real part of 0.0.\nComplex numbers are represented as a pair of floating point numbers\nand have the same restrictions on their range. To create a complex\nnumber with a nonzero real part, add a floating point number to it,\ne.g., "(3+4j)". Some examples of imaginary literals:\n\n 3.14j 10.j 10j .001j 1e100j 3.14e-10j\n',
+ 'import': u'\nThe "import" statement\n**********************\n\n import_stmt ::= "import" module ["as" name] ( "," module ["as" name] )*\n | "from" relative_module "import" identifier ["as" name]\n ( "," identifier ["as" name] )*\n | "from" relative_module "import" "(" identifier ["as" name]\n ( "," identifier ["as" name] )* [","] ")"\n | "from" module "import" "*"\n module ::= (identifier ".")* identifier\n relative_module ::= "."* module | "."+\n name ::= identifier\n\nThe basic import statement (no "from" clause) is executed in two\nsteps:\n\n1. find a module, loading and initializing it if necessary\n\n2. define a name or names in the local namespace for the scope\n where the "import" statement occurs.\n\nWhen the statement contains multiple clauses (separated by commas) the\ntwo steps are carried out separately for each clause, just as though\nthe clauses had been separated out into individiual import statements.\n\nThe details of the first step, finding and loading modules are\ndescribed in greater detail in the section on the *import system*,\nwhich also describes the various types of packages and modules that\ncan be imported, as well as all the hooks that can be used to\ncustomize the import system. Note that failures in this step may\nindicate either that the module could not be located, *or* that an\nerror occurred while initializing the module, which includes execution\nof the module\'s code.\n\nIf the requested module is retrieved successfully, it will be made\navailable in the local namespace in one of three ways:\n\n* If the module name is followed by "as", then the name following\n "as" is bound directly to the imported module.\n\n* If no other name is specified, and the module being imported is a\n top level module, the module\'s name is bound in the local namespace\n as a reference to the imported module\n\n* If the module being imported is *not* a top level module, then the\n name of the top level package that contains the module is bound in\n the local namespace as a reference to the top level package. The\n imported module must be accessed using its full qualified name\n rather than directly\n\nThe "from" form uses a slightly more complex process:\n\n1. find the module specified in the "from" clause, loading and\n initializing it if necessary;\n\n2. for each of the identifiers specified in the "import" clauses:\n\n 1. check if the imported module has an attribute by that name\n\n 2. if not, attempt to import a submodule with that name and then\n check the imported module again for that attribute\n\n 3. if the attribute is not found, "ImportError" is raised.\n\n 4. otherwise, a reference to that value is stored in the local\n namespace, using the name in the "as" clause if it is present,\n otherwise using the attribute name\n\nExamples:\n\n import foo # foo imported and bound locally\n import foo.bar.baz # foo.bar.baz imported, foo bound locally\n import foo.bar.baz as fbb # foo.bar.baz imported and bound as fbb\n from foo.bar import baz # foo.bar.baz imported and bound as baz\n from foo import attr # foo imported and foo.attr bound as attr\n\nIf the list of identifiers is replaced by a star ("\'*\'"), all public\nnames defined in the module are bound in the local namespace for the\nscope where the "import" statement occurs.\n\nThe *public names* defined by a module are determined by checking the\nmodule\'s namespace for a variable named "__all__"; if defined, it must\nbe a sequence of strings which are names defined or imported by that\nmodule. The names given in "__all__" are all considered public and\nare required to exist. If "__all__" is not defined, the set of public\nnames includes all names found in the module\'s namespace which do not\nbegin with an underscore character ("\'_\'"). "__all__" should contain\nthe entire public API. It is intended to avoid accidentally exporting\nitems that are not part of the API (such as library modules which were\nimported and used within the module).\n\nThe wild card form of import --- "from module import *" --- is only\nallowed at the module level. Attempting to use it in class or\nfunction definitions will raise a "SyntaxError".\n\nWhen specifying what module to import you do not have to specify the\nabsolute name of the module. When a module or package is contained\nwithin another package it is possible to make a relative import within\nthe same top package without having to mention the package name. By\nusing leading dots in the specified module or package after "from" you\ncan specify how high to traverse up the current package hierarchy\nwithout specifying exact names. One leading dot means the current\npackage where the module making the import exists. Two dots means up\none package level. Three dots is up two levels, etc. So if you execute\n"from . import mod" from a module in the "pkg" package then you will\nend up importing "pkg.mod". If you execute "from ..subpkg2 import mod"\nfrom within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The\nspecification for relative imports is contained within **PEP 328**.\n\n"importlib.import_module()" is provided to support applications that\ndetermine dynamically the modules to be loaded.\n\n\nFuture statements\n=================\n\nA *future statement* is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python where the feature\nbecomes standard.\n\nThe future statement is intended to ease migration to future versions\nof Python that introduce incompatible changes to the language. It\nallows use of the new features on a per-module basis before the\nrelease in which the feature becomes standard.\n\n future_statement ::= "from" "__future__" "import" feature ["as" name]\n ("," feature ["as" name])*\n | "from" "__future__" "import" "(" feature ["as" name]\n ("," feature ["as" name])* [","] ")"\n feature ::= identifier\n name ::= identifier\n\nA future statement must appear near the top of the module. The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n\nThe features recognized by Python 3.0 are "absolute_import",\n"division", "generators", "unicode_literals", "print_function",\n"nested_scopes" and "with_statement". They are all redundant because\nthey are always enabled, and only kept for backwards compatibility.\n\nA future statement is recognized and treated specially at compile\ntime: Changes to the semantics of core constructs are often\nimplemented by generating different code. It may even be the case\nthat a new feature introduces new incompatible syntax (such as a new\nreserved word), in which case the compiler may need to parse the\nmodule differently. Such decisions cannot be pushed off until\nruntime.\n\nFor any given release, the compiler knows which feature names have\nbeen defined, and raises a compile-time error if a future statement\ncontains a feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module "__future__", described later, and it will\nbe imported in the usual way at the time the future statement is\nexecuted.\n\nThe interesting runtime semantics depend on the specific feature\nenabled by the future statement.\n\nNote that there is nothing special about the statement:\n\n import __future__ [as name]\n\nThat is not a future statement; it\'s an ordinary import statement with\nno special semantics or syntax restrictions.\n\nCode compiled by calls to the built-in functions "exec()" and\n"compile()" that occur in a module "M" containing a future statement\nwill, by default, use the new syntax or semantics associated with the\nfuture statement. This can be controlled by optional arguments to\n"compile()" --- see the documentation of that function for details.\n\nA future statement typed at an interactive interpreter prompt will\ntake effect for the rest of the interpreter session. If an\ninterpreter is started with the *-i* option, is passed a script name\nto execute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is\nexecuted.\n\nSee also: **PEP 236** - Back to the __future__\n\n The original proposal for the __future__ mechanism.\n',
+ 'in': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects need not have the same type. If both are\nnumbers, they are converted to a common type. Otherwise, the "==" and\n"!=" operators *always* consider objects of different types to be\nunequal, while the "<", ">", ">=" and "<=" operators raise a\n"TypeError" when comparing objects of different types that do not\nimplement these operators for the given pair of types. You can\ncontrol comparison behavior of objects of non-built-in types by\ndefining rich comparison methods like "__gt__()", described in section\n*Basic customization*.\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* The values "float(\'NaN\')" and "Decimal(\'NaN\')" are special. They\n are identical to themselves, "x is x" but are not equal to\n themselves, "x != x". Additionally, comparing any value to a\n not-a-number value will return "False". For example, both "3 <\n float(\'NaN\')" and "float(\'NaN\') < 3" will return "False".\n\n* Bytes objects are compared lexicographically using the numeric\n values of their elements.\n\n* Strings are compared lexicographically using the numeric\n equivalents (the result of the built-in function "ord()") of their\n characters. [3] String and bytes object can\'t be compared!\n\n* Tuples and lists are compared lexicographically using comparison\n of corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, "[1,2,x] <= [1,2,y]" has the same\n value as "x <= y". If the corresponding element does not exist, the\n shorter sequence is ordered first (for example, "[1,2] < [1,2,3]").\n\n* Mappings (dictionaries) compare equal if and only if they have the\n same "(key, value)" pairs. Order comparisons "(\'<\', \'<=\', \'>=\',\n \'>\')" raise "TypeError".\n\n* Sets and frozensets define comparison operators to mean subset and\n superset tests. Those relations do not define total orderings (the\n two sets "{1,2}" and {2,3} are not equal, nor subsets of one\n another, nor supersets of one another). Accordingly, sets are not\n appropriate arguments for functions which depend on total ordering.\n For example, "min()", "max()", and "sorted()" produce undefined\n results given a list of sets as inputs.\n\n* Most other objects of built-in types compare unequal unless they\n are the same object; the choice whether one object is considered\n smaller or larger than another one is made arbitrarily but\n consistently within one execution of a program.\n\nComparison of objects of differing types depends on whether either of\nthe types provide explicit support for the comparison. Most numeric\ntypes can be compared with one another. When cross-type comparison is\nnot supported, the comparison method returns "NotImplemented".\n\nThe operators "in" and "not in" test for membership. "x in s"\nevaluates to true if *x* is a member of *s*, and false otherwise. "x\nnot in s" returns the negation of "x in s". All built-in sequences\nand set types support this as well as dictionary, for which "in" tests\nwhether the dictionary has a given key. For container types such as\nlist, tuple, set, frozenset, dict, or collections.deque, the\nexpression "x in y" is equivalent to "any(x is e or x == e for e in\ny)".\n\nFor the string and bytes types, "x in y" is true if and only if *x* is\na substring of *y*. An equivalent test is "y.find(x) != -1". Empty\nstrings are always considered to be a substring of any other string,\nso """ in "abc"" will return "True".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. "x is not y"\nyields the inverse truth value. [4]\n',
+ 'integers': u'\nInteger literals\n****************\n\nInteger literals are described by the following lexical definitions:\n\n integer ::= decimalinteger | octinteger | hexinteger | bininteger\n decimalinteger ::= nonzerodigit digit* | "0"+\n nonzerodigit ::= "1"..."9"\n digit ::= "0"..."9"\n octinteger ::= "0" ("o" | "O") octdigit+\n hexinteger ::= "0" ("x" | "X") hexdigit+\n bininteger ::= "0" ("b" | "B") bindigit+\n octdigit ::= "0"..."7"\n hexdigit ::= digit | "a"..."f" | "A"..."F"\n bindigit ::= "0" | "1"\n\nThere is no limit for the length of integer literals apart from what\ncan be stored in available memory.\n\nNote that leading zeros in a non-zero decimal number are not allowed.\nThis is for disambiguation with C-style octal literals, which Python\nused before version 3.0.\n\nSome examples of integer literals:\n\n 7 2147483647 0o177 0b100110111\n 3 79228162514264337593543950336 0o377 0xdeadbeef\n',
+ 'lambda': u'\nLambdas\n*******\n\n lambda_expr ::= "lambda" [parameter_list]: expression\n lambda_expr_nocond ::= "lambda" [parameter_list]: expression_nocond\n\nLambda expressions (sometimes called lambda forms) are used to create\nanonymous functions. The expression "lambda arguments: expression"\nyields a function object. The unnamed object behaves like a function\nobject defined with\n\n def <lambda>(arguments):\n return expression\n\nSee section *Function definitions* for the syntax of parameter lists.\nNote that functions created with lambda expressions cannot contain\nstatements or annotations.\n',
+ 'lists': u'\nList displays\n*************\n\nA list display is a possibly empty series of expressions enclosed in\nsquare brackets:\n\n list_display ::= "[" [expression_list | comprehension] "]"\n\nA list display yields a new list object, the contents being specified\nby either a list of expressions or a comprehension. When a comma-\nseparated list of expressions is supplied, its elements are evaluated\nfrom left to right and placed into the list object in that order.\nWhen a comprehension is supplied, the list is constructed from the\nelements resulting from the comprehension.\n',
+ 'naming': u'\nNaming and binding\n******************\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\nas a command line argument to the interpreter) is a code block. A\nscript command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block. The string argument passed\nto the built-in functions "eval()" and "exec()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes comprehensions and generator\nexpressions since they are implemented using a function scope. This\nmeans that the following will fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block,\nunless declared as "nonlocal". If a name is bound at the module\nlevel, it is a global variable. (The variables of the module code\nblock are local and global.) If a variable is used in a code block\nbut not defined there, it is a *free variable*.\n\nWhen a name is not found at all, a "NameError" exception is raised.\nIf the name refers to a local variable that has not been bound, an\n"UnboundLocalError" exception is raised. "UnboundLocalError" is a\nsubclass of "NameError".\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, or after\n"as" in a "with" statement or "except" clause. The "import" statement\nof the form "from ... import *" binds all names defined in the\nimported module, except those beginning with an underscore. This form\nmay only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name).\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the "global" statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "builtins". The global namespace is searched first. If\nthe name is not found there, the builtins namespace is searched. The\n"global" statement must precede all uses of the name.\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "builtins"; when in any\nother module, "__builtins__" is an alias for the dictionary of the\n"builtins" module itself. "__builtins__" can be set to a user-created\ndictionary to create a weak form of restricted execution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "builtins" module and modify its attributes appropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n=================================\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nThe "eval()" and "exec()" functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe "exec()" and "eval()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n',
+ 'nonlocal': u'\nThe "nonlocal" statement\n************************\n\n nonlocal_stmt ::= "nonlocal" identifier ("," identifier)*\n\nThe "nonlocal" statement causes the listed identifiers to refer to\npreviously bound variables in the nearest enclosing scope excluding\nglobals. This is important because the default behavior for binding is\nto search the local namespace first. The statement allows\nencapsulated code to rebind variables outside of the local scope\nbesides the global (module) scope.\n\nNames listed in a "nonlocal" statement, unlike those listed in a\n"global" statement, must refer to pre-existing bindings in an\nenclosing scope (the scope in which a new binding should be created\ncannot be determined unambiguously).\n\nNames listed in a "nonlocal" statement must not collide with pre-\nexisting bindings in the local scope.\n\nSee also: **PEP 3104** - Access to Names in Outer Scopes\n\n The specification for the "nonlocal" statement.\n',
+ 'numbers': u'\nNumeric literals\n****************\n\nThere are three types of numeric literals: integers, floating point\nnumbers, and imaginary numbers. There are no complex literals\n(complex numbers can be formed by adding a real number and an\nimaginary number).\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator \'"-"\' and the\nliteral "1".\n',
+ 'numeric-types': u'\nEmulating numeric types\n***********************\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__matmul__(self, other)\nobject.__truediv__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|"). For instance, to\n evaluate the expression "x + y", where *x* is an instance of a\n class that has an "__add__()" method, "x.__add__(y)" is called.\n The "__divmod__()" method should be the equivalent to using\n "__floordiv__()" and "__mod__()"; it should not be related to\n "__truediv__()". Note that "__pow__()" should be defined to accept\n an optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rmatmul__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|") with reflected (swapped)\n operands. These functions are only called if the left operand does\n not support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__imatmul__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "@=", "/=", "//=", "%=", "**=",\n "<<=", ">>=", "&=", "^=", "|="). These methods should attempt to\n do the operation in-place (modifying *self*) and return the result\n (which could be, but does not have to be, *self*). If a specific\n method is not defined, the augmented assignment falls back to the\n normal methods. For instance, if *x* is an instance of a class\n with an "__iadd__()" method, "x += y" is equivalent to "x =\n x.__iadd__(y)" . Otherwise, "x.__add__(y)" and "y.__radd__(x)" are\n considered, as with the evaluation of "x + y". In certain\n situations, augmented assignment can result in unexpected errors\n (see *Why does a_tuple[i] += [\'item\'] raise an exception when the\n addition works?*), but this behavior is in fact part of the data\n model.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__float__(self)\nobject.__round__(self[, n])\n\n Called to implement the built-in functions "complex()", "int()",\n "float()" and "round()". Should return a value of the appropriate\n type.\n\nobject.__index__(self)\n\n Called to implement "operator.index()", and whenever Python needs\n to losslessly convert the numeric object to an integer object (such\n as in slicing, or in the built-in "bin()", "hex()" and "oct()"\n functions). Presence of this method indicates that the numeric\n object is an integer type. Must return an integer.\n\n Note: In order to have a coherent integer type class, when\n "__index__()" is defined "__int__()" should also be defined, and\n both should return the same value.\n',
+ 'objects': u'\nObjects, values and types\n*************************\n\n*Objects* are Python\'s abstraction for data. All data in a Python\nprogram is represented by objects or by relations between objects. (In\na sense, and in conformance to Von Neumann\'s model of a "stored\nprogram computer," code is also represented by objects.)\n\nEvery object has an identity, a type and a value. An object\'s\n*identity* never changes once it has been created; you may think of it\nas the object\'s address in memory. The \'"is"\' operator compares the\nidentity of two objects; the "id()" function returns an integer\nrepresenting its identity.\n\n**CPython implementation detail:** For CPython, "id(x)" is the memory\naddress where "x" is stored.\n\nAn object\'s type determines the operations that the object supports\n(e.g., "does it have a length?") and also defines the possible values\nfor objects of that type. The "type()" function returns an object\'s\ntype (which is an object itself). Like its identity, an object\'s\n*type* is also unchangeable. [1]\n\nThe *value* of some objects can change. Objects whose value can\nchange are said to be *mutable*; objects whose value is unchangeable\nonce they are created are called *immutable*. (The value of an\nimmutable container object that contains a reference to a mutable\nobject can change when the latter\'s value is changed; however the\ncontainer is still considered immutable, because the collection of\nobjects it contains cannot be changed. So, immutability is not\nstrictly the same as having an unchangeable value, it is more subtle.)\nAn object\'s mutability is determined by its type; for instance,\nnumbers, strings and tuples are immutable, while dictionaries and\nlists are mutable.\n\nObjects are never explicitly destroyed; however, when they become\nunreachable they may be garbage-collected. An implementation is\nallowed to postpone garbage collection or omit it altogether --- it is\na matter of implementation quality how garbage collection is\nimplemented, as long as no objects are collected that are still\nreachable.\n\n**CPython implementation detail:** CPython currently uses a reference-\ncounting scheme with (optional) delayed detection of cyclically linked\ngarbage, which collects most objects as soon as they become\nunreachable, but is not guaranteed to collect garbage containing\ncircular references. See the documentation of the "gc" module for\ninformation on controlling the collection of cyclic garbage. Other\nimplementations act differently and CPython may change. Do not depend\non immediate finalization of objects when they become unreachable (so\nyou should always close files explicitly).\n\nNote that the use of the implementation\'s tracing or debugging\nfacilities may keep objects alive that would normally be collectable.\nAlso note that catching an exception with a \'"try"..."except"\'\nstatement may keep objects alive.\n\nSome objects contain references to "external" resources such as open\nfiles or windows. It is understood that these resources are freed\nwhen the object is garbage-collected, but since garbage collection is\nnot guaranteed to happen, such objects also provide an explicit way to\nrelease the external resource, usually a "close()" method. Programs\nare strongly recommended to explicitly close such objects. The\n\'"try"..."finally"\' statement and the \'"with"\' statement provide\nconvenient ways to do this.\n\nSome objects contain references to other objects; these are called\n*containers*. Examples of containers are tuples, lists and\ndictionaries. The references are part of a container\'s value. In\nmost cases, when we talk about the value of a container, we imply the\nvalues, not the identities of the contained objects; however, when we\ntalk about the mutability of a container, only the identities of the\nimmediately contained objects are implied. So, if an immutable\ncontainer (like a tuple) contains a reference to a mutable object, its\nvalue changes if that mutable object is changed.\n\nTypes affect almost all aspects of object behavior. Even the\nimportance of object identity is affected in some sense: for immutable\ntypes, operations that compute new values may actually return a\nreference to any existing object with the same type and value, while\nfor mutable objects this is not allowed. E.g., after "a = 1; b = 1",\n"a" and "b" may or may not refer to the same object with the value\none, depending on the implementation, but after "c = []; d = []", "c"\nand "d" are guaranteed to refer to two different, unique, newly\ncreated empty lists. (Note that "c = d = []" assigns the same object\nto both "c" and "d".)\n',
+ 'operator-summary': u'\nOperator precedence\n*******************\n\nThe following table summarizes the operator precedence in Python, from\nlowest precedence (least binding) to highest precedence (most\nbinding). Operators in the same box have the same precedence. Unless\nthe syntax is explicitly given, operators are binary. Operators in\nthe same box group left to right (except for exponentiation, which\ngroups from right to left).\n\nNote that comparisons, membership tests, and identity tests, all have\nthe same precedence and have a left-to-right chaining feature as\ndescribed in the *Comparisons* section.\n\n+-------------------------------------------------+---------------------------------------+\n| Operator | Description |\n+=================================================+=======================================+\n| "lambda" | Lambda expression |\n+-------------------------------------------------+---------------------------------------+\n| "if" -- "else" | Conditional expression |\n+-------------------------------------------------+---------------------------------------+\n| "or" | Boolean OR |\n+-------------------------------------------------+---------------------------------------+\n| "and" | Boolean AND |\n+-------------------------------------------------+---------------------------------------+\n| "not" "x" | Boolean NOT |\n+-------------------------------------------------+---------------------------------------+\n| "in", "not in", "is", "is not", "<", "<=", ">", | Comparisons, including membership |\n| ">=", "!=", "==" | tests and identity tests |\n+-------------------------------------------------+---------------------------------------+\n| "|" | Bitwise OR |\n+-------------------------------------------------+---------------------------------------+\n| "^" | Bitwise XOR |\n+-------------------------------------------------+---------------------------------------+\n| "&" | Bitwise AND |\n+-------------------------------------------------+---------------------------------------+\n| "<<", ">>" | Shifts |\n+-------------------------------------------------+---------------------------------------+\n| "+", "-" | Addition and subtraction |\n+-------------------------------------------------+---------------------------------------+\n| "*", "@", "/", "//", "%" | Multiplication, matrix multiplication |\n| | division, remainder [5] |\n+-------------------------------------------------+---------------------------------------+\n| "+x", "-x", "~x" | Positive, negative, bitwise NOT |\n+-------------------------------------------------+---------------------------------------+\n| "**" | Exponentiation [6] |\n+-------------------------------------------------+---------------------------------------+\n| "await" "x" | Await expression |\n+-------------------------------------------------+---------------------------------------+\n| "x[index]", "x[index:index]", | Subscription, slicing, call, |\n| "x(arguments...)", "x.attribute" | attribute reference |\n+-------------------------------------------------+---------------------------------------+\n| "(expressions...)", "[expressions...]", "{key: | Binding or tuple display, list |\n| value...}", "{expressions...}" | display, dictionary display, set |\n| | display |\n+-------------------------------------------------+---------------------------------------+\n\n-[ Footnotes ]-\n\n[1] While "abs(x%y) < abs(y)" is true mathematically, for floats\n it may not be true numerically due to roundoff. For example, and\n assuming a platform on which a Python float is an IEEE 754 double-\n precision number, in order that "-1e-100 % 1e100" have the same\n sign as "1e100", the computed result is "-1e-100 + 1e100", which\n is numerically exactly equal to "1e100". The function\n "math.fmod()" returns a result whose sign matches the sign of the\n first argument instead, and so returns "-1e-100" in this case.\n Which approach is more appropriate depends on the application.\n\n[2] If x is very close to an exact integer multiple of y, it\'s\n possible for "x//y" to be one larger than "(x-x%y)//y" due to\n rounding. In such cases, Python returns the latter result, in\n order to preserve that "divmod(x,y)[0] * y + x % y" be very close\n to "x".\n\n[3] While comparisons between strings make sense at the byte\n level, they may be counter-intuitive to users. For example, the\n strings ""\\u00C7"" and ""\\u0327\\u0043"" compare differently, even\n though they both represent the same unicode character (LATIN\n CAPITAL LETTER C WITH CEDILLA). To compare strings in a human\n recognizable way, compare using "unicodedata.normalize()".\n\n[4] Due to automatic garbage-collection, free lists, and the\n dynamic nature of descriptors, you may notice seemingly unusual\n behaviour in certain uses of the "is" operator, like those\n involving comparisons between instance methods, or constants.\n Check their documentation for more info.\n\n[5] The "%" operator is also used for string formatting; the same\n precedence applies.\n\n[6] The power operator "**" binds less tightly than an arithmetic\n or bitwise unary operator on its right, that is, "2**-1" is "0.5".\n',
+ 'pass': u'\nThe "pass" statement\n********************\n\n pass_stmt ::= "pass"\n\n"pass" is a null operation --- when it is executed, nothing happens.\nIt is useful as a placeholder when a statement is required\nsyntactically, but no code needs to be executed, for example:\n\n def f(arg): pass # a function that does nothing (yet)\n\n class C: pass # a class with no methods (yet)\n',
+ 'power': u'\nThe power operator\n******************\n\nThe power operator binds more tightly than unary operators on its\nleft; it binds less tightly than unary operators on its right. The\nsyntax is:\n\n power ::= await ["**" u_expr]\n\nThus, in an unparenthesized sequence of power and unary operators, the\noperators are evaluated from right to left (this does not constrain\nthe evaluation order for the operands): "-1**2" results in "-1".\n\nThe power operator has the same semantics as the built-in "pow()"\nfunction, when called with two arguments: it yields its left argument\nraised to the power of its right argument. The numeric arguments are\nfirst converted to a common type, and the result is of that type.\n\nFor int operands, the result has the same type as the operands unless\nthe second argument is negative; in that case, all arguments are\nconverted to float and a float result is delivered. For example,\n"10**2" returns "100", but "10**-2" returns "0.01".\n\nRaising "0.0" to a negative power results in a "ZeroDivisionError".\nRaising a negative number to a fractional power results in a "complex"\nnumber. (In earlier versions it raised a "ValueError".)\n',
+ 'raise': u'\nThe "raise" statement\n*********************\n\n raise_stmt ::= "raise" [expression ["from" expression]]\n\nIf no expressions are present, "raise" re-raises the last exception\nthat was active in the current scope. If no exception is active in\nthe current scope, a "RuntimeError" exception is raised indicating\nthat this is an error.\n\nOtherwise, "raise" evaluates the first expression as the exception\nobject. It must be either a subclass or an instance of\n"BaseException". If it is a class, the exception instance will be\nobtained when needed by instantiating the class with no arguments.\n\nThe *type* of the exception is the exception instance\'s class, the\n*value* is the instance itself.\n\nA traceback object is normally created automatically when an exception\nis raised and attached to it as the "__traceback__" attribute, which\nis writable. You can create an exception and set your own traceback in\none step using the "with_traceback()" exception method (which returns\nthe same exception instance, with its traceback set to its argument),\nlike so:\n\n raise Exception("foo occurred").with_traceback(tracebackobj)\n\nThe "from" clause is used for exception chaining: if given, the second\n*expression* must be another exception class or instance, which will\nthen be attached to the raised exception as the "__cause__" attribute\n(which is writable). If the raised exception is not handled, both\nexceptions will be printed:\n\n >>> try:\n ... print(1 / 0)\n ... except Exception as exc:\n ... raise RuntimeError("Something bad happened") from exc\n ...\n Traceback (most recent call last):\n File "<stdin>", line 2, in <module>\n ZeroDivisionError: int division or modulo by zero\n\n The above exception was the direct cause of the following exception:\n\n Traceback (most recent call last):\n File "<stdin>", line 4, in <module>\n RuntimeError: Something bad happened\n\nA similar mechanism works implicitly if an exception is raised inside\nan exception handler or a "finally" clause: the previous exception is\nthen attached as the new exception\'s "__context__" attribute:\n\n >>> try:\n ... print(1 / 0)\n ... except:\n ... raise RuntimeError("Something bad happened")\n ...\n Traceback (most recent call last):\n File "<stdin>", line 2, in <module>\n ZeroDivisionError: int division or modulo by zero\n\n During handling of the above exception, another exception occurred:\n\n Traceback (most recent call last):\n File "<stdin>", line 4, in <module>\n RuntimeError: Something bad happened\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information about handling exceptions is in section\n*The try statement*.\n',
+ 'return': u'\nThe "return" statement\n**********************\n\n return_stmt ::= "return" [expression_list]\n\n"return" may only occur syntactically nested in a function definition,\nnot within a nested class definition.\n\nIf an expression list is present, it is evaluated, else "None" is\nsubstituted.\n\n"return" leaves the current function call with the expression list (or\n"None") as return value.\n\nWhen "return" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nfunction.\n\nIn a generator function, the "return" statement indicates that the\ngenerator is done and will cause "StopIteration" to be raised. The\nreturned value (if any) is used as an argument to construct\n"StopIteration" and becomes the "StopIteration.value" attribute.\n',
+ 'sequence-types': u'\nEmulating container types\n*************************\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "get()", "clear()",\n"setdefault()", "pop()", "popitem()", "copy()", and "update()"\nbehaving similar to those for Python\'s standard dictionary objects.\nThe "collections" module provides a "MutableMapping" abstract base\nclass to help create those methods from a base set of "__getitem__()",\n"__setitem__()", "__delitem__()", and "keys()". Mutable sequences\nshould provide methods "append()", "count()", "index()", "extend()",\n"insert()", "pop()", "remove()", "reverse()" and "sort()", like Python\nstandard list objects. Finally, sequence types should implement\naddition (meaning concatenation) and multiplication (meaning\nrepetition) by defining the methods "__add__()", "__radd__()",\n"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" described\nbelow; they should not define other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should search the mapping\'s keys; for sequences, it\nshould search through the values. It is further recommended that both\nmappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "keys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__bool__()" method and whose "__len__()" method\n returns zero is considered to be false in a Boolean context.\n\nobject.__length_hint__(self)\n\n Called to implement "operator.length_hint()". Should return an\n estimated length for the object (which may be greater or less than\n the actual length). The length must be an integer ">=" 0. This\n method is purely an optimization and is never required for\n correctness.\n\n New in version 3.4.\n\nNote: Slicing is done exclusively with the following three methods.\n A call like\n\n a[1:2] = b\n\n is translated to\n\n a[slice(1, 2, None)] = b\n\n and so forth. Missing slice items are always filled in with "None".\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see *this section in the\n language reference*.\n',
+ 'shifting': u'\nShifting operations\n*******************\n\nThe shifting operations have lower priority than the arithmetic\noperations:\n\n shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n\nThese operators accept integers as arguments. They shift the first\nargument to the left or right by the number of bits given by the\nsecond argument.\n\nA right shift by *n* bits is defined as floor division by "pow(2,n)".\nA left shift by *n* bits is defined as multiplication with "pow(2,n)".\n\nNote: In the current implementation, the right-hand operand is\n required to be at most "sys.maxsize". If the right-hand operand is\n larger than "sys.maxsize" an "OverflowError" exception is raised.\n',
+ 'slicings': u'\nSlicings\n********\n\nA slicing selects a range of items in a sequence object (e.g., a\nstring, tuple or list). Slicings may be used as expressions or as\ntargets in assignment or "del" statements. The syntax for a slicing:\n\n slicing ::= primary "[" slice_list "]"\n slice_list ::= slice_item ("," slice_item)* [","]\n slice_item ::= expression | proper_slice\n proper_slice ::= [lower_bound] ":" [upper_bound] [ ":" [stride] ]\n lower_bound ::= expression\n upper_bound ::= expression\n stride ::= expression\n\nThere is ambiguity in the formal syntax here: anything that looks like\nan expression list also looks like a slice list, so any subscription\ncan be interpreted as a slicing. Rather than further complicating the\nsyntax, this is disambiguated by defining that in this case the\ninterpretation as a subscription takes priority over the\ninterpretation as a slicing (this is the case if the slice list\ncontains no proper slice).\n\nThe semantics for a slicing are as follows. The primary is indexed\n(using the same "__getitem__()" method as normal subscription) with a\nkey that is constructed from the slice list, as follows. If the slice\nlist contains at least one comma, the key is a tuple containing the\nconversion of the slice items; otherwise, the conversion of the lone\nslice item is the key. The conversion of a slice item that is an\nexpression is that expression. The conversion of a proper slice is a\nslice object (see section *The standard type hierarchy*) whose\n"start", "stop" and "step" attributes are the values of the\nexpressions given as lower bound, upper bound and stride,\nrespectively, substituting "None" for missing expressions.\n',
+ 'specialattrs': u'\nSpecial Attributes\n******************\n\nThe implementation adds a few special read-only attributes to several\nobject types, where they are relevant. Some of these are not reported\nby the "dir()" built-in function.\n\nobject.__dict__\n\n A dictionary or other mapping object used to store an object\'s\n (writable) attributes.\n\ninstance.__class__\n\n The class to which a class instance belongs.\n\nclass.__bases__\n\n The tuple of base classes of a class object.\n\nclass.__name__\n\n The name of the class or type.\n\nclass.__qualname__\n\n The *qualified name* of the class or type.\n\n New in version 3.3.\n\nclass.__mro__\n\n This attribute is a tuple of classes that are considered when\n looking for base classes during method resolution.\n\nclass.mro()\n\n This method can be overridden by a metaclass to customize the\n method resolution order for its instances. It is called at class\n instantiation, and its result is stored in "__mro__".\n\nclass.__subclasses__()\n\n Each class keeps a list of weak references to its immediate\n subclasses. This method returns a list of all those references\n still alive. Example:\n\n >>> int.__subclasses__()\n [<class \'bool\'>]\n\n-[ Footnotes ]-\n\n[1] Additional information on these special methods may be found\n in the Python Reference Manual (*Basic customization*).\n\n[2] As a consequence, the list "[1, 2]" is considered equal to\n "[1.0, 2.0]", and similarly for tuples.\n\n[3] They must have since the parser can\'t tell the type of the\n operands.\n\n[4] Cased characters are those with general category property\n being one of "Lu" (Letter, uppercase), "Ll" (Letter, lowercase),\n or "Lt" (Letter, titlecase).\n\n[5] To format only a tuple you should therefore provide a\n singleton tuple whose only element is the tuple to be formatted.\n',
+ 'specialnames': u'\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named "__getitem__()", and "x" is an instance of this class,\nthen "x[i]" is roughly equivalent to "type(x).__getitem__(x, i)".\nExcept where mentioned, attempts to execute an operation raise an\nexception when no appropriate method is defined (typically\n"AttributeError" or "TypeError").\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n"NodeList" interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customise\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_info()[2]" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the second can be resolved by freeing the reference to the\n traceback object when it is no longer useful, and the third can\n be resolved by storing "None" in "sys.last_traceback". Circular\n references which are garbage are detected and cleaned up when the\n cyclic garbage collector is enabled (it\'s on by default). Refer\n to the documentation for the "gc" module for more information\n about this topic.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function to compute the "official"\n string representation of an object. If at all possible, this\n should look like a valid Python expression that could be used to\n recreate an object with the same value (given an appropriate\n environment). If this is not possible, a string of the form\n "<...some useful description...>" should be returned. The return\n value must be a string object. If a class defines "__repr__()" but\n not "__str__()", then "__repr__()" is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by "str(object)" and the built-in functions "format()" and\n "print()" to compute the "informal" or nicely printable string\n representation of an object. The return value must be a *string*\n object.\n\n This method differs from "object.__repr__()" in that there is no\n expectation that "__str__()" return a valid Python expression: a\n more convenient or concise representation can be used.\n\n The default implementation defined by the built-in type "object"\n calls "object.__repr__()".\n\nobject.__bytes__(self)\n\n Called by "bytes()" to compute a byte-string representation of an\n object. This should return a "bytes" object.\n\nobject.__format__(self, format_spec)\n\n Called by the "format()" built-in function (and by extension, the\n "str.format()" method of class "str") to produce a "formatted"\n string representation of an object. The "format_spec" argument is a\n string that contains a description of the formatting options\n desired. The interpretation of the "format_spec" argument is up to\n the type implementing "__format__()", however most classes will\n either delegate formatting to one of the built-in types, or use a\n similar formatting option syntax.\n\n See *Format Specification Mini-Language* for a description of the\n standard formatting syntax.\n\n The return value must be a string object.\n\n Changed in version 3.4: The __format__ method of "object" itself\n raises a "TypeError" if passed any non-empty string.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n These are the so-called "rich comparison" methods. The\n correspondence between operator symbols and method names is as\n follows: "x<y" calls "x.__lt__(y)", "x<=y" calls "x.__le__(y)",\n "x==y" calls "x.__eq__(y)", "x!=y" calls "x.__ne__(y)", "x>y" calls\n "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n There are no implied relationships among the comparison operators.\n The truth of "x==y" does not imply that "x!=y" is false.\n Accordingly, when defining "__eq__()", one should also define\n "__ne__()" so that the operators will behave as expected. See the\n paragraph on "__hash__()" for some important notes on creating\n *hashable* objects which support custom comparison operations and\n are usable as dictionary keys.\n\n There are no swapped-argument versions of these methods (to be used\n when the left argument does not support the operation but the right\n argument does); rather, "__lt__()" and "__gt__()" are each other\'s\n reflection, "__le__()" and "__ge__()" are each other\'s reflection,\n and "__eq__()" and "__ne__()" are their own reflection.\n\n Arguments to rich comparison methods are never coerced.\n\n To automatically generate ordering operations from a single root\n operation, see "functools.total_ordering()".\n\nobject.__hash__(self)\n\n Called by built-in function "hash()" and for operations on members\n of hashed collections including "set", "frozenset", and "dict".\n "__hash__()" should return an integer. The only required property\n is that objects which compare equal have the same hash value; it is\n advised to somehow mix together (e.g. using exclusive or) the hash\n values for the components of the object that also play a part in\n comparison of objects.\n\n Note: "hash()" truncates the value returned from an object\'s\n custom "__hash__()" method to the size of a "Py_ssize_t". This\n is typically 8 bytes on 64-bit builds and 4 bytes on 32-bit\n builds. If an object\'s "__hash__()" must interoperate on builds\n of different bit sizes, be sure to check the width on all\n supported builds. An easy way to do this is with "python -c\n "import sys; print(sys.hash_info.width)""\n\n If a class does not define an "__eq__()" method it should not\n define a "__hash__()" operation either; if it defines "__eq__()"\n but not "__hash__()", its instances will not be usable as items in\n hashable collections. If a class defines mutable objects and\n implements an "__eq__()" method, it should not implement\n "__hash__()", since the implementation of hashable collections\n requires that a key\'s hash value is immutable (if the object\'s hash\n value changes, it will be in the wrong hash bucket).\n\n User-defined classes have "__eq__()" and "__hash__()" methods by\n default; with them, all objects compare unequal (except with\n themselves) and "x.__hash__()" returns an appropriate value such\n that "x == y" implies both that "x is y" and "hash(x) == hash(y)".\n\n A class that overrides "__eq__()" and does not define "__hash__()"\n will have its "__hash__()" implicitly set to "None". When the\n "__hash__()" method of a class is "None", instances of the class\n will raise an appropriate "TypeError" when a program attempts to\n retrieve their hash value, and will also be correctly identified as\n unhashable when checking "isinstance(obj, collections.Hashable").\n\n If a class that overrides "__eq__()" needs to retain the\n implementation of "__hash__()" from a parent class, the interpreter\n must be told this explicitly by setting "__hash__ =\n <ParentClass>.__hash__".\n\n If a class that does not override "__eq__()" wishes to suppress\n hash support, it should include "__hash__ = None" in the class\n definition. A class which defines its own "__hash__()" that\n explicitly raises a "TypeError" would be incorrectly identified as\n hashable by an "isinstance(obj, collections.Hashable)" call.\n\n Note: By default, the "__hash__()" values of str, bytes and\n datetime objects are "salted" with an unpredictable random value.\n Although they remain constant within an individual Python\n process, they are not predictable between repeated invocations of\n Python.This is intended to provide protection against a denial-\n of-service caused by carefully-chosen inputs that exploit the\n worst case performance of a dict insertion, O(n^2) complexity.\n See http://www.ocert.org/advisories/ocert-2011-003.html for\n details.Changing hash values affects the iteration order of\n dicts, sets and other mappings. Python has never made guarantees\n about this ordering (and it typically varies between 32-bit and\n 64-bit builds).See also "PYTHONHASHSEED".\n\n Changed in version 3.3: Hash randomization is enabled by default.\n\nobject.__bool__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True". When this method is not\n defined, "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__bool__()", all its instances are\n considered true.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control over attribute access.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See *Special method lookup*.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should call the base class method with the same name, for example,\n "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\nobject.__dir__(self)\n\n Called when "dir()" is called on the object. A sequence must be\n returned. "dir()" converts the returned sequence to a list and\n sorts it.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\nThe attribute "__objclass__" is interpreted by the "inspect" module as\nspecifying the class where this object was defined (setting this\nappropriately can assist in runtime introspection of dynamic class\nattributes). For callables, it may indicate that an instance of the\ngiven type (or a subclass) is expected or required as the first\npositional argument (for example, CPython sets this attribute for\nunbound methods that are implemented in C).\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called.\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to an object instance, "a.x" is transformed into the\n call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a class, "A.x" is transformed into the call:\n "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of classes have a dictionary for attribute\nstorage. This wastes space for objects having very few instance\nvariables. The space consumption can become acute when creating large\nnumbers of instances.\n\nThe default can be overridden by defining *__slots__* in a class\ndefinition. The *__slots__* declaration takes a sequence of instance\nvariables and reserves just enough space in each instance to hold a\nvalue for each variable. Space is saved because *__dict__* is not\ncreated for each instance.\n\nobject.__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. *__slots__*\n reserves space for the declared variables and prevents the\n automatic creation of *__dict__* and *__weakref__* for each\n instance.\n\n\nNotes on using *__slots__*\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (*Implementing Descriptors*) for each variable name. As\n a result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "int", "bytes" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, classes are constructed using "type()". The class body is\nexecuted in a new namespace and the class name is bound locally to the\nresult of "type(name, bases, namespace)".\n\nThe class creation process can be customised by passing the\n"metaclass" keyword argument in the class definition line, or by\ninheriting from an existing class that included such an argument. In\nthe following example, both "MyClass" and "MySubclass" are instances\nof "Meta":\n\n class Meta(type):\n pass\n\n class MyClass(metaclass=Meta):\n pass\n\n class MySubclass(MyClass):\n pass\n\nAny other keyword arguments that are specified in the class definition\nare passed through to all metaclass operations described below.\n\nWhen a class definition is executed, the following steps occur:\n\n* the appropriate metaclass is determined\n\n* the class namespace is prepared\n\n* the class body is executed\n\n* the class object is created\n\n\nDetermining the appropriate metaclass\n-------------------------------------\n\nThe appropriate metaclass for a class definition is determined as\nfollows:\n\n* if no bases and no explicit metaclass are given, then "type()" is\n used\n\n* if an explicit metaclass is given and it is *not* an instance of\n "type()", then it is used directly as the metaclass\n\n* if an instance of "type()" is given as the explicit metaclass, or\n bases are defined, then the most derived metaclass is used\n\nThe most derived metaclass is selected from the explicitly specified\nmetaclass (if any) and the metaclasses (i.e. "type(cls)") of all\nspecified base classes. The most derived metaclass is one which is a\nsubtype of *all* of these candidate metaclasses. If none of the\ncandidate metaclasses meets that criterion, then the class definition\nwill fail with "TypeError".\n\n\nPreparing the class namespace\n-----------------------------\n\nOnce the appropriate metaclass has been identified, then the class\nnamespace is prepared. If the metaclass has a "__prepare__" attribute,\nit is called as "namespace = metaclass.__prepare__(name, bases,\n**kwds)" (where the additional keyword arguments, if any, come from\nthe class definition).\n\nIf the metaclass has no "__prepare__" attribute, then the class\nnamespace is initialised as an empty "dict()" instance.\n\nSee also: **PEP 3115** - Metaclasses in Python 3000\n\n Introduced the "__prepare__" namespace hook\n\n\nExecuting the class body\n------------------------\n\nThe class body is executed (approximately) as "exec(body, globals(),\nnamespace)". The key difference from a normal call to "exec()" is that\nlexical scoping allows the class body (including any methods) to\nreference names from the current and outer scopes when the class\ndefinition occurs inside a function.\n\nHowever, even when the class definition occurs inside the function,\nmethods defined inside the class still cannot see names defined at the\nclass scope. Class variables must be accessed through the first\nparameter of instance or class methods, and cannot be accessed at all\nfrom static methods.\n\n\nCreating the class object\n-------------------------\n\nOnce the class namespace has been populated by executing the class\nbody, the class object is created by calling "metaclass(name, bases,\nnamespace, **kwds)" (the additional keywords passed here are the same\nas those passed to "__prepare__").\n\nThis class object is the one that will be referenced by the zero-\nargument form of "super()". "__class__" is an implicit closure\nreference created by the compiler if any methods in a class body refer\nto either "__class__" or "super". This allows the zero argument form\nof "super()" to correctly identify the class being defined based on\nlexical scoping, while the class or instance that was used to make the\ncurrent call is identified based on the first argument passed to the\nmethod.\n\nAfter the class object is created, it is passed to the class\ndecorators included in the class definition (if any) and the resulting\nobject is bound in the local namespace as the defined class.\n\nSee also: **PEP 3135** - New super\n\n Describes the implicit "__class__" closure reference\n\n\nMetaclass example\n-----------------\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored include logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\nHere is an example of a metaclass that uses an\n"collections.OrderedDict" to remember the order that class variables\nare defined:\n\n class OrderedClass(type):\n\n @classmethod\n def __prepare__(metacls, name, bases, **kwds):\n return collections.OrderedDict()\n\n def __new__(cls, name, bases, namespace, **kwds):\n result = type.__new__(cls, name, bases, dict(namespace))\n result.members = tuple(namespace)\n return result\n\n class A(metaclass=OrderedClass):\n def one(self): pass\n def two(self): pass\n def three(self): pass\n def four(self): pass\n\n >>> A.members\n (\'__module__\', \'one\', \'two\', \'three\', \'four\')\n\nWhen the class definition for *A* gets executed, the process begins\nwith calling the metaclass\'s "__prepare__()" method which returns an\nempty "collections.OrderedDict". That mapping records the methods and\nattributes of *A* as they are defined within the body of the class\nstatement. Once those definitions are executed, the ordered dictionary\nis fully populated and the metaclass\'s "__new__()" method gets\ninvoked. That method builds the new type and it saves the ordered\ndictionary keys in an attribute called "members".\n\n\nCustomizing instance and subclass checks\n========================================\n\nThe following methods are used to override the default behavior of the\n"isinstance()" and "issubclass()" built-in functions.\n\nIn particular, the metaclass "abc.ABCMeta" implements these methods in\norder to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\n Return true if *instance* should be considered a (direct or\n indirect) instance of *class*. If defined, called to implement\n "isinstance(instance, class)".\n\nclass.__subclasscheck__(self, subclass)\n\n Return true if *subclass* should be considered a (direct or\n indirect) subclass of *class*. If defined, called to implement\n "issubclass(subclass, class)".\n\nNote that these methods are looked up on the type (metaclass) of a\nclass. They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also: **PEP 3119** - Introducing Abstract Base Classes\n\n Includes the specification for customizing "isinstance()" and\n "issubclass()" behavior through "__instancecheck__()" and\n "__subclasscheck__()", with motivation for this functionality in\n the context of adding Abstract Base Classes (see the "abc"\n module) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "get()", "clear()",\n"setdefault()", "pop()", "popitem()", "copy()", and "update()"\nbehaving similar to those for Python\'s standard dictionary objects.\nThe "collections" module provides a "MutableMapping" abstract base\nclass to help create those methods from a base set of "__getitem__()",\n"__setitem__()", "__delitem__()", and "keys()". Mutable sequences\nshould provide methods "append()", "count()", "index()", "extend()",\n"insert()", "pop()", "remove()", "reverse()" and "sort()", like Python\nstandard list objects. Finally, sequence types should implement\naddition (meaning concatenation) and multiplication (meaning\nrepetition) by defining the methods "__add__()", "__radd__()",\n"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" described\nbelow; they should not define other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should search the mapping\'s keys; for sequences, it\nshould search through the values. It is further recommended that both\nmappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "keys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__bool__()" method and whose "__len__()" method\n returns zero is considered to be false in a Boolean context.\n\nobject.__length_hint__(self)\n\n Called to implement "operator.length_hint()". Should return an\n estimated length for the object (which may be greater or less than\n the actual length). The length must be an integer ">=" 0. This\n method is purely an optimization and is never required for\n correctness.\n\n New in version 3.4.\n\nNote: Slicing is done exclusively with the following three methods.\n A call like\n\n a[1:2] = b\n\n is translated to\n\n a[slice(1, 2, None)] = b\n\n and so forth. Missing slice items are always filled in with "None".\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see *this section in the\n language reference*.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__matmul__(self, other)\nobject.__truediv__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|"). For instance, to\n evaluate the expression "x + y", where *x* is an instance of a\n class that has an "__add__()" method, "x.__add__(y)" is called.\n The "__divmod__()" method should be the equivalent to using\n "__floordiv__()" and "__mod__()"; it should not be related to\n "__truediv__()". Note that "__pow__()" should be defined to accept\n an optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rmatmul__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|") with reflected (swapped)\n operands. These functions are only called if the left operand does\n not support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__imatmul__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "@=", "/=", "//=", "%=", "**=",\n "<<=", ">>=", "&=", "^=", "|="). These methods should attempt to\n do the operation in-place (modifying *self*) and return the result\n (which could be, but does not have to be, *self*). If a specific\n method is not defined, the augmented assignment falls back to the\n normal methods. For instance, if *x* is an instance of a class\n with an "__iadd__()" method, "x += y" is equivalent to "x =\n x.__iadd__(y)" . Otherwise, "x.__add__(y)" and "y.__radd__(x)" are\n considered, as with the evaluation of "x + y". In certain\n situations, augmented assignment can result in unexpected errors\n (see *Why does a_tuple[i] += [\'item\'] raise an exception when the\n addition works?*), but this behavior is in fact part of the data\n model.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__float__(self)\nobject.__round__(self[, n])\n\n Called to implement the built-in functions "complex()", "int()",\n "float()" and "round()". Should return a value of the appropriate\n type.\n\nobject.__index__(self)\n\n Called to implement "operator.index()", and whenever Python needs\n to losslessly convert the numeric object to an integer object (such\n as in slicing, or in the built-in "bin()", "hex()" and "oct()"\n functions). Presence of this method indicates that the numeric\n object is an integer type. Must return an integer.\n\n Note: In order to have a coherent integer type class, when\n "__index__()" is defined "__int__()" should also be defined, and\n both should return the same value.\n\n\nWith Statement Context Managers\n===============================\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section *The with\nstatement*), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n\n\nSpecial method lookup\n=====================\n\nFor custom classes, implicit invocations of special methods are only\nguaranteed to work correctly if defined on an object\'s type, not in\nthe object\'s instance dictionary. That behaviour is the reason why\nthe following code raises an exception:\n\n >>> class C:\n ... pass\n ...\n >>> c = C()\n >>> c.__len__ = lambda: 5\n >>> len(c)\n Traceback (most recent call last):\n File "<stdin>", line 1, in <module>\n TypeError: object of type \'C\' has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as "__hash__()" and "__repr__()" that are implemented by\nall objects, including type objects. If the implicit lookup of these\nmethods used the conventional lookup process, they would fail when\ninvoked on the type object itself:\n\n >>> 1 .__hash__() == hash(1)\n True\n >>> int.__hash__() == hash(int)\n Traceback (most recent call last):\n File "<stdin>", line 1, in <module>\n TypeError: descriptor \'__hash__\' of \'int\' object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as \'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n >>> type(1).__hash__(1) == hash(1)\n True\n >>> type(int).__hash__(int) == hash(int)\n True\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe "__getattribute__()" method even of the object\'s metaclass:\n\n >>> class Meta(type):\n ... def __getattribute__(*args):\n ... print("Metaclass getattribute invoked")\n ... return type.__getattribute__(*args)\n ...\n >>> class C(object, metaclass=Meta):\n ... def __len__(self):\n ... return 10\n ... def __getattribute__(*args):\n ... print("Class getattribute invoked")\n ... return object.__getattribute__(*args)\n ...\n >>> c = C()\n >>> c.__len__() # Explicit lookup via instance\n Class getattribute invoked\n 10\n >>> type(c).__len__(c) # Explicit lookup via type\n Metaclass getattribute invoked\n 10\n >>> len(c) # Implicit lookup\n 10\n\nBypassing the "__getattribute__()" machinery in this fashion provides\nsignificant scope for speed optimisations within the interpreter, at\nthe cost of some flexibility in the handling of special methods (the\nspecial method *must* be set on the class object itself in order to be\nconsistently invoked by the interpreter).\n',
+ 'string-methods': u'\nString Methods\n**************\n\nStrings implement all of the *common* sequence operations, along with\nthe additional methods described below.\n\nStrings also support two styles of string formatting, one providing a\nlarge degree of flexibility and customization (see "str.format()",\n*Format String Syntax* and *String Formatting*) and the other based on\nC "printf" style formatting that handles a narrower range of types and\nis slightly harder to use correctly, but is often faster for the cases\nit can handle (*printf-style String Formatting*).\n\nThe *Text Processing Services* section of the standard library covers\na number of other modules that provide various text related utilities\n(including regular expression support in the "re" module).\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\nstr.casefold()\n\n Return a casefolded copy of the string. Casefolded strings may be\n used for caseless matching.\n\n Casefolding is similar to lowercasing but more aggressive because\n it is intended to remove all case distinctions in a string. For\n example, the German lowercase letter "\'\xdf\'" is equivalent to ""ss"".\n Since it is already lowercase, "lower()" would do nothing to "\'\xdf\'";\n "casefold()" converts it to ""ss"".\n\n The casefolding algorithm is described in section 3.13 of the\n Unicode Standard.\n\n New in version 3.3.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is an ASCII space). The\n original string is returned if *width* is less than or equal to\n "len(s)".\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.encode(encoding="utf-8", errors="strict")\n\n Return an encoded version of the string as a bytes object. Default\n encoding is "\'utf-8\'". *errors* may be given to set a different\n error handling scheme. The default for *errors* is "\'strict\'",\n meaning that encoding errors raise a "UnicodeError". Other possible\n values are "\'ignore\'", "\'replace\'", "\'xmlcharrefreplace\'",\n "\'backslashreplace\'" and any other name registered via\n "codecs.register_error()", see section *Error Handlers*. For a list\n of possible encodings, see section *Standard Encodings*.\n\n Changed in version 3.1: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\nstr.expandtabs(tabsize=8)\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the slice "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" if *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\nstr.format_map(mapping)\n\n Similar to "str.format(**mapping)", except that "mapping" is used\n directly and not copied to a "dict". This is useful if for example\n "mapping" is a dict subclass:\n\n >>> class Default(dict):\n ... def __missing__(self, key):\n ... return key\n ...\n >>> \'{name} was born in {country}\'.format_map(Default(name=\'Guido\'))\n \'Guido was born in country\'\n\n New in version 3.2.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise. A character "c"\n is alphanumeric if one of the following returns "True":\n "c.isalpha()", "c.isdecimal()", "c.isdigit()", or "c.isnumeric()".\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise. Alphabetic\n characters are those characters defined in the Unicode character\n database as "Letter", i.e., those with general category property\n being one of "Lm", "Lt", "Lu", "Ll", or "Lo". Note that this is\n different from the "Alphabetic" property defined in the Unicode\n Standard.\n\nstr.isdecimal()\n\n Return true if all characters in the string are decimal characters\n and there is at least one character, false otherwise. Decimal\n characters are those from general category "Nd". This category\n includes digit characters, and all characters that can be used to\n form decimal-radix numbers, e.g. U+0660, ARABIC-INDIC DIGIT ZERO.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise. Digits include decimal\n characters and digits that need special handling, such as the\n compatibility superscript digits. Formally, a digit is a character\n that has the property value Numeric_Type=Digit or\n Numeric_Type=Decimal.\n\nstr.isidentifier()\n\n Return true if the string is a valid identifier according to the\n language definition, section *Identifiers and keywords*.\n\n Use "keyword.iskeyword()" to test for reserved identifiers such as\n "def" and "class".\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\nstr.isnumeric()\n\n Return true if all characters in the string are numeric characters,\n and there is at least one character, false otherwise. Numeric\n characters include digit characters, and all characters that have\n the Unicode numeric value property, e.g. U+2155, VULGAR FRACTION\n ONE FIFTH. Formally, numeric characters are those with the\n property value Numeric_Type=Digit, Numeric_Type=Decimal or\n Numeric_Type=Numeric.\n\nstr.isprintable()\n\n Return true if all characters in the string are printable or the\n string is empty, false otherwise. Nonprintable characters are\n those characters defined in the Unicode character database as\n "Other" or "Separator", excepting the ASCII space (0x20) which is\n considered printable. (Note that printable characters in this\n context are those which should not be escaped when "repr()" is\n invoked on a string. It has no bearing on the handling of strings\n written to "sys.stdout" or "sys.stderr".)\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise. Whitespace\n characters are those characters defined in the Unicode character\n database as "Other" or "Separator" and those with bidirectional\n property being one of "WS", "B", or "S".\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. A "TypeError" will be raised if there are\n any non-string values in *iterable*, including "bytes" objects.\n The separator between elements is the string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n The lowercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\nstatic str.maketrans(x[, y[, z]])\n\n This static method returns a translation table usable for\n "str.translate()".\n\n If there is only one argument, it must be a dictionary mapping\n Unicode ordinals (integers) or characters (strings of length 1) to\n Unicode ordinals, strings (of arbitrary lengths) or None.\n Character keys will then be converted to ordinals.\n\n If there are two arguments, they must be strings of equal length,\n and in the resulting dictionary, each character in x will be mapped\n to the character at the same position in y. If there is a third\n argument, it must be a string, whose characters will be mapped to\n None in the result.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\nstr.rsplit(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\nstr.split(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n For example:\n\n >>> \'1,2,3\'.split(\',\')\n [\'1\', \'2\', \'3\']\n >>> \'1,2,3\'.split(\',\', maxsplit=1)\n [\'1\', \'2,3\']\n >>> \'1,2,,3,\'.split(\',\')\n [\'1\', \'2\', \'\', \'3\', \'\']\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example:\n\n >>> \'1 2 3\'.split()\n [\'1\', \'2\', \'3\']\n >>> \'1 2 3\'.split(maxsplit=1)\n [\'1\', \'2 3\']\n >>> \' 1 2 3 \'.split()\n [\'1\', \'2\', \'3\']\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n This method splits on the following line boundaries. In\n particular, the boundaries are a superset of *universal newlines*.\n\n +-------------------------+-------------------------------+\n | Representation | Description |\n +=========================+===============================+\n | "\\n" | Line Feed |\n +-------------------------+-------------------------------+\n | "\\r" | Carriage Return |\n +-------------------------+-------------------------------+\n | "\\r\\n" | Carriage Return + Line Feed |\n +-------------------------+-------------------------------+\n | "\\v" or "\\x0b" | Line Tabulation |\n +-------------------------+-------------------------------+\n | "\\f" or "\\x0c" | Form Feed |\n +-------------------------+-------------------------------+\n | "\\x1c" | File Separator |\n +-------------------------+-------------------------------+\n | "\\x1d" | Group Separator |\n +-------------------------+-------------------------------+\n | "\\x1e" | Record Separator |\n +-------------------------+-------------------------------+\n | "\\x85" | Next Line (C1 Control Code) |\n +-------------------------+-------------------------------+\n | "\\u2028" | Line Separator |\n +-------------------------+-------------------------------+\n | "\\u2029" | Paragraph Separator |\n +-------------------------+-------------------------------+\n\n Changed in version 3.2: "\\v" and "\\f" added to list of line\n boundaries.\n\n For example:\n\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()\n [\'ab c\', \'\', \'de fg\', \'kl\']\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines(keepends=True)\n [\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line:\n\n >>> "".splitlines()\n []\n >>> "One line\\n".splitlines()\n [\'One line\']\n\n For comparison, "split(\'\\n\')" gives:\n\n >>> \'\'.split(\'\\n\')\n [\'\']\n >>> \'Two lines\\n\'.split(\'\\n\')\n [\'Two lines\', \'\']\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n The outermost leading and trailing *chars* argument values are\n stripped from the string. Characters are removed from the leading\n end until reaching a string character that is not contained in the\n set of characters in *chars*. A similar action takes place on the\n trailing end. For example:\n\n >>> comment_string = \'#....... Section 3.2.1 Issue #32 .......\'\n >>> comment_string.strip(\'.#! \')\n \'Section 3.2.1 Issue #32\'\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa. Note that it is not necessarily true that\n "s.swapcase().swapcase() == s".\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n For example:\n\n >>> \'Hello world\'.title()\n \'Hello World\'\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\nstr.translate(map)\n\n Return a copy of the *s* where all characters have been mapped\n through the *map* which must be a dictionary of Unicode ordinals\n (integers) to Unicode ordinals, strings or "None". Unmapped\n characters are left untouched. Characters mapped to "None" are\n deleted.\n\n You can use "str.maketrans()" to create a translation map from\n character-to-character mappings in different formats.\n\n Note: An even more flexible approach is to create a custom\n character mapping codec using the "codecs" module (see\n "encodings.cp1251" for an example).\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n The uppercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.zfill(width)\n\n Return a copy of the string left filled with ASCII "\'0\'" digits to\n make a string of length *width*. A leading sign prefix\n ("\'+\'"/"\'-\'") is handled by inserting the padding *after* the sign\n character rather than before. The original string is returned if\n *width* is less than or equal to "len(s)".\n\n For example:\n\n >>> "42".zfill(5)\n \'00042\'\n >>> "-42".zfill(5)\n \'-0042\'\n',
+ 'strings': u'\nString and Bytes literals\n*************************\n\nString literals are described by the following lexical definitions:\n\n stringliteral ::= [stringprefix](shortstring | longstring)\n stringprefix ::= "r" | "u" | "R" | "U"\n shortstring ::= "\'" shortstringitem* "\'" | \'"\' shortstringitem* \'"\'\n longstring ::= "\'\'\'" longstringitem* "\'\'\'" | \'"""\' longstringitem* \'"""\'\n shortstringitem ::= shortstringchar | stringescapeseq\n longstringitem ::= longstringchar | stringescapeseq\n shortstringchar ::= <any source character except "\\" or newline or the quote>\n longstringchar ::= <any source character except "\\">\n stringescapeseq ::= "\\" <any source character>\n\n bytesliteral ::= bytesprefix(shortbytes | longbytes)\n bytesprefix ::= "b" | "B" | "br" | "Br" | "bR" | "BR" | "rb" | "rB" | "Rb" | "RB"\n shortbytes ::= "\'" shortbytesitem* "\'" | \'"\' shortbytesitem* \'"\'\n longbytes ::= "\'\'\'" longbytesitem* "\'\'\'" | \'"""\' longbytesitem* \'"""\'\n shortbytesitem ::= shortbyteschar | bytesescapeseq\n longbytesitem ::= longbyteschar | bytesescapeseq\n shortbyteschar ::= <any ASCII character except "\\" or newline or the quote>\n longbyteschar ::= <any ASCII character except "\\">\n bytesescapeseq ::= "\\" <any ASCII character>\n\nOne syntactic restriction not indicated by these productions is that\nwhitespace is not allowed between the "stringprefix" or "bytesprefix"\nand the rest of the literal. The source character set is defined by\nthe encoding declaration; it is UTF-8 if no encoding declaration is\ngiven in the source file; see section *Encoding declarations*.\n\nIn plain English: Both types of literals can be enclosed in matching\nsingle quotes ("\'") or double quotes ("""). They can also be enclosed\nin matching groups of three single or double quotes (these are\ngenerally referred to as *triple-quoted strings*). The backslash\n("\\") character is used to escape characters that otherwise have a\nspecial meaning, such as newline, backslash itself, or the quote\ncharacter.\n\nBytes literals are always prefixed with "\'b\'" or "\'B\'"; they produce\nan instance of the "bytes" type instead of the "str" type. They may\nonly contain ASCII characters; bytes with a numeric value of 128 or\ngreater must be expressed with escapes.\n\nAs of Python 3.3 it is possible again to prefix string literals with a\n"u" prefix to simplify maintenance of dual 2.x and 3.x codebases.\n\nBoth string and bytes literals may optionally be prefixed with a\nletter "\'r\'" or "\'R\'"; such strings are called *raw strings* and treat\nbackslashes as literal characters. As a result, in string literals,\n"\'\\U\'" and "\'\\u\'" escapes in raw strings are not treated specially.\nGiven that Python 2.x\'s raw unicode literals behave differently than\nPython 3.x\'s the "\'ur\'" syntax is not supported.\n\nNew in version 3.3: The "\'rb\'" prefix of raw bytes literals has been\nadded as a synonym of "\'br\'".\n\nNew in version 3.3: Support for the unicode legacy literal\n("u\'value\'") was reintroduced to simplify the maintenance of dual\nPython 2.x and 3.x codebases. See **PEP 414** for more information.\n\nIn triple-quoted literals, unescaped newlines and quotes are allowed\n(and are retained), except that three unescaped quotes in a row\nterminate the literal. (A "quote" is the character used to open the\nliteral, i.e. either "\'" or """.)\n\nUnless an "\'r\'" or "\'R\'" prefix is present, escape sequences in string\nand bytes literals are interpreted according to rules similar to those\nused by Standard C. The recognized escape sequences are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\newline" | Backslash and newline ignored | |\n+-------------------+-----------------------------------+---------+\n| "\\\\" | Backslash ("\\") | |\n+-------------------+-----------------------------------+---------+\n| "\\\'" | Single quote ("\'") | |\n+-------------------+-----------------------------------+---------+\n| "\\"" | Double quote (""") | |\n+-------------------+-----------------------------------+---------+\n| "\\a" | ASCII Bell (BEL) | |\n+-------------------+-----------------------------------+---------+\n| "\\b" | ASCII Backspace (BS) | |\n+-------------------+-----------------------------------+---------+\n| "\\f" | ASCII Formfeed (FF) | |\n+-------------------+-----------------------------------+---------+\n| "\\n" | ASCII Linefeed (LF) | |\n+-------------------+-----------------------------------+---------+\n| "\\r" | ASCII Carriage Return (CR) | |\n+-------------------+-----------------------------------+---------+\n| "\\t" | ASCII Horizontal Tab (TAB) | |\n+-------------------+-----------------------------------+---------+\n| "\\v" | ASCII Vertical Tab (VT) | |\n+-------------------+-----------------------------------+---------+\n| "\\ooo" | Character with octal value *ooo* | (1,3) |\n+-------------------+-----------------------------------+---------+\n| "\\xhh" | Character with hex value *hh* | (2,3) |\n+-------------------+-----------------------------------+---------+\n\nEscape sequences only recognized in string literals are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\N{name}" | Character named *name* in the | (4) |\n| | Unicode database | |\n+-------------------+-----------------------------------+---------+\n| "\\uxxxx" | Character with 16-bit hex value | (5) |\n| | *xxxx* | |\n+-------------------+-----------------------------------+---------+\n| "\\Uxxxxxxxx" | Character with 32-bit hex value | (6) |\n| | *xxxxxxxx* | |\n+-------------------+-----------------------------------+---------+\n\nNotes:\n\n1. As in Standard C, up to three octal digits are accepted.\n\n2. Unlike in Standard C, exactly two hex digits are required.\n\n3. In a bytes literal, hexadecimal and octal escapes denote the\n byte with the given value. In a string literal, these escapes\n denote a Unicode character with the given value.\n\n4. Changed in version 3.3: Support for name aliases [1] has been\n added.\n\n5. Individual code units which form parts of a surrogate pair can\n be encoded using this escape sequence. Exactly four hex digits are\n required.\n\n6. Any Unicode character can be encoded this way. Exactly eight\n hex digits are required.\n\nUnlike Standard C, all unrecognized escape sequences are left in the\nstring unchanged, i.e., *the backslash is left in the result*. (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.) It is also\nimportant to note that the escape sequences only recognized in string\nliterals fall into the category of unrecognized escapes for bytes\nliterals.\n\nEven in a raw literal, quotes can be escaped with a backslash, but the\nbackslash remains in the result; for example, "r"\\""" is a valid\nstring literal consisting of two characters: a backslash and a double\nquote; "r"\\"" is not a valid string literal (even a raw string cannot\nend in an odd number of backslashes). Specifically, *a raw literal\ncannot end in a single backslash* (since the backslash would escape\nthe following quote character). Note also that a single backslash\nfollowed by a newline is interpreted as those two characters as part\nof the literal, *not* as a line continuation.\n',
+ 'subscriptions': u'\nSubscriptions\n*************\n\nA subscription selects an item of a sequence (string, tuple or list)\nor mapping (dictionary) object:\n\n subscription ::= primary "[" expression_list "]"\n\nThe primary must evaluate to an object that supports subscription\n(lists or dictionaries for example). User-defined objects can support\nsubscription by defining a "__getitem__()" method.\n\nFor built-in objects, there are two types of objects that support\nsubscription:\n\nIf the primary is a mapping, the expression list must evaluate to an\nobject whose value is one of the keys of the mapping, and the\nsubscription selects the value in the mapping that corresponds to that\nkey. (The expression list is a tuple except if it has exactly one\nitem.)\n\nIf the primary is a sequence, the expression (list) must evaluate to\nan integer or a slice (as discussed in the following section).\n\nThe formal syntax makes no special provision for negative indices in\nsequences; however, built-in sequences all provide a "__getitem__()"\nmethod that interprets negative indices by adding the length of the\nsequence to the index (so that "x[-1]" selects the last item of "x").\nThe resulting value must be a nonnegative integer less than the number\nof items in the sequence, and the subscription selects the item whose\nindex is that value (counting from zero). Since the support for\nnegative indices and slicing occurs in the object\'s "__getitem__()"\nmethod, subclasses overriding this method will need to explicitly add\nthat support.\n\nA string\'s items are characters. A character is not a separate data\ntype but a string of exactly one character.\n',
+ 'truth': u'\nTruth Value Testing\n*******************\n\nAny object can be tested for truth value, for use in an "if" or\n"while" condition or as operand of the Boolean operations below. The\nfollowing values are considered false:\n\n* "None"\n\n* "False"\n\n* zero of any numeric type, for example, "0", "0.0", "0j".\n\n* any empty sequence, for example, "\'\'", "()", "[]".\n\n* any empty mapping, for example, "{}".\n\n* instances of user-defined classes, if the class defines a\n "__bool__()" or "__len__()" method, when that method returns the\n integer zero or "bool" value "False". [1]\n\nAll other values are considered true --- so objects of many types are\nalways true.\n\nOperations and built-in functions that have a Boolean result always\nreturn "0" or "False" for false and "1" or "True" for true, unless\notherwise stated. (Important exception: the Boolean operations "or"\nand "and" always return one of their operands.)\n',
+ 'try': u'\nThe "try" statement\n*******************\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the "as" keyword in that except clause, if\npresent, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using "as target", it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n del N\n\nThis means the exception must be assigned to a different name to be\nable to refer to it after the except clause. Exceptions are cleared\nbecause with the traceback attached to them, they form a reference\ncycle with the stack frame, keeping all locals in that frame alive\nuntil the next garbage collection occurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the "sys" module and can be accessed via\n"sys.exc_info()". "sys.exc_info()" returns a 3-tuple consisting of the\nexception class, the exception instance and a traceback object (see\nsection *The standard type hierarchy*) identifying the point in the\nprogram where the exception occurred. "sys.exc_info()" values are\nrestored to their previous values (before the call) when returning\nfrom a function that handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception it is re-raised at the end of the "finally"\nclause. If the "finally" clause raises another exception, the saved\nexception is set as the context of the new exception. If the "finally"\nclause executes a "return" or "break" statement, the saved exception\nis discarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the "raise" statement to\ngenerate exceptions may be found in section *The raise statement*.\n',
+ 'types': u'\nThe standard type hierarchy\n***************************\n\nBelow is a list of the types that are built into Python. Extension\nmodules (written in C, Java, or other languages, depending on the\nimplementation) can define additional types. Future versions of\nPython may add types to the type hierarchy (e.g., rational numbers,\nefficiently stored arrays of integers, etc.), although such additions\nwill often be provided via the standard library instead.\n\nSome of the type descriptions below contain a paragraph listing\n\'special attributes.\' These are attributes that provide access to the\nimplementation and are not intended for general use. Their definition\nmay change in the future.\n\nNone\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name "None". It\n is used to signify the absence of a value in many situations, e.g.,\n it is returned from functions that don\'t explicitly return\n anything. Its truth value is false.\n\nNotImplemented\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n "NotImplemented". Numeric methods and rich comparison methods\n should return this value if they do not implement the operation for\n the operands provided. (The interpreter will then try the\n reflected operation, or some other fallback, depending on the\n operator.) Its truth value is true.\n\n See *Implementing the arithmetic operations* for more details.\n\nEllipsis\n This type has a single value. There is a single object with this\n value. This object is accessed through the literal "..." or the\n built-in name "Ellipsis". Its truth value is true.\n\n"numbers.Number"\n These are created by numeric literals and returned as results by\n arithmetic operators and arithmetic built-in functions. Numeric\n objects are immutable; once created their value never changes.\n Python numbers are of course strongly related to mathematical\n numbers, but subject to the limitations of numerical representation\n in computers.\n\n Python distinguishes between integers, floating point numbers, and\n complex numbers:\n\n "numbers.Integral"\n These represent elements from the mathematical set of integers\n (positive and negative).\n\n There are two types of integers:\n\n Integers ("int")\n\n These represent numbers in an unlimited range, subject to\n available (virtual) memory only. For the purpose of shift\n and mask operations, a binary representation is assumed, and\n negative numbers are represented in a variant of 2\'s\n complement which gives the illusion of an infinite string of\n sign bits extending to the left.\n\n Booleans ("bool")\n These represent the truth values False and True. The two\n objects representing the values "False" and "True" are the\n only Boolean objects. The Boolean type is a subtype of the\n integer type, and Boolean values behave like the values 0 and\n 1, respectively, in almost all contexts, the exception being\n that when converted to a string, the strings ""False"" or\n ""True"" are returned, respectively.\n\n The rules for integer representation are intended to give the\n most meaningful interpretation of shift and mask operations\n involving negative integers.\n\n "numbers.Real" ("float")\n These represent machine-level double precision floating point\n numbers. You are at the mercy of the underlying machine\n architecture (and C or Java implementation) for the accepted\n range and handling of overflow. Python does not support single-\n precision floating point numbers; the savings in processor and\n memory usage that are usually the reason for using these are\n dwarfed by the overhead of using objects in Python, so there is\n no reason to complicate the language with two kinds of floating\n point numbers.\n\n "numbers.Complex" ("complex")\n These represent complex numbers as a pair of machine-level\n double precision floating point numbers. The same caveats apply\n as for floating point numbers. The real and imaginary parts of a\n complex number "z" can be retrieved through the read-only\n attributes "z.real" and "z.imag".\n\nSequences\n These represent finite ordered sets indexed by non-negative\n numbers. The built-in function "len()" returns the number of items\n of a sequence. When the length of a sequence is *n*, the index set\n contains the numbers 0, 1, ..., *n*-1. Item *i* of sequence *a* is\n selected by "a[i]".\n\n Sequences also support slicing: "a[i:j]" selects all items with\n index *k* such that *i* "<=" *k* "<" *j*. When used as an\n expression, a slice is a sequence of the same type. This implies\n that the index set is renumbered so that it starts at 0.\n\n Some sequences also support "extended slicing" with a third "step"\n parameter: "a[i:j:k]" selects all items of *a* with index *x* where\n "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n\n Sequences are distinguished according to their mutability:\n\n Immutable sequences\n An object of an immutable sequence type cannot change once it is\n created. (If the object contains references to other objects,\n these other objects may be mutable and may be changed; however,\n the collection of objects directly referenced by an immutable\n object cannot change.)\n\n The following types are immutable sequences:\n\n Strings\n A string is a sequence of values that represent Unicode code\n points. All the code points in the range "U+0000 - U+10FFFF"\n can be represented in a string. Python doesn\'t have a "char"\n type; instead, every code point in the string is represented\n as a string object with length "1". The built-in function\n "ord()" converts a code point from its string form to an\n integer in the range "0 - 10FFFF"; "chr()" converts an\n integer in the range "0 - 10FFFF" to the corresponding length\n "1" string object. "str.encode()" can be used to convert a\n "str" to "bytes" using the given text encoding, and\n "bytes.decode()" can be used to achieve the opposite.\n\n Tuples\n The items of a tuple are arbitrary Python objects. Tuples of\n two or more items are formed by comma-separated lists of\n expressions. A tuple of one item (a \'singleton\') can be\n formed by affixing a comma to an expression (an expression by\n itself does not create a tuple, since parentheses must be\n usable for grouping of expressions). An empty tuple can be\n formed by an empty pair of parentheses.\n\n Bytes\n A bytes object is an immutable array. The items are 8-bit\n bytes, represented by integers in the range 0 <= x < 256.\n Bytes literals (like "b\'abc\'") and the built-in function\n "bytes()" can be used to construct bytes objects. Also,\n bytes objects can be decoded to strings via the "decode()"\n method.\n\n Mutable sequences\n Mutable sequences can be changed after they are created. The\n subscription and slicing notations can be used as the target of\n assignment and "del" (delete) statements.\n\n There are currently two intrinsic mutable sequence types:\n\n Lists\n The items of a list are arbitrary Python objects. Lists are\n formed by placing a comma-separated list of expressions in\n square brackets. (Note that there are no special cases needed\n to form lists of length 0 or 1.)\n\n Byte Arrays\n A bytearray object is a mutable array. They are created by\n the built-in "bytearray()" constructor. Aside from being\n mutable (and hence unhashable), byte arrays otherwise provide\n the same interface and functionality as immutable bytes\n objects.\n\n The extension module "array" provides an additional example of a\n mutable sequence type, as does the "collections" module.\n\nSet types\n These represent unordered, finite sets of unique, immutable\n objects. As such, they cannot be indexed by any subscript. However,\n they can be iterated over, and the built-in function "len()"\n returns the number of items in a set. Common uses for sets are fast\n membership testing, removing duplicates from a sequence, and\n computing mathematical operations such as intersection, union,\n difference, and symmetric difference.\n\n For set elements, the same immutability rules apply as for\n dictionary keys. Note that numeric types obey the normal rules for\n numeric comparison: if two numbers compare equal (e.g., "1" and\n "1.0"), only one of them can be contained in a set.\n\n There are currently two intrinsic set types:\n\n Sets\n These represent a mutable set. They are created by the built-in\n "set()" constructor and can be modified afterwards by several\n methods, such as "add()".\n\n Frozen sets\n These represent an immutable set. They are created by the\n built-in "frozenset()" constructor. As a frozenset is immutable\n and *hashable*, it can be used again as an element of another\n set, or as a dictionary key.\n\nMappings\n These represent finite sets of objects indexed by arbitrary index\n sets. The subscript notation "a[k]" selects the item indexed by "k"\n from the mapping "a"; this can be used in expressions and as the\n target of assignments or "del" statements. The built-in function\n "len()" returns the number of items in a mapping.\n\n There is currently a single intrinsic mapping type:\n\n Dictionaries\n These represent finite sets of objects indexed by nearly\n arbitrary values. The only types of values not acceptable as\n keys are values containing lists or dictionaries or other\n mutable types that are compared by value rather than by object\n identity, the reason being that the efficient implementation of\n dictionaries requires a key\'s hash value to remain constant.\n Numeric types used for keys obey the normal rules for numeric\n comparison: if two numbers compare equal (e.g., "1" and "1.0")\n then they can be used interchangeably to index the same\n dictionary entry.\n\n Dictionaries are mutable; they can be created by the "{...}"\n notation (see section *Dictionary displays*).\n\n The extension modules "dbm.ndbm" and "dbm.gnu" provide\n additional examples of mapping types, as does the "collections"\n module.\n\nCallable types\n These are the types to which the function call operation (see\n section *Calls*) can be applied:\n\n User-defined functions\n A user-defined function object is created by a function\n definition (see section *Function definitions*). It should be\n called with an argument list containing the same number of items\n as the function\'s formal parameter list.\n\n Special attributes:\n\n +---------------------------+---------------------------------+-------------+\n | Attribute | Meaning | |\n +===========================+=================================+=============+\n | "__doc__" | The function\'s documentation | Writable |\n | | string, or "None" if | |\n | | unavailable; not inherited by | |\n | | subclasses | |\n +---------------------------+---------------------------------+-------------+\n | "__name__" | The function\'s name | Writable |\n +---------------------------+---------------------------------+-------------+\n | "__qualname__" | The function\'s *qualified name* | Writable |\n | | New in version 3.3. | |\n +---------------------------+---------------------------------+-------------+\n | "__module__" | The name of the module the | Writable |\n | | function was defined in, or | |\n | | "None" if unavailable. | |\n +---------------------------+---------------------------------+-------------+\n | "__defaults__" | A tuple containing default | Writable |\n | | argument values for those | |\n | | arguments that have defaults, | |\n | | or "None" if no arguments have | |\n | | a default value | |\n +---------------------------+---------------------------------+-------------+\n | "__code__" | The code object representing | Writable |\n | | the compiled function body. | |\n +---------------------------+---------------------------------+-------------+\n | "__globals__" | A reference to the dictionary | Read-only |\n | | that holds the function\'s | |\n | | global variables --- the global | |\n | | namespace of the module in | |\n | | which the function was defined. | |\n +---------------------------+---------------------------------+-------------+\n | "__dict__" | The namespace supporting | Writable |\n | | arbitrary function attributes. | |\n +---------------------------+---------------------------------+-------------+\n | "__closure__" | "None" or a tuple of cells that | Read-only |\n | | contain bindings for the | |\n | | function\'s free variables. | |\n +---------------------------+---------------------------------+-------------+\n | "__annotations__" | A dict containing annotations | Writable |\n | | of parameters. The keys of the | |\n | | dict are the parameter names, | |\n | | and "\'return\'" for the return | |\n | | annotation, if provided. | |\n +---------------------------+---------------------------------+-------------+\n | "__kwdefaults__" | A dict containing defaults for | Writable |\n | | keyword-only parameters. | |\n +---------------------------+---------------------------------+-------------+\n\n Most of the attributes labelled "Writable" check the type of the\n assigned value.\n\n Function objects also support getting and setting arbitrary\n attributes, which can be used, for example, to attach metadata\n to functions. Regular attribute dot-notation is used to get and\n set such attributes. *Note that the current implementation only\n supports function attributes on user-defined functions. Function\n attributes on built-in functions may be supported in the\n future.*\n\n Additional information about a function\'s definition can be\n retrieved from its code object; see the description of internal\n types below.\n\n Instance methods\n An instance method object combines a class, a class instance and\n any callable object (normally a user-defined function).\n\n Special read-only attributes: "__self__" is the class instance\n object, "__func__" is the function object; "__doc__" is the\n method\'s documentation (same as "__func__.__doc__"); "__name__"\n is the method name (same as "__func__.__name__"); "__module__"\n is the name of the module the method was defined in, or "None"\n if unavailable.\n\n Methods also support accessing (but not setting) the arbitrary\n function attributes on the underlying function object.\n\n User-defined method objects may be created when getting an\n attribute of a class (perhaps via an instance of that class), if\n that attribute is a user-defined function object or a class\n method object.\n\n When an instance method object is created by retrieving a user-\n defined function object from a class via one of its instances,\n its "__self__" attribute is the instance, and the method object\n is said to be bound. The new method\'s "__func__" attribute is\n the original function object.\n\n When a user-defined method object is created by retrieving\n another method object from a class or instance, the behaviour is\n the same as for a function object, except that the "__func__"\n attribute of the new instance is not the original method object\n but its "__func__" attribute.\n\n When an instance method object is created by retrieving a class\n method object from a class or instance, its "__self__" attribute\n is the class itself, and its "__func__" attribute is the\n function object underlying the class method.\n\n When an instance method object is called, the underlying\n function ("__func__") is called, inserting the class instance\n ("__self__") in front of the argument list. For instance, when\n "C" is a class which contains a definition for a function "f()",\n and "x" is an instance of "C", calling "x.f(1)" is equivalent to\n calling "C.f(x, 1)".\n\n When an instance method object is derived from a class method\n object, the "class instance" stored in "__self__" will actually\n be the class itself, so that calling either "x.f(1)" or "C.f(1)"\n is equivalent to calling "f(C,1)" where "f" is the underlying\n function.\n\n Note that the transformation from function object to instance\n method object happens each time the attribute is retrieved from\n the instance. In some cases, a fruitful optimization is to\n assign the attribute to a local variable and call that local\n variable. Also notice that this transformation only happens for\n user-defined functions; other callable objects (and all non-\n callable objects) are retrieved without transformation. It is\n also important to note that user-defined functions which are\n attributes of a class instance are not converted to bound\n methods; this *only* happens when the function is an attribute\n of the class.\n\n Generator functions\n A function or method which uses the "yield" statement (see\n section *The yield statement*) is called a *generator function*.\n Such a function, when called, always returns an iterator object\n which can be used to execute the body of the function: calling\n the iterator\'s "iterator.__next__()" method will cause the\n function to execute until it provides a value using the "yield"\n statement. When the function executes a "return" statement or\n falls off the end, a "StopIteration" exception is raised and the\n iterator will have reached the end of the set of values to be\n returned.\n\n Coroutine functions\n A function or method which is defined using "async def" is\n called a *coroutine function*. Such a function, when called,\n returns a *coroutine* object. It may contain "await"\n expressions, as well as "async with" and "async for" statements.\n See also *Coroutines* section.\n\n Built-in functions\n A built-in function object is a wrapper around a C function.\n Examples of built-in functions are "len()" and "math.sin()"\n ("math" is a standard built-in module). The number and type of\n the arguments are determined by the C function. Special read-\n only attributes: "__doc__" is the function\'s documentation\n string, or "None" if unavailable; "__name__" is the function\'s\n name; "__self__" is set to "None" (but see the next item);\n "__module__" is the name of the module the function was defined\n in or "None" if unavailable.\n\n Built-in methods\n This is really a different disguise of a built-in function, this\n time containing an object passed to the C function as an\n implicit extra argument. An example of a built-in method is\n "alist.append()", assuming *alist* is a list object. In this\n case, the special read-only attribute "__self__" is set to the\n object denoted by *alist*.\n\n Classes\n Classes are callable. These objects normally act as factories\n for new instances of themselves, but variations are possible for\n class types that override "__new__()". The arguments of the\n call are passed to "__new__()" and, in the typical case, to\n "__init__()" to initialize the new instance.\n\n Class Instances\n Instances of arbitrary classes can be made callable by defining\n a "__call__()" method in their class.\n\nModules\n Modules are a basic organizational unit of Python code, and are\n created by the *import system* as invoked either by the "import"\n statement (see "import"), or by calling functions such as\n "importlib.import_module()" and built-in "__import__()". A module\n object has a namespace implemented by a dictionary object (this is\n the dictionary referenced by the "__globals__" attribute of\n functions defined in the module). Attribute references are\n translated to lookups in this dictionary, e.g., "m.x" is equivalent\n to "m.__dict__["x"]". A module object does not contain the code\n object used to initialize the module (since it isn\'t needed once\n the initialization is done).\n\n Attribute assignment updates the module\'s namespace dictionary,\n e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n\n Special read-only attribute: "__dict__" is the module\'s namespace\n as a dictionary object.\n\n **CPython implementation detail:** Because of the way CPython\n clears module dictionaries, the module dictionary will be cleared\n when the module falls out of scope even if the dictionary still has\n live references. To avoid this, copy the dictionary or keep the\n module around while using its dictionary directly.\n\n Predefined (writable) attributes: "__name__" is the module\'s name;\n "__doc__" is the module\'s documentation string, or "None" if\n unavailable; "__file__" is the pathname of the file from which the\n module was loaded, if it was loaded from a file. The "__file__"\n attribute may be missing for certain types of modules, such as C\n modules that are statically linked into the interpreter; for\n extension modules loaded dynamically from a shared library, it is\n the pathname of the shared library file.\n\nCustom classes\n Custom class types are typically created by class definitions (see\n section *Class definitions*). A class has a namespace implemented\n by a dictionary object. Class attribute references are translated\n to lookups in this dictionary, e.g., "C.x" is translated to\n "C.__dict__["x"]" (although there are a number of hooks which allow\n for other means of locating attributes). When the attribute name is\n not found there, the attribute search continues in the base\n classes. This search of the base classes uses the C3 method\n resolution order which behaves correctly even in the presence of\n \'diamond\' inheritance structures where there are multiple\n inheritance paths leading back to a common ancestor. Additional\n details on the C3 MRO used by Python can be found in the\n documentation accompanying the 2.3 release at\n https://www.python.org/download/releases/2.3/mro/.\n\n When a class attribute reference (for class "C", say) would yield a\n class method object, it is transformed into an instance method\n object whose "__self__" attributes is "C". When it would yield a\n static method object, it is transformed into the object wrapped by\n the static method object. See section *Implementing Descriptors*\n for another way in which attributes retrieved from a class may\n differ from those actually contained in its "__dict__".\n\n Class attribute assignments update the class\'s dictionary, never\n the dictionary of a base class.\n\n A class object can be called (see above) to yield a class instance\n (see below).\n\n Special attributes: "__name__" is the class name; "__module__" is\n the module name in which the class was defined; "__dict__" is the\n dictionary containing the class\'s namespace; "__bases__" is a tuple\n (possibly empty or a singleton) containing the base classes, in the\n order of their occurrence in the base class list; "__doc__" is the\n class\'s documentation string, or None if undefined.\n\nClass instances\n A class instance is created by calling a class object (see above).\n A class instance has a namespace implemented as a dictionary which\n is the first place in which attribute references are searched.\n When an attribute is not found there, and the instance\'s class has\n an attribute by that name, the search continues with the class\n attributes. If a class attribute is found that is a user-defined\n function object, it is transformed into an instance method object\n whose "__self__" attribute is the instance. Static method and\n class method objects are also transformed; see above under\n "Classes". See section *Implementing Descriptors* for another way\n in which attributes of a class retrieved via its instances may\n differ from the objects actually stored in the class\'s "__dict__".\n If no class attribute is found, and the object\'s class has a\n "__getattr__()" method, that is called to satisfy the lookup.\n\n Attribute assignments and deletions update the instance\'s\n dictionary, never a class\'s dictionary. If the class has a\n "__setattr__()" or "__delattr__()" method, this is called instead\n of updating the instance dictionary directly.\n\n Class instances can pretend to be numbers, sequences, or mappings\n if they have methods with certain special names. See section\n *Special method names*.\n\n Special attributes: "__dict__" is the attribute dictionary;\n "__class__" is the instance\'s class.\n\nI/O objects (also known as file objects)\n A *file object* represents an open file. Various shortcuts are\n available to create file objects: the "open()" built-in function,\n and also "os.popen()", "os.fdopen()", and the "makefile()" method\n of socket objects (and perhaps by other functions or methods\n provided by extension modules).\n\n The objects "sys.stdin", "sys.stdout" and "sys.stderr" are\n initialized to file objects corresponding to the interpreter\'s\n standard input, output and error streams; they are all open in text\n mode and therefore follow the interface defined by the\n "io.TextIOBase" abstract class.\n\nInternal types\n A few types used internally by the interpreter are exposed to the\n user. Their definitions may change with future versions of the\n interpreter, but they are mentioned here for completeness.\n\n Code objects\n Code objects represent *byte-compiled* executable Python code,\n or *bytecode*. The difference between a code object and a\n function object is that the function object contains an explicit\n reference to the function\'s globals (the module in which it was\n defined), while a code object contains no context; also the\n default argument values are stored in the function object, not\n in the code object (because they represent values calculated at\n run-time). Unlike function objects, code objects are immutable\n and contain no references (directly or indirectly) to mutable\n objects.\n\n Special read-only attributes: "co_name" gives the function name;\n "co_argcount" is the number of positional arguments (including\n arguments with default values); "co_nlocals" is the number of\n local variables used by the function (including arguments);\n "co_varnames" is a tuple containing the names of the local\n variables (starting with the argument names); "co_cellvars" is a\n tuple containing the names of local variables that are\n referenced by nested functions; "co_freevars" is a tuple\n containing the names of free variables; "co_code" is a string\n representing the sequence of bytecode instructions; "co_consts"\n is a tuple containing the literals used by the bytecode;\n "co_names" is a tuple containing the names used by the bytecode;\n "co_filename" is the filename from which the code was compiled;\n "co_firstlineno" is the first line number of the function;\n "co_lnotab" is a string encoding the mapping from bytecode\n offsets to line numbers (for details see the source code of the\n interpreter); "co_stacksize" is the required stack size\n (including local variables); "co_flags" is an integer encoding a\n number of flags for the interpreter.\n\n The following flag bits are defined for "co_flags": bit "0x04"\n is set if the function uses the "*arguments" syntax to accept an\n arbitrary number of positional arguments; bit "0x08" is set if\n the function uses the "**keywords" syntax to accept arbitrary\n keyword arguments; bit "0x20" is set if the function is a\n generator.\n\n Future feature declarations ("from __future__ import division")\n also use bits in "co_flags" to indicate whether a code object\n was compiled with a particular feature enabled: bit "0x2000" is\n set if the function was compiled with future division enabled;\n bits "0x10" and "0x1000" were used in earlier versions of\n Python.\n\n Other bits in "co_flags" are reserved for internal use.\n\n If a code object represents a function, the first item in\n "co_consts" is the documentation string of the function, or\n "None" if undefined.\n\n Frame objects\n Frame objects represent execution frames. They may occur in\n traceback objects (see below).\n\n Special read-only attributes: "f_back" is to the previous stack\n frame (towards the caller), or "None" if this is the bottom\n stack frame; "f_code" is the code object being executed in this\n frame; "f_locals" is the dictionary used to look up local\n variables; "f_globals" is used for global variables;\n "f_builtins" is used for built-in (intrinsic) names; "f_lasti"\n gives the precise instruction (this is an index into the\n bytecode string of the code object).\n\n Special writable attributes: "f_trace", if not "None", is a\n function called at the start of each source code line (this is\n used by the debugger); "f_lineno" is the current line number of\n the frame --- writing to this from within a trace function jumps\n to the given line (only for the bottom-most frame). A debugger\n can implement a Jump command (aka Set Next Statement) by writing\n to f_lineno.\n\n Frame objects support one method:\n\n frame.clear()\n\n This method clears all references to local variables held by\n the frame. Also, if the frame belonged to a generator, the\n generator is finalized. This helps break reference cycles\n involving frame objects (for example when catching an\n exception and storing its traceback for later use).\n\n "RuntimeError" is raised if the frame is currently executing.\n\n New in version 3.4.\n\n Traceback objects\n Traceback objects represent a stack trace of an exception. A\n traceback object is created when an exception occurs. When the\n search for an exception handler unwinds the execution stack, at\n each unwound level a traceback object is inserted in front of\n the current traceback. When an exception handler is entered,\n the stack trace is made available to the program. (See section\n *The try statement*.) It is accessible as the third item of the\n tuple returned by "sys.exc_info()". When the program contains no\n suitable handler, the stack trace is written (nicely formatted)\n to the standard error stream; if the interpreter is interactive,\n it is also made available to the user as "sys.last_traceback".\n\n Special read-only attributes: "tb_next" is the next level in the\n stack trace (towards the frame where the exception occurred), or\n "None" if there is no next level; "tb_frame" points to the\n execution frame of the current level; "tb_lineno" gives the line\n number where the exception occurred; "tb_lasti" indicates the\n precise instruction. The line number and last instruction in\n the traceback may differ from the line number of its frame\n object if the exception occurred in a "try" statement with no\n matching except clause or with a finally clause.\n\n Slice objects\n Slice objects are used to represent slices for "__getitem__()"\n methods. They are also created by the built-in "slice()"\n function.\n\n Special read-only attributes: "start" is the lower bound; "stop"\n is the upper bound; "step" is the step value; each is "None" if\n omitted. These attributes can have any type.\n\n Slice objects support one method:\n\n slice.indices(self, length)\n\n This method takes a single integer argument *length* and\n computes information about the slice that the slice object\n would describe if applied to a sequence of *length* items.\n It returns a tuple of three integers; respectively these are\n the *start* and *stop* indices and the *step* or stride\n length of the slice. Missing or out-of-bounds indices are\n handled in a manner consistent with regular slices.\n\n Static method objects\n Static method objects provide a way of defeating the\n transformation of function objects to method objects described\n above. A static method object is a wrapper around any other\n object, usually a user-defined method object. When a static\n method object is retrieved from a class or a class instance, the\n object actually returned is the wrapped object, which is not\n subject to any further transformation. Static method objects are\n not themselves callable, although the objects they wrap usually\n are. Static method objects are created by the built-in\n "staticmethod()" constructor.\n\n Class method objects\n A class method object, like a static method object, is a wrapper\n around another object that alters the way in which that object\n is retrieved from classes and class instances. The behaviour of\n class method objects upon such retrieval is described above,\n under "User-defined methods". Class method objects are created\n by the built-in "classmethod()" constructor.\n',
+ 'typesfunctions': u'\nFunctions\n*********\n\nFunction objects are created by function definitions. The only\noperation on a function object is to call it: "func(argument-list)".\n\nThere are really two flavors of function objects: built-in functions\nand user-defined functions. Both support the same operation (to call\nthe function), but the implementation is different, hence the\ndifferent object types.\n\nSee *Function definitions* for more information.\n',
+ 'typesmapping': u'\nMapping Types --- "dict"\n************************\n\nA *mapping* object maps *hashable* values to arbitrary objects.\nMappings are mutable objects. There is currently only one standard\nmapping type, the *dictionary*. (For other containers see the built-\nin "list", "set", and "tuple" classes, and the "collections" module.)\n\nA dictionary\'s keys are *almost* arbitrary values. Values that are\nnot *hashable*, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys. Numeric types used for keys obey\nthe normal rules for numeric comparison: if two numbers compare equal\n(such as "1" and "1.0") then they can be used interchangeably to index\nthe same dictionary entry. (Note however, that since computers store\nfloating-point numbers as approximations it is usually unwise to use\nthem as dictionary keys.)\n\nDictionaries can be created by placing a comma-separated list of "key:\nvalue" pairs within braces, for example: "{\'jack\': 4098, \'sjoerd\':\n4127}" or "{4098: \'jack\', 4127: \'sjoerd\'}", or by the "dict"\nconstructor.\n\nclass class dict(**kwarg)\nclass class dict(mapping, **kwarg)\nclass class dict(iterable, **kwarg)\n\n Return a new dictionary initialized from an optional positional\n argument and a possibly empty set of keyword arguments.\n\n If no positional argument is given, an empty dictionary is created.\n If a positional argument is given and it is a mapping object, a\n dictionary is created with the same key-value pairs as the mapping\n object. Otherwise, the positional argument must be an *iterable*\n object. Each item in the iterable must itself be an iterable with\n exactly two objects. The first object of each item becomes a key\n in the new dictionary, and the second object the corresponding\n value. If a key occurs more than once, the last value for that key\n becomes the corresponding value in the new dictionary.\n\n If keyword arguments are given, the keyword arguments and their\n values are added to the dictionary created from the positional\n argument. If a key being added is already present, the value from\n the keyword argument replaces the value from the positional\n argument.\n\n To illustrate, the following examples all return a dictionary equal\n to "{"one": 1, "two": 2, "three": 3}":\n\n >>> a = dict(one=1, two=2, three=3)\n >>> b = {\'one\': 1, \'two\': 2, \'three\': 3}\n >>> c = dict(zip([\'one\', \'two\', \'three\'], [1, 2, 3]))\n >>> d = dict([(\'two\', 2), (\'one\', 1), (\'three\', 3)])\n >>> e = dict({\'three\': 3, \'one\': 1, \'two\': 2})\n >>> a == b == c == d == e\n True\n\n Providing keyword arguments as in the first example only works for\n keys that are valid Python identifiers. Otherwise, any valid keys\n can be used.\n\n These are the operations that dictionaries support (and therefore,\n custom mapping types should support too):\n\n len(d)\n\n Return the number of items in the dictionary *d*.\n\n d[key]\n\n Return the item of *d* with key *key*. Raises a "KeyError" if\n *key* is not in the map.\n\n If a subclass of dict defines a method "__missing__()" and *key*\n is not present, the "d[key]" operation calls that method with\n the key *key* as argument. The "d[key]" operation then returns\n or raises whatever is returned or raised by the\n "__missing__(key)" call. No other operations or methods invoke\n "__missing__()". If "__missing__()" is not defined, "KeyError"\n is raised. "__missing__()" must be a method; it cannot be an\n instance variable:\n\n >>> class Counter(dict):\n ... def __missing__(self, key):\n ... return 0\n >>> c = Counter()\n >>> c[\'red\']\n 0\n >>> c[\'red\'] += 1\n >>> c[\'red\']\n 1\n\n The example above shows part of the implementation of\n "collections.Counter". A different "__missing__" method is used\n by "collections.defaultdict".\n\n d[key] = value\n\n Set "d[key]" to *value*.\n\n del d[key]\n\n Remove "d[key]" from *d*. Raises a "KeyError" if *key* is not\n in the map.\n\n key in d\n\n Return "True" if *d* has a key *key*, else "False".\n\n key not in d\n\n Equivalent to "not key in d".\n\n iter(d)\n\n Return an iterator over the keys of the dictionary. This is a\n shortcut for "iter(d.keys())".\n\n clear()\n\n Remove all items from the dictionary.\n\n copy()\n\n Return a shallow copy of the dictionary.\n\n classmethod fromkeys(seq[, value])\n\n Create a new dictionary with keys from *seq* and values set to\n *value*.\n\n "fromkeys()" is a class method that returns a new dictionary.\n *value* defaults to "None".\n\n get(key[, default])\n\n Return the value for *key* if *key* is in the dictionary, else\n *default*. If *default* is not given, it defaults to "None", so\n that this method never raises a "KeyError".\n\n items()\n\n Return a new view of the dictionary\'s items ("(key, value)"\n pairs). See the *documentation of view objects*.\n\n keys()\n\n Return a new view of the dictionary\'s keys. See the\n *documentation of view objects*.\n\n pop(key[, default])\n\n If *key* is in the dictionary, remove it and return its value,\n else return *default*. If *default* is not given and *key* is\n not in the dictionary, a "KeyError" is raised.\n\n popitem()\n\n Remove and return an arbitrary "(key, value)" pair from the\n dictionary.\n\n "popitem()" is useful to destructively iterate over a\n dictionary, as often used in set algorithms. If the dictionary\n is empty, calling "popitem()" raises a "KeyError".\n\n setdefault(key[, default])\n\n If *key* is in the dictionary, return its value. If not, insert\n *key* with a value of *default* and return *default*. *default*\n defaults to "None".\n\n update([other])\n\n Update the dictionary with the key/value pairs from *other*,\n overwriting existing keys. Return "None".\n\n "update()" accepts either another dictionary object or an\n iterable of key/value pairs (as tuples or other iterables of\n length two). If keyword arguments are specified, the dictionary\n is then updated with those key/value pairs: "d.update(red=1,\n blue=2)".\n\n values()\n\n Return a new view of the dictionary\'s values. See the\n *documentation of view objects*.\n\nSee also: "types.MappingProxyType" can be used to create a read-only\n view of a "dict".\n\n\nDictionary view objects\n=======================\n\nThe objects returned by "dict.keys()", "dict.values()" and\n"dict.items()" are *view objects*. They provide a dynamic view on the\ndictionary\'s entries, which means that when the dictionary changes,\nthe view reflects these changes.\n\nDictionary views can be iterated over to yield their respective data,\nand support membership tests:\n\nlen(dictview)\n\n Return the number of entries in the dictionary.\n\niter(dictview)\n\n Return an iterator over the keys, values or items (represented as\n tuples of "(key, value)") in the dictionary.\n\n Keys and values are iterated over in an arbitrary order which is\n non-random, varies across Python implementations, and depends on\n the dictionary\'s history of insertions and deletions. If keys,\n values and items views are iterated over with no intervening\n modifications to the dictionary, the order of items will directly\n correspond. This allows the creation of "(value, key)" pairs using\n "zip()": "pairs = zip(d.values(), d.keys())". Another way to\n create the same list is "pairs = [(v, k) for (k, v) in d.items()]".\n\n Iterating views while adding or deleting entries in the dictionary\n may raise a "RuntimeError" or fail to iterate over all entries.\n\nx in dictview\n\n Return "True" if *x* is in the underlying dictionary\'s keys, values\n or items (in the latter case, *x* should be a "(key, value)"\n tuple).\n\nKeys views are set-like since their entries are unique and hashable.\nIf all values are hashable, so that "(key, value)" pairs are unique\nand hashable, then the items view is also set-like. (Values views are\nnot treated as set-like since the entries are generally not unique.)\nFor set-like views, all of the operations defined for the abstract\nbase class "collections.abc.Set" are available (for example, "==",\n"<", or "^").\n\nAn example of dictionary view usage:\n\n >>> dishes = {\'eggs\': 2, \'sausage\': 1, \'bacon\': 1, \'spam\': 500}\n >>> keys = dishes.keys()\n >>> values = dishes.values()\n\n >>> # iteration\n >>> n = 0\n >>> for val in values:\n ... n += val\n >>> print(n)\n 504\n\n >>> # keys and values are iterated over in the same order\n >>> list(keys)\n [\'eggs\', \'bacon\', \'sausage\', \'spam\']\n >>> list(values)\n [2, 1, 1, 500]\n\n >>> # view objects are dynamic and reflect dict changes\n >>> del dishes[\'eggs\']\n >>> del dishes[\'sausage\']\n >>> list(keys)\n [\'spam\', \'bacon\']\n\n >>> # set operations\n >>> keys & {\'eggs\', \'bacon\', \'salad\'}\n {\'bacon\'}\n >>> keys ^ {\'sausage\', \'juice\'}\n {\'juice\', \'sausage\', \'bacon\', \'spam\'}\n',
+ 'typesmethods': u'\nMethods\n*******\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: built-in methods (such as "append()" on lists)\nand class instance methods. Built-in methods are described with the\ntypes that support them.\n\nIf you access a method (a function defined in a class namespace)\nthrough an instance, you get a special object: a *bound method* (also\ncalled *instance method*) object. When called, it will add the "self"\nargument to the argument list. Bound methods have two special read-\nonly attributes: "m.__self__" is the object on which the method\noperates, and "m.__func__" is the function implementing the method.\nCalling "m(arg-1, arg-2, ..., arg-n)" is completely equivalent to\ncalling "m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)".\n\nLike function objects, bound method objects support getting arbitrary\nattributes. However, since method attributes are actually stored on\nthe underlying function object ("meth.__func__"), setting method\nattributes on bound methods is disallowed. Attempting to set an\nattribute on a method results in an "AttributeError" being raised. In\norder to set a method attribute, you need to explicitly set it on the\nunderlying function object:\n\n >>> class C:\n ... def method(self):\n ... pass\n ...\n >>> c = C()\n >>> c.method.whoami = \'my name is method\' # can\'t set on the method\n Traceback (most recent call last):\n File "<stdin>", line 1, in <module>\n AttributeError: \'method\' object has no attribute \'whoami\'\n >>> c.method.__func__.whoami = \'my name is method\'\n >>> c.method.whoami\n \'my name is method\'\n\nSee *The standard type hierarchy* for more information.\n',
+ 'typesmodules': u'\nModules\n*******\n\nThe only special operation on a module is attribute access: "m.name",\nwhere *m* is a module and *name* accesses a name defined in *m*\'s\nsymbol table. Module attributes can be assigned to. (Note that the\n"import" statement is not, strictly speaking, an operation on a module\nobject; "import foo" does not require a module object named *foo* to\nexist, rather it requires an (external) *definition* for a module\nnamed *foo* somewhere.)\n\nA special attribute of every module is "__dict__". This is the\ndictionary containing the module\'s symbol table. Modifying this\ndictionary will actually change the module\'s symbol table, but direct\nassignment to the "__dict__" attribute is not possible (you can write\n"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", but you can\'t\nwrite "m.__dict__ = {}"). Modifying "__dict__" directly is not\nrecommended.\n\nModules built into the interpreter are written like this: "<module\n\'sys\' (built-in)>". If loaded from a file, they are written as\n"<module \'os\' from \'/usr/local/lib/pythonX.Y/os.pyc\'>".\n',
+ 'typesseq': u'\nSequence Types --- "list", "tuple", "range"\n*******************************************\n\nThere are three basic sequence types: lists, tuples, and range\nobjects. Additional sequence types tailored for processing of *binary\ndata* and *text strings* are described in dedicated sections.\n\n\nCommon Sequence Operations\n==========================\n\nThe operations in the following table are supported by most sequence\ntypes, both mutable and immutable. The "collections.abc.Sequence" ABC\nis provided to make it easier to correctly implement these operations\non custom sequence types.\n\nThis table lists the sequence operations sorted in ascending priority.\nIn the table, *s* and *t* are sequences of the same type, *n*, *i*,\n*j* and *k* are integers and *x* is an arbitrary object that meets any\ntype and value restrictions imposed by *s*.\n\nThe "in" and "not in" operations have the same priorities as the\ncomparison operations. The "+" (concatenation) and "*" (repetition)\noperations have the same priority as the corresponding numeric\noperations.\n\n+----------------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+============================+==================================+============+\n| "x in s" | "True" if an item of *s* is | (1) |\n| | equal to *x*, else "False" | |\n+----------------------------+----------------------------------+------------+\n| "x not in s" | "False" if an item of *s* is | (1) |\n| | equal to *x*, else "True" | |\n+----------------------------+----------------------------------+------------+\n| "s + t" | the concatenation of *s* and *t* | (6)(7) |\n+----------------------------+----------------------------------+------------+\n| "s * n" or "n * s" | *n* shallow copies of *s* | (2)(7) |\n| | concatenated | |\n+----------------------------+----------------------------------+------------+\n| "s[i]" | *i*th item of *s*, origin 0 | (3) |\n+----------------------------+----------------------------------+------------+\n| "s[i:j]" | slice of *s* from *i* to *j* | (3)(4) |\n+----------------------------+----------------------------------+------------+\n| "s[i:j:k]" | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+----------------------------+----------------------------------+------------+\n| "len(s)" | length of *s* | |\n+----------------------------+----------------------------------+------------+\n| "min(s)" | smallest item of *s* | |\n+----------------------------+----------------------------------+------------+\n| "max(s)" | largest item of *s* | |\n+----------------------------+----------------------------------+------------+\n| "s.index(x[, i[, j]])" | index of the first occurrence of | (8) |\n| | *x* in *s* (at or after index | |\n| | *i* and before index *j*) | |\n+----------------------------+----------------------------------+------------+\n| "s.count(x)" | total number of occurrences of | |\n| | *x* in *s* | |\n+----------------------------+----------------------------------+------------+\n\nSequences of the same type also support comparisons. In particular,\ntuples and lists are compared lexicographically by comparing\ncorresponding elements. This means that to compare equal, every\nelement must compare equal and the two sequences must be of the same\ntype and have the same length. (For full details see *Comparisons* in\nthe language reference.)\n\nNotes:\n\n1. While the "in" and "not in" operations are used only for simple\n containment testing in the general case, some specialised sequences\n (such as "str", "bytes" and "bytearray") also use them for\n subsequence testing:\n\n >>> "gg" in "eggs"\n True\n\n2. Values of *n* less than "0" are treated as "0" (which yields an\n empty sequence of the same type as *s*). Note also that the copies\n are shallow; nested structures are not copied. This often haunts\n new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that "[[]]" is a one-element list containing\n an empty list, so all three elements of "[[]] * 3" are (pointers\n to) this single empty list. Modifying any of the elements of\n "lists" modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n3. If *i* or *j* is negative, the index is relative to the end of\n the string: "len(s) + i" or "len(s) + j" is substituted. But note\n that "-0" is still "0".\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that "i <= k < j". If *i* or *j* is\n greater than "len(s)", use "len(s)". If *i* is omitted or "None",\n use "0". If *j* is omitted or "None", use "len(s)". If *i* is\n greater than or equal to *j*, the slice is empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index "x = i + n*k" such that "0 <= n <\n (j-i)/k". In other words, the indices are "i", "i+k", "i+2*k",\n "i+3*k" and so on, stopping when *j* is reached (but never\n including *j*). If *i* or *j* is greater than "len(s)", use\n "len(s)". If *i* or *j* are omitted or "None", they become "end"\n values (which end depends on the sign of *k*). Note, *k* cannot be\n zero. If *k* is "None", it is treated like "1".\n\n6. Concatenating immutable sequences always results in a new\n object. This means that building up a sequence by repeated\n concatenation will have a quadratic runtime cost in the total\n sequence length. To get a linear runtime cost, you must switch to\n one of the alternatives below:\n\n * if concatenating "str" objects, you can build a list and use\n "str.join()" at the end or else write to a "io.StringIO" instance\n and retrieve its value when complete\n\n * if concatenating "bytes" objects, you can similarly use\n "bytes.join()" or "io.BytesIO", or you can do in-place\n concatenation with a "bytearray" object. "bytearray" objects are\n mutable and have an efficient overallocation mechanism\n\n * if concatenating "tuple" objects, extend a "list" instead\n\n * for other types, investigate the relevant class documentation\n\n7. Some sequence types (such as "range") only support item\n sequences that follow specific patterns, and hence don\'t support\n sequence concatenation or repetition.\n\n8. "index" raises "ValueError" when *x* is not found in *s*. When\n supported, the additional arguments to the index method allow\n efficient searching of subsections of the sequence. Passing the\n extra arguments is roughly equivalent to using "s[i:j].index(x)",\n only without copying any data and with the returned index being\n relative to the start of the sequence rather than the start of the\n slice.\n\n\nImmutable Sequence Types\n========================\n\nThe only operation that immutable sequence types generally implement\nthat is not also implemented by mutable sequence types is support for\nthe "hash()" built-in.\n\nThis support allows immutable sequences, such as "tuple" instances, to\nbe used as "dict" keys and stored in "set" and "frozenset" instances.\n\nAttempting to hash an immutable sequence that contains unhashable\nvalues will result in "TypeError".\n\n\nMutable Sequence Types\n======================\n\nThe operations in the following table are defined on mutable sequence\ntypes. The "collections.abc.MutableSequence" ABC is provided to make\nit easier to correctly implement these operations on custom sequence\ntypes.\n\nIn the table *s* is an instance of a mutable sequence type, *t* is any\niterable object and *x* is an arbitrary object that meets any type and\nvalue restrictions imposed by *s* (for example, "bytearray" only\naccepts integers that meet the value restriction "0 <= x <= 255").\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | appends *x* to the end of the | |\n| | sequence (same as | |\n| | "s[len(s):len(s)] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.clear()" | removes all items from "s" (same | (5) |\n| | as "del s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.copy()" | creates a shallow copy of "s" | (5) |\n| | (same as "s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(t)" | extends *s* with the contents of | |\n| | *t* (same as "s[len(s):len(s)] = | |\n| | t") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | inserts *x* into *s* at the | |\n| | index given by *i* (same as | |\n| | "s[i:i] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | retrieves the item at *i* and | (2) |\n| | also removes it from *s* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | remove the first item from *s* | (3) |\n| | where "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (4) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The optional argument *i* defaults to "-1", so that by default\n the last item is removed and returned.\n\n3. "remove" raises "ValueError" when *x* is not found in *s*.\n\n4. The "reverse()" method modifies the sequence in place for\n economy of space when reversing a large sequence. To remind users\n that it operates by side effect, it does not return the reversed\n sequence.\n\n5. "clear()" and "copy()" are included for consistency with the\n interfaces of mutable containers that don\'t support slicing\n operations (such as "dict" and "set")\n\n New in version 3.3: "clear()" and "copy()" methods.\n\n\nLists\n=====\n\nLists are mutable sequences, typically used to store collections of\nhomogeneous items (where the precise degree of similarity will vary by\napplication).\n\nclass class list([iterable])\n\n Lists may be constructed in several ways:\n\n * Using a pair of square brackets to denote the empty list: "[]"\n\n * Using square brackets, separating items with commas: "[a]",\n "[a, b, c]"\n\n * Using a list comprehension: "[x for x in iterable]"\n\n * Using the type constructor: "list()" or "list(iterable)"\n\n The constructor builds a list whose items are the same and in the\n same order as *iterable*\'s items. *iterable* may be either a\n sequence, a container that supports iteration, or an iterator\n object. If *iterable* is already a list, a copy is made and\n returned, similar to "iterable[:]". For example, "list(\'abc\')"\n returns "[\'a\', \'b\', \'c\']" and "list( (1, 2, 3) )" returns "[1, 2,\n 3]". If no argument is given, the constructor creates a new empty\n list, "[]".\n\n Many other operations also produce lists, including the "sorted()"\n built-in.\n\n Lists implement all of the *common* and *mutable* sequence\n operations. Lists also provide the following additional method:\n\n sort(*, key=None, reverse=None)\n\n This method sorts the list in place, using only "<" comparisons\n between items. Exceptions are not suppressed - if any comparison\n operations fail, the entire sort operation will fail (and the\n list will likely be left in a partially modified state).\n\n "sort()" accepts two arguments that can only be passed by\n keyword (*keyword-only arguments*):\n\n *key* specifies a function of one argument that is used to\n extract a comparison key from each list element (for example,\n "key=str.lower"). The key corresponding to each item in the list\n is calculated once and then used for the entire sorting process.\n The default value of "None" means that list items are sorted\n directly without calculating a separate key value.\n\n The "functools.cmp_to_key()" utility is available to convert a\n 2.x style *cmp* function to a *key* function.\n\n *reverse* is a boolean value. If set to "True", then the list\n elements are sorted as if each comparison were reversed.\n\n This method modifies the sequence in place for economy of space\n when sorting a large sequence. To remind users that it operates\n by side effect, it does not return the sorted sequence (use\n "sorted()" to explicitly request a new sorted list instance).\n\n The "sort()" method is guaranteed to be stable. A sort is\n stable if it guarantees not to change the relative order of\n elements that compare equal --- this is helpful for sorting in\n multiple passes (for example, sort by department, then by salary\n grade).\n\n **CPython implementation detail:** While a list is being sorted,\n the effect of attempting to mutate, or even inspect, the list is\n undefined. The C implementation of Python makes the list appear\n empty for the duration, and raises "ValueError" if it can detect\n that the list has been mutated during a sort.\n\n\nTuples\n======\n\nTuples are immutable sequences, typically used to store collections of\nheterogeneous data (such as the 2-tuples produced by the "enumerate()"\nbuilt-in). Tuples are also used for cases where an immutable sequence\nof homogeneous data is needed (such as allowing storage in a "set" or\n"dict" instance).\n\nclass class tuple([iterable])\n\n Tuples may be constructed in a number of ways:\n\n * Using a pair of parentheses to denote the empty tuple: "()"\n\n * Using a trailing comma for a singleton tuple: "a," or "(a,)"\n\n * Separating items with commas: "a, b, c" or "(a, b, c)"\n\n * Using the "tuple()" built-in: "tuple()" or "tuple(iterable)"\n\n The constructor builds a tuple whose items are the same and in the\n same order as *iterable*\'s items. *iterable* may be either a\n sequence, a container that supports iteration, or an iterator\n object. If *iterable* is already a tuple, it is returned\n unchanged. For example, "tuple(\'abc\')" returns "(\'a\', \'b\', \'c\')"\n and "tuple( [1, 2, 3] )" returns "(1, 2, 3)". If no argument is\n given, the constructor creates a new empty tuple, "()".\n\n Note that it is actually the comma which makes a tuple, not the\n parentheses. The parentheses are optional, except in the empty\n tuple case, or when they are needed to avoid syntactic ambiguity.\n For example, "f(a, b, c)" is a function call with three arguments,\n while "f((a, b, c))" is a function call with a 3-tuple as the sole\n argument.\n\n Tuples implement all of the *common* sequence operations.\n\nFor heterogeneous collections of data where access by name is clearer\nthan access by index, "collections.namedtuple()" may be a more\nappropriate choice than a simple tuple object.\n\n\nRanges\n======\n\nThe "range" type represents an immutable sequence of numbers and is\ncommonly used for looping a specific number of times in "for" loops.\n\nclass class range(stop)\nclass class range(start, stop[, step])\n\n The arguments to the range constructor must be integers (either\n built-in "int" or any object that implements the "__index__"\n special method). If the *step* argument is omitted, it defaults to\n "1". If the *start* argument is omitted, it defaults to "0". If\n *step* is zero, "ValueError" is raised.\n\n For a positive *step*, the contents of a range "r" are determined\n by the formula "r[i] = start + step*i" where "i >= 0" and "r[i] <\n stop".\n\n For a negative *step*, the contents of the range are still\n determined by the formula "r[i] = start + step*i", but the\n constraints are "i >= 0" and "r[i] > stop".\n\n A range object will be empty if "r[0]" does not meet the value\n constraint. Ranges do support negative indices, but these are\n interpreted as indexing from the end of the sequence determined by\n the positive indices.\n\n Ranges containing absolute values larger than "sys.maxsize" are\n permitted but some features (such as "len()") may raise\n "OverflowError".\n\n Range examples:\n\n >>> list(range(10))\n [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n >>> list(range(1, 11))\n [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n >>> list(range(0, 30, 5))\n [0, 5, 10, 15, 20, 25]\n >>> list(range(0, 10, 3))\n [0, 3, 6, 9]\n >>> list(range(0, -10, -1))\n [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n >>> list(range(0))\n []\n >>> list(range(1, 0))\n []\n\n Ranges implement all of the *common* sequence operations except\n concatenation and repetition (due to the fact that range objects\n can only represent sequences that follow a strict pattern and\n repetition and concatenation will usually violate that pattern).\n\nThe advantage of the "range" type over a regular "list" or "tuple" is\nthat a "range" object will always take the same (small) amount of\nmemory, no matter the size of the range it represents (as it only\nstores the "start", "stop" and "step" values, calculating individual\nitems and subranges as needed).\n\nRange objects implement the "collections.abc.Sequence" ABC, and\nprovide features such as containment tests, element index lookup,\nslicing and support for negative indices (see *Sequence Types ---\nlist, tuple, range*):\n\n>>> r = range(0, 20, 2)\n>>> r\nrange(0, 20, 2)\n>>> 11 in r\nFalse\n>>> 10 in r\nTrue\n>>> r.index(10)\n5\n>>> r[5]\n10\n>>> r[:5]\nrange(0, 10, 2)\n>>> r[-1]\n18\n\nTesting range objects for equality with "==" and "!=" compares them as\nsequences. That is, two range objects are considered equal if they\nrepresent the same sequence of values. (Note that two range objects\nthat compare equal might have different "start", "stop" and "step"\nattributes, for example "range(0) == range(2, 1, 3)" or "range(0, 3,\n2) == range(0, 4, 2)".)\n\nChanged in version 3.2: Implement the Sequence ABC. Support slicing\nand negative indices. Test "int" objects for membership in constant\ntime instead of iterating through all items.\n\nChanged in version 3.3: Define \'==\' and \'!=\' to compare range objects\nbased on the sequence of values they define (instead of comparing\nbased on object identity).\n\nNew in version 3.3: The "start", "stop" and "step" attributes.\n',
+ 'typesseq-mutable': u'\nMutable Sequence Types\n**********************\n\nThe operations in the following table are defined on mutable sequence\ntypes. The "collections.abc.MutableSequence" ABC is provided to make\nit easier to correctly implement these operations on custom sequence\ntypes.\n\nIn the table *s* is an instance of a mutable sequence type, *t* is any\niterable object and *x* is an arbitrary object that meets any type and\nvalue restrictions imposed by *s* (for example, "bytearray" only\naccepts integers that meet the value restriction "0 <= x <= 255").\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | appends *x* to the end of the | |\n| | sequence (same as | |\n| | "s[len(s):len(s)] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.clear()" | removes all items from "s" (same | (5) |\n| | as "del s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.copy()" | creates a shallow copy of "s" | (5) |\n| | (same as "s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(t)" | extends *s* with the contents of | |\n| | *t* (same as "s[len(s):len(s)] = | |\n| | t") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | inserts *x* into *s* at the | |\n| | index given by *i* (same as | |\n| | "s[i:i] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | retrieves the item at *i* and | (2) |\n| | also removes it from *s* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | remove the first item from *s* | (3) |\n| | where "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (4) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The optional argument *i* defaults to "-1", so that by default\n the last item is removed and returned.\n\n3. "remove" raises "ValueError" when *x* is not found in *s*.\n\n4. The "reverse()" method modifies the sequence in place for\n economy of space when reversing a large sequence. To remind users\n that it operates by side effect, it does not return the reversed\n sequence.\n\n5. "clear()" and "copy()" are included for consistency with the\n interfaces of mutable containers that don\'t support slicing\n operations (such as "dict" and "set")\n\n New in version 3.3: "clear()" and "copy()" methods.\n',
+ 'unary': u'\nUnary arithmetic and bitwise operations\n***************************************\n\nAll unary arithmetic and bitwise operations have the same priority:\n\n u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n\nThe unary "-" (minus) operator yields the negation of its numeric\nargument.\n\nThe unary "+" (plus) operator yields its numeric argument unchanged.\n\nThe unary "~" (invert) operator yields the bitwise inversion of its\ninteger argument. The bitwise inversion of "x" is defined as\n"-(x+1)". It only applies to integral numbers.\n\nIn all three cases, if the argument does not have the proper type, a\n"TypeError" exception is raised.\n',
+ 'while': u'\nThe "while" statement\n*********************\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n',
+ 'with': u'\nThe "with" statement\n********************\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n',
+ 'yield': u'\nThe "yield" statement\n*********************\n\n yield_stmt ::= yield_expression\n\nA "yield" statement is semantically equivalent to a *yield\nexpression*. The yield statement can be used to omit the parentheses\nthat would otherwise be required in the equivalent yield expression\nstatement. For example, the yield statements\n\n yield <expr>\n yield from <expr>\n\nare equivalent to the yield expression statements\n\n (yield <expr>)\n (yield from <expr>)\n\nYield expressions and statements are only used when defining a\n*generator* function, and are only used in the body of the generator\nfunction. Using yield in a function definition is sufficient to cause\nthat definition to create a generator function instead of a normal\nfunction.\n\nFor full details of "yield" semantics, refer to the *Yield\nexpressions* section.\n'}
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py
index d517c0e..613848f 100644
--- a/Lib/rlcompleter.py
+++ b/Lib/rlcompleter.py
@@ -106,6 +106,12 @@
n = len(text)
for word in keyword.kwlist:
if word[:n] == text:
+ if word in {'finally', 'try'}:
+ word = word + ':'
+ elif word not in {'False', 'None', 'True',
+ 'break', 'continue', 'pass',
+ 'else'}:
+ word = word + ' '
matches.append(word)
for nspace in [builtins.__dict__, self.namespace]:
for word, val in nspace.items():
@@ -136,20 +142,35 @@
return []
# get the content of the object, except __builtins__
- words = dir(thisobject)
- if "__builtins__" in words:
- words.remove("__builtins__")
+ words = set(dir(thisobject))
+ words.discard("__builtins__")
if hasattr(thisobject, '__class__'):
- words.append('__class__')
- words.extend(get_class_members(thisobject.__class__))
+ words.add('__class__')
+ words.update(get_class_members(thisobject.__class__))
matches = []
n = len(attr)
- for word in words:
- if word[:n] == attr and hasattr(thisobject, word):
- val = getattr(thisobject, word)
- word = self._callable_postfix(val, "%s.%s" % (expr, word))
- matches.append(word)
+ if attr == '':
+ noprefix = '_'
+ elif attr == '_':
+ noprefix = '__'
+ else:
+ noprefix = None
+ while True:
+ for word in words:
+ if (word[:n] == attr and
+ not (noprefix and word[:n+1] == noprefix) and
+ hasattr(thisobject, word)):
+ val = getattr(thisobject, word)
+ word = self._callable_postfix(val, "%s.%s" % (expr, word))
+ matches.append(word)
+ if matches or not noprefix:
+ break
+ if noprefix == '_':
+ noprefix = '__'
+ else:
+ noprefix = None
+ matches.sort()
return matches
def get_class_members(klass):
diff --git a/Lib/sched.py b/Lib/sched.py
index b47648d..bd7c0f1 100644
--- a/Lib/sched.py
+++ b/Lib/sched.py
@@ -46,6 +46,17 @@
def __gt__(s, o): return (s.time, s.priority) > (o.time, o.priority)
def __ge__(s, o): return (s.time, s.priority) >= (o.time, o.priority)
+Event.time.__doc__ = ('''Numeric type compatible with the return value of the
+timefunc function passed to the constructor.''')
+Event.priority.__doc__ = ('''Events scheduled for the same time will be executed
+in the order of their priority.''')
+Event.action.__doc__ = ('''Executing the event means executing
+action(*argument, **kwargs)''')
+Event.argument.__doc__ = ('''argument is a sequence holding the positional
+arguments for the action.''')
+Event.kwargs.__doc__ = ('''kwargs is a dictionary holding the keyword
+arguments for the action.''')
+
_sentinel = object()
class scheduler:
diff --git a/Lib/selectors.py b/Lib/selectors.py
index 6d569c3..ecd8632 100644
--- a/Lib/selectors.py
+++ b/Lib/selectors.py
@@ -43,9 +43,17 @@
SelectorKey = namedtuple('SelectorKey', ['fileobj', 'fd', 'events', 'data'])
-"""Object used to associate a file object to its backing file descriptor,
-selected event mask and attached data."""
+SelectorKey.__doc__ = """SelectorKey(fileobj, fd, events, data)
+
+ Object used to associate a file object to its backing
+ file descriptor, selected event mask, and attached data.
+"""
+SelectorKey.fileobj.__doc__ = 'File object registered.'
+SelectorKey.fd.__doc__ = 'Underlying file descriptor.'
+SelectorKey.events.__doc__ = 'Events that must be waited for on this file object.'
+SelectorKey.data.__doc__ = ('''Optional opaque data associated to this file object.
+For example, this could be used to store a per-client session ID.''')
class _SelectorMapping(Mapping):
"""Mapping of file objects to selector keys."""
diff --git a/Lib/shutil.py b/Lib/shutil.py
index 3f4b6bf..f47a763 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -974,6 +974,9 @@
__all__.append('disk_usage')
_ntuple_diskusage = collections.namedtuple('usage', 'total used free')
+ _ntuple_diskusage.total.__doc__ = 'Total space in bytes'
+ _ntuple_diskusage.used.__doc__ = 'Used space in bytes'
+ _ntuple_diskusage.free.__doc__ = 'Free space in bytes'
def disk_usage(path):
"""Return disk usage statistics about the given path.
diff --git a/Lib/site-packages/README.txt b/Lib/site-packages/README.txt
new file mode 100644
index 0000000..273f625
--- /dev/null
+++ b/Lib/site-packages/README.txt
@@ -0,0 +1,2 @@
+This directory exists so that 3rd party packages can be installed
+here. Read the source for site.py for more details.
diff --git a/Lib/sndhdr.py b/Lib/sndhdr.py
index e5901ec..7ecafb4 100644
--- a/Lib/sndhdr.py
+++ b/Lib/sndhdr.py
@@ -37,6 +37,18 @@
SndHeaders = namedtuple('SndHeaders',
'filetype framerate nchannels nframes sampwidth')
+SndHeaders.filetype.__doc__ = ("""The value for type indicates the data type
+and will be one of the strings 'aifc', 'aiff', 'au','hcom',
+'sndr', 'sndt', 'voc', 'wav', '8svx', 'sb', 'ub', or 'ul'.""")
+SndHeaders.framerate.__doc__ = ("""The sampling_rate will be either the actual
+value or 0 if unknown or difficult to decode.""")
+SndHeaders.nchannels.__doc__ = ("""The number of channels or 0 if it cannot be
+determined or if the value is difficult to decode.""")
+SndHeaders.nframes.__doc__ = ("""The value for frames will be either the number
+of frames or -1.""")
+SndHeaders.sampwidth.__doc__ = ("""Either the sample size in bits or
+'A' for A-LAW or 'U' for u-LAW.""")
+
def what(filename):
"""Guess the type of a sound file."""
res = whathdr(filename)
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py
index 502b061..4edb03f 100644
--- a/Lib/sre_compile.py
+++ b/Lib/sre_compile.py
@@ -409,57 +409,39 @@
table[i] = idx + 1
return table
-def _compile_info(code, pattern, flags):
- # internal: compile an info block. in the current version,
- # this contains min/max pattern width, and an optional literal
- # prefix or a character map
- lo, hi = pattern.getwidth()
- if hi > MAXCODE:
- hi = MAXCODE
- if lo == 0:
- code.extend([INFO, 4, 0, lo, hi])
- return
- # look for a literal prefix
+def _get_literal_prefix(pattern):
+ # look for literal prefix
prefix = []
prefixappend = prefix.append
- prefix_skip = 0
+ prefix_skip = None
+ got_all = True
+ for op, av in pattern.data:
+ if op is LITERAL:
+ prefixappend(av)
+ elif op is SUBPATTERN:
+ prefix1, prefix_skip1, got_all = _get_literal_prefix(av[1])
+ if prefix_skip is None:
+ if av[0] is not None:
+ prefix_skip = len(prefix)
+ elif prefix_skip1 is not None:
+ prefix_skip = len(prefix) + prefix_skip1
+ prefix.extend(prefix1)
+ if not got_all:
+ break
+ else:
+ got_all = False
+ break
+ return prefix, prefix_skip, got_all
+
+def _get_charset_prefix(pattern):
charset = [] # not used
charsetappend = charset.append
- if not (flags & SRE_FLAG_IGNORECASE):
- # look for literal prefix
- for op, av in pattern.data:
+ if pattern.data:
+ op, av = pattern.data[0]
+ if op is SUBPATTERN and av[1]:
+ op, av = av[1][0]
if op is LITERAL:
- if len(prefix) == prefix_skip:
- prefix_skip = prefix_skip + 1
- prefixappend(av)
- elif op is SUBPATTERN and len(av[1]) == 1:
- op, av = av[1][0]
- if op is LITERAL:
- prefixappend(av)
- else:
- break
- else:
- break
- # if no prefix, look for charset prefix
- if not prefix and pattern.data:
- op, av = pattern.data[0]
- if op is SUBPATTERN and av[1]:
- op, av = av[1][0]
- if op is LITERAL:
- charsetappend((op, av))
- elif op is BRANCH:
- c = []
- cappend = c.append
- for p in av[1]:
- if not p:
- break
- op, av = p[0]
- if op is LITERAL:
- cappend((op, av))
- else:
- break
- else:
- charset = c
+ charsetappend((op, av))
elif op is BRANCH:
c = []
cappend = c.append
@@ -473,8 +455,43 @@
break
else:
charset = c
- elif op is IN:
- charset = av
+ elif op is BRANCH:
+ c = []
+ cappend = c.append
+ for p in av[1]:
+ if not p:
+ break
+ op, av = p[0]
+ if op is LITERAL:
+ cappend((op, av))
+ else:
+ break
+ else:
+ charset = c
+ elif op is IN:
+ charset = av
+ return charset
+
+def _compile_info(code, pattern, flags):
+ # internal: compile an info block. in the current version,
+ # this contains min/max pattern width, and an optional literal
+ # prefix or a character map
+ lo, hi = pattern.getwidth()
+ if hi > MAXCODE:
+ hi = MAXCODE
+ if lo == 0:
+ code.extend([INFO, 4, 0, lo, hi])
+ return
+ # look for a literal prefix
+ prefix = []
+ prefix_skip = 0
+ charset = [] # not used
+ if not (flags & SRE_FLAG_IGNORECASE):
+ # look for literal prefix
+ prefix, prefix_skip, got_all = _get_literal_prefix(pattern)
+ # if no prefix, look for charset prefix
+ if not prefix:
+ charset = _get_charset_prefix(pattern)
## if prefix:
## print("*** PREFIX", prefix, prefix_skip)
## if charset:
@@ -487,7 +504,7 @@
mask = 0
if prefix:
mask = SRE_INFO_PREFIX
- if len(prefix) == prefix_skip == len(pattern.data):
+ if prefix_skip is None and got_all:
mask = mask | SRE_INFO_LITERAL
elif charset:
mask = mask | SRE_INFO_CHARSET
@@ -502,6 +519,8 @@
# add literal prefix
if prefix:
emit(len(prefix)) # length
+ if prefix_skip is None:
+ prefix_skip = len(prefix)
emit(prefix_skip) # skip
code.extend(prefix)
# generate overlap table
diff --git a/Lib/string.py b/Lib/string.py
index 62e8f2f..1add44b 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -112,10 +112,7 @@
# Check the most common path first.
named = mo.group('named') or mo.group('braced')
if named is not None:
- val = mapping[named]
- # We use this idiom instead of str() because the latter will
- # fail if val is a Unicode containing non-ASCII characters.
- return '%s' % (val,)
+ return str(mapping[named])
if mo.group('escaped') is not None:
return self.delimiter
if mo.group('invalid') is not None:
@@ -142,9 +139,7 @@
named = mo.group('named') or mo.group('braced')
if named is not None:
try:
- # We use this idiom instead of str() because the latter
- # will fail if val is a Unicode containing non-ASCII
- return '%s' % (mapping[named],)
+ return str(mapping[named])
except KeyError:
return mo.group()
if mo.group('escaped') is not None:
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index 63c3ae8..11deffc 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -281,7 +281,8 @@
with self.assertRaises(TypeError): self.EST.dst(5)
def test_tzname(self):
- self.assertEqual('UTC+00:00', timezone(ZERO).tzname(None))
+ self.assertEqual('UTC', timezone.utc.tzname(None))
+ self.assertEqual('UTC', timezone(ZERO).tzname(None))
self.assertEqual('UTC-05:00', timezone(-5 * HOUR).tzname(None))
self.assertEqual('UTC+09:30', timezone(9.5 * HOUR).tzname(None))
self.assertEqual('UTC-00:01', timezone(timedelta(minutes=-1)).tzname(None))
diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py
index e1e0d91..443ccd5 100644
--- a/Lib/test/eintrdata/eintr_tester.py
+++ b/Lib/test/eintrdata/eintr_tester.py
@@ -9,6 +9,7 @@
"""
import contextlib
+import faulthandler
import io
import os
import select
@@ -50,6 +51,9 @@
signal.setitimer(signal.ITIMER_REAL, cls.signal_delay,
cls.signal_period)
+ # Issue #25277: Use faulthandler to try to debug a hang on FreeBSD
+ faulthandler.dump_traceback_later(10 * 60, exit=True)
+
@classmethod
def stop_alarm(cls):
signal.setitimer(signal.ITIMER_REAL, 0, 0)
@@ -58,6 +62,7 @@
def tearDownClass(cls):
cls.stop_alarm()
signal.signal(signal.SIGALRM, cls.orig_handler)
+ faulthandler.cancel_dump_traceback_later()
@classmethod
def _sleep(cls):
diff --git a/Lib/test/libregrtest/__init__.py b/Lib/test/libregrtest/__init__.py
new file mode 100644
index 0000000..9f7b1c1
--- /dev/null
+++ b/Lib/test/libregrtest/__init__.py
@@ -0,0 +1,2 @@
+from test.libregrtest.cmdline import _parse_args, RESOURCE_NAMES
+from test.libregrtest.main import main, main_in_temp_cwd
diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py
new file mode 100644
index 0000000..a9cee6e
--- /dev/null
+++ b/Lib/test/libregrtest/cmdline.py
@@ -0,0 +1,344 @@
+import argparse
+import os
+import sys
+from test import support
+
+
+USAGE = """\
+python -m test [options] [test_name1 [test_name2 ...]]
+python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
+"""
+
+DESCRIPTION = """\
+Run Python regression tests.
+
+If no arguments or options are provided, finds all files matching
+the pattern "test_*" in the Lib/test subdirectory and runs
+them in alphabetical order (but see -M and -u, below, for exceptions).
+
+For more rigorous testing, it is useful to use the following
+command line:
+
+python -E -Wd -m test [options] [test_name1 ...]
+"""
+
+EPILOG = """\
+Additional option details:
+
+-r randomizes test execution order. You can use --randseed=int to provide a
+int seed value for the randomizer; this is useful for reproducing troublesome
+test orders.
+
+-s On the first invocation of regrtest using -s, the first test file found
+or the first test file given on the command line is run, and the name of
+the next test is recorded in a file named pynexttest. If run from the
+Python build directory, pynexttest is located in the 'build' subdirectory,
+otherwise it is located in tempfile.gettempdir(). On subsequent runs,
+the test in pynexttest is run, and the next test is written to pynexttest.
+When the last test has been run, pynexttest is deleted. In this way it
+is possible to single step through the test files. This is useful when
+doing memory analysis on the Python interpreter, which process tends to
+consume too many resources to run the full regression test non-stop.
+
+-S is used to continue running tests after an aborted run. It will
+maintain the order a standard run (ie, this assumes -r is not used).
+This is useful after the tests have prematurely stopped for some external
+reason and you want to start running from where you left off rather
+than starting from the beginning.
+
+-f reads the names of tests from the file given as f's argument, one
+or more test names per line. Whitespace is ignored. Blank lines and
+lines beginning with '#' are ignored. This is especially useful for
+whittling down failures involving interactions among tests.
+
+-L causes the leaks(1) command to be run just before exit if it exists.
+leaks(1) is available on Mac OS X and presumably on some other
+FreeBSD-derived systems.
+
+-R runs each test several times and examines sys.gettotalrefcount() to
+see if the test appears to be leaking references. The argument should
+be of the form stab:run:fname where 'stab' is the number of times the
+test is run to let gettotalrefcount settle down, 'run' is the number
+of times further it is run and 'fname' is the name of the file the
+reports are written to. These parameters all have defaults (5, 4 and
+"reflog.txt" respectively), and the minimal invocation is '-R :'.
+
+-M runs tests that require an exorbitant amount of memory. These tests
+typically try to ascertain containers keep working when containing more than
+2 billion objects, which only works on 64-bit systems. There are also some
+tests that try to exhaust the address space of the process, which only makes
+sense on 32-bit systems with at least 2Gb of memory. The passed-in memlimit,
+which is a string in the form of '2.5Gb', determines howmuch memory the
+tests will limit themselves to (but they may go slightly over.) The number
+shouldn't be more memory than the machine has (including swap memory). You
+should also keep in mind that swap memory is generally much, much slower
+than RAM, and setting memlimit to all available RAM or higher will heavily
+tax the machine. On the other hand, it is no use running these tests with a
+limit of less than 2.5Gb, and many require more than 20Gb. Tests that expect
+to use more than memlimit memory will be skipped. The big-memory tests
+generally run very, very long.
+
+-u is used to specify which special resource intensive tests to run,
+such as those requiring large file support or network connectivity.
+The argument is a comma-separated list of words indicating the
+resources to test. Currently only the following are defined:
+
+ all - Enable all special resources.
+
+ none - Disable all special resources (this is the default).
+
+ audio - Tests that use the audio device. (There are known
+ cases of broken audio drivers that can crash Python or
+ even the Linux kernel.)
+
+ curses - Tests that use curses and will modify the terminal's
+ state and output modes.
+
+ largefile - It is okay to run some test that may create huge
+ files. These tests can take a long time and may
+ consume >2GB of disk space temporarily.
+
+ network - It is okay to run tests that use external network
+ resource, e.g. testing SSL support for sockets.
+
+ decimal - Test the decimal module against a large suite that
+ verifies compliance with standards.
+
+ cpu - Used for certain CPU-heavy tests.
+
+ subprocess Run all tests for the subprocess module.
+
+ urlfetch - It is okay to download files required on testing.
+
+ gui - Run tests that require a running GUI.
+
+To enable all resources except one, use '-uall,-<resource>'. For
+example, to run all the tests except for the gui tests, give the
+option '-uall,-gui'.
+"""
+
+
+RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network',
+ 'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui')
+
+class _ArgParser(argparse.ArgumentParser):
+
+ def error(self, message):
+ super().error(message + "\nPass -h or --help for complete help.")
+
+
+def _create_parser():
+ # Set prog to prevent the uninformative "__main__.py" from displaying in
+ # error messages when using "python -m test ...".
+ parser = _ArgParser(prog='regrtest.py',
+ usage=USAGE,
+ description=DESCRIPTION,
+ epilog=EPILOG,
+ add_help=False,
+ formatter_class=argparse.RawDescriptionHelpFormatter)
+
+ # Arguments with this clause added to its help are described further in
+ # the epilog's "Additional option details" section.
+ more_details = ' See the section at bottom for more details.'
+
+ group = parser.add_argument_group('General options')
+ # We add help explicitly to control what argument group it renders under.
+ group.add_argument('-h', '--help', action='help',
+ help='show this help message and exit')
+ group.add_argument('--timeout', metavar='TIMEOUT', type=float,
+ help='dump the traceback and exit if a test takes '
+ 'more than TIMEOUT seconds; disabled if TIMEOUT '
+ 'is negative or equals to zero')
+ group.add_argument('--wait', action='store_true',
+ help='wait for user input, e.g., allow a debugger '
+ 'to be attached')
+ group.add_argument('--slaveargs', metavar='ARGS')
+ group.add_argument('-S', '--start', metavar='START',
+ help='the name of the test at which to start.' +
+ more_details)
+
+ group = parser.add_argument_group('Verbosity')
+ group.add_argument('-v', '--verbose', action='count',
+ help='run tests in verbose mode with output to stdout')
+ group.add_argument('-w', '--verbose2', action='store_true',
+ help='re-run failed tests in verbose mode')
+ group.add_argument('-W', '--verbose3', action='store_true',
+ help='display test output on failure')
+ group.add_argument('-q', '--quiet', action='store_true',
+ help='no output unless one or more tests fail')
+ group.add_argument('-o', '--slow', action='store_true', dest='print_slow',
+ help='print the slowest 10 tests')
+ group.add_argument('--header', action='store_true',
+ help='print header with interpreter info')
+
+ group = parser.add_argument_group('Selecting tests')
+ group.add_argument('-r', '--randomize', action='store_true',
+ help='randomize test execution order.' + more_details)
+ group.add_argument('--randseed', metavar='SEED',
+ dest='random_seed', type=int,
+ help='pass a random seed to reproduce a previous '
+ 'random run')
+ group.add_argument('-f', '--fromfile', metavar='FILE',
+ help='read names of tests to run from a file.' +
+ more_details)
+ group.add_argument('-x', '--exclude', action='store_true',
+ help='arguments are tests to *exclude*')
+ group.add_argument('-s', '--single', action='store_true',
+ help='single step through a set of tests.' +
+ more_details)
+ group.add_argument('-m', '--match', metavar='PAT',
+ dest='match_tests',
+ help='match test cases and methods with glob pattern PAT')
+ group.add_argument('-G', '--failfast', action='store_true',
+ help='fail as soon as a test fails (only with -v or -W)')
+ group.add_argument('-u', '--use', metavar='RES1,RES2,...',
+ action='append', type=resources_list,
+ help='specify which special resource intensive tests '
+ 'to run.' + more_details)
+ group.add_argument('-M', '--memlimit', metavar='LIMIT',
+ help='run very large memory-consuming tests.' +
+ more_details)
+ group.add_argument('--testdir', metavar='DIR',
+ type=relative_filename,
+ help='execute test files in the specified directory '
+ '(instead of the Python stdlib test suite)')
+
+ group = parser.add_argument_group('Special runs')
+ group.add_argument('-l', '--findleaks', action='store_true',
+ help='if GC is available detect tests that leak memory')
+ group.add_argument('-L', '--runleaks', action='store_true',
+ help='run the leaks(1) command just before exit.' +
+ more_details)
+ group.add_argument('-R', '--huntrleaks', metavar='RUNCOUNTS',
+ type=huntrleaks,
+ help='search for reference leaks (needs debug build, '
+ 'very slow).' + more_details)
+ group.add_argument('-j', '--multiprocess', metavar='PROCESSES',
+ dest='use_mp', type=int,
+ help='run PROCESSES processes at once')
+ group.add_argument('-T', '--coverage', action='store_true',
+ dest='trace',
+ help='turn on code coverage tracing using the trace '
+ 'module')
+ group.add_argument('-D', '--coverdir', metavar='DIR',
+ type=relative_filename,
+ help='directory where coverage files are put')
+ group.add_argument('-N', '--nocoverdir',
+ action='store_const', const=None, dest='coverdir',
+ help='put coverage files alongside modules')
+ group.add_argument('-t', '--threshold', metavar='THRESHOLD',
+ type=int,
+ help='call gc.set_threshold(THRESHOLD)')
+ group.add_argument('-n', '--nowindows', action='store_true',
+ help='suppress error message boxes on Windows')
+ group.add_argument('-F', '--forever', action='store_true',
+ help='run the specified tests in a loop, until an '
+ 'error happens')
+ group.add_argument('--list-tests', action='store_true',
+ help="only write the name of tests that will be run, "
+ "don't execute them")
+ group.add_argument('-P', '--pgo', dest='pgo', action='store_true',
+ help='enable Profile Guided Optimization training')
+
+ parser.add_argument('args', nargs=argparse.REMAINDER,
+ help=argparse.SUPPRESS)
+
+ return parser
+
+
+def relative_filename(string):
+ # CWD is replaced with a temporary dir before calling main(), so we
+ # join it with the saved CWD so it ends up where the user expects.
+ return os.path.join(support.SAVEDCWD, string)
+
+
+def huntrleaks(string):
+ args = string.split(':')
+ if len(args) not in (2, 3):
+ raise argparse.ArgumentTypeError(
+ 'needs 2 or 3 colon-separated arguments')
+ nwarmup = int(args[0]) if args[0] else 5
+ ntracked = int(args[1]) if args[1] else 4
+ fname = args[2] if len(args) > 2 and args[2] else 'reflog.txt'
+ return nwarmup, ntracked, fname
+
+
+def resources_list(string):
+ u = [x.lower() for x in string.split(',')]
+ for r in u:
+ if r == 'all' or r == 'none':
+ continue
+ if r[0] == '-':
+ r = r[1:]
+ if r not in RESOURCE_NAMES:
+ raise argparse.ArgumentTypeError('invalid resource: ' + r)
+ return u
+
+
+def _parse_args(args, **kwargs):
+ # Defaults
+ ns = argparse.Namespace(testdir=None, verbose=0, quiet=False,
+ exclude=False, single=False, randomize=False, fromfile=None,
+ findleaks=False, use_resources=None, trace=False, coverdir='coverage',
+ runleaks=False, huntrleaks=False, verbose2=False, print_slow=False,
+ random_seed=None, use_mp=None, verbose3=False, forever=False,
+ header=False, failfast=False, match_tests=None, pgo=False)
+ for k, v in kwargs.items():
+ if not hasattr(ns, k):
+ raise TypeError('%r is an invalid keyword argument '
+ 'for this function' % k)
+ setattr(ns, k, v)
+ if ns.use_resources is None:
+ ns.use_resources = []
+
+ parser = _create_parser()
+ parser.parse_args(args=args, namespace=ns)
+
+ if ns.single and ns.fromfile:
+ parser.error("-s and -f don't go together!")
+ if ns.use_mp and ns.trace:
+ parser.error("-T and -j don't go together!")
+ if ns.use_mp and ns.findleaks:
+ parser.error("-l and -j don't go together!")
+ if ns.failfast and not (ns.verbose or ns.verbose3):
+ parser.error("-G/--failfast needs either -v or -W")
+ if ns.pgo and (ns.verbose or ns.verbose2 or ns.verbose3):
+ parser.error("--pgo/-v don't go together!")
+
+ if ns.nowindows:
+ print("Warning: the --nowindows (-n) option is deprecated. "
+ "Use -vv to display assertions in stderr.", file=sys.stderr)
+
+ if ns.quiet:
+ ns.verbose = 0
+ if ns.timeout is not None:
+ if ns.timeout <= 0:
+ ns.timeout = None
+ if ns.use_mp is not None:
+ if ns.use_mp <= 0:
+ # Use all cores + extras for tests that like to sleep
+ ns.use_mp = 2 + (os.cpu_count() or 1)
+ if ns.use_mp == 1:
+ ns.use_mp = None
+ if ns.use:
+ for a in ns.use:
+ for r in a:
+ if r == 'all':
+ ns.use_resources[:] = RESOURCE_NAMES
+ continue
+ if r == 'none':
+ del ns.use_resources[:]
+ continue
+ remove = False
+ if r[0] == '-':
+ remove = True
+ r = r[1:]
+ if remove:
+ if r in ns.use_resources:
+ ns.use_resources.remove(r)
+ elif r not in ns.use_resources:
+ ns.use_resources.append(r)
+ if ns.random_seed is not None:
+ ns.randomize = True
+
+ return ns
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
new file mode 100644
index 0000000..aa95b21
--- /dev/null
+++ b/Lib/test/libregrtest/main.py
@@ -0,0 +1,451 @@
+import faulthandler
+import os
+import platform
+import random
+import re
+import sys
+import sysconfig
+import tempfile
+import textwrap
+from test.libregrtest.runtest import (
+ findtests, runtest,
+ STDTESTS, NOTTESTS, PASSED, FAILED, ENV_CHANGED, SKIPPED, RESOURCE_DENIED)
+from test.libregrtest.cmdline import _parse_args
+from test.libregrtest.setup import setup_tests
+from test import support
+try:
+ import gc
+except ImportError:
+ gc = None
+
+
+# When tests are run from the Python build directory, it is best practice
+# to keep the test files in a subfolder. This eases the cleanup of leftover
+# files using the "make distclean" command.
+if sysconfig.is_python_build():
+ TEMPDIR = os.path.join(sysconfig.get_config_var('srcdir'), 'build')
+else:
+ TEMPDIR = tempfile.gettempdir()
+TEMPDIR = os.path.abspath(TEMPDIR)
+
+
+class Regrtest:
+ """Execute a test suite.
+
+ This also parses command-line options and modifies its behavior
+ accordingly.
+
+ tests -- a list of strings containing test names (optional)
+ testdir -- the directory in which to look for tests (optional)
+
+ Users other than the Python test suite will certainly want to
+ specify testdir; if it's omitted, the directory containing the
+ Python test suite is searched for.
+
+ If the tests argument is omitted, the tests listed on the
+ command-line will be used. If that's empty, too, then all *.py
+ files beginning with test_ will be used.
+
+ The other default arguments (verbose, quiet, exclude,
+ single, randomize, findleaks, use_resources, trace, coverdir,
+ print_slow, and random_seed) allow programmers calling main()
+ directly to set the values that would normally be set by flags
+ on the command line.
+ """
+ def __init__(self):
+ # Namespace of command line options
+ self.ns = None
+
+ # tests
+ self.tests = []
+ self.selected = []
+
+ # test results
+ self.good = []
+ self.bad = []
+ self.skipped = []
+ self.resource_denieds = []
+ self.environment_changed = []
+ self.interrupted = False
+
+ # used by --slow
+ self.test_times = []
+
+ # used by --coverage, trace.Trace instance
+ self.tracer = None
+
+ # used by --findleaks, store for gc.garbage
+ self.found_garbage = []
+
+ # used to display the progress bar "[ 3/100]"
+ self.test_count = ''
+ self.test_count_width = 1
+
+ # used by --single
+ self.next_single_test = None
+ self.next_single_filename = None
+
+ def accumulate_result(self, test, result):
+ ok, test_time = result
+ self.test_times.append((test_time, test))
+ if ok == PASSED:
+ self.good.append(test)
+ elif ok == FAILED:
+ self.bad.append(test)
+ elif ok == ENV_CHANGED:
+ self.environment_changed.append(test)
+ elif ok == SKIPPED:
+ self.skipped.append(test)
+ elif ok == RESOURCE_DENIED:
+ self.skipped.append(test)
+ self.resource_denieds.append(test)
+
+ def display_progress(self, test_index, test):
+ if self.ns.quiet:
+ return
+ if self.bad and not self.ns.pgo:
+ fmt = "[{1:{0}}{2}/{3}] {4}"
+ else:
+ fmt = "[{1:{0}}{2}] {4}"
+ print(fmt.format(self.test_count_width, test_index,
+ self.test_count, len(self.bad), test),
+ flush=True)
+
+ def parse_args(self, kwargs):
+ ns = _parse_args(sys.argv[1:], **kwargs)
+
+ if ns.timeout and not hasattr(faulthandler, 'dump_traceback_later'):
+ print("Warning: The timeout option requires "
+ "faulthandler.dump_traceback_later", file=sys.stderr)
+ ns.timeout = None
+
+ if ns.threshold is not None and gc is None:
+ print('No GC available, ignore --threshold.', file=sys.stderr)
+ ns.threshold = None
+
+ if ns.findleaks:
+ if gc is not None:
+ # Uncomment the line below to report garbage that is not
+ # freeable by reference counting alone. By default only
+ # garbage that is not collectable by the GC is reported.
+ pass
+ #gc.set_debug(gc.DEBUG_SAVEALL)
+ else:
+ print('No GC available, disabling --findleaks',
+ file=sys.stderr)
+ ns.findleaks = False
+
+ # Strip .py extensions.
+ removepy(ns.args)
+
+ return ns
+
+ def find_tests(self, tests):
+ self.tests = tests
+
+ if self.ns.single:
+ self.next_single_filename = os.path.join(TEMPDIR, 'pynexttest')
+ try:
+ with open(self.next_single_filename, 'r') as fp:
+ next_test = fp.read().strip()
+ self.tests = [next_test]
+ except OSError:
+ pass
+
+ if self.ns.fromfile:
+ self.tests = []
+ with open(os.path.join(support.SAVEDCWD, self.ns.fromfile)) as fp:
+ count_pat = re.compile(r'\[\s*\d+/\s*\d+\]')
+ for line in fp:
+ line = count_pat.sub('', line)
+ guts = line.split() # assuming no test has whitespace in its name
+ if guts and not guts[0].startswith('#'):
+ self.tests.extend(guts)
+
+ removepy(self.tests)
+
+ stdtests = STDTESTS[:]
+ nottests = NOTTESTS.copy()
+ if self.ns.exclude:
+ for arg in self.ns.args:
+ if arg in stdtests:
+ stdtests.remove(arg)
+ nottests.add(arg)
+ self.ns.args = []
+
+ # if testdir is set, then we are not running the python tests suite, so
+ # don't add default tests to be executed or skipped (pass empty values)
+ if self.ns.testdir:
+ alltests = findtests(self.ns.testdir, list(), set())
+ else:
+ alltests = findtests(self.ns.testdir, stdtests, nottests)
+
+ self.selected = self.tests or self.ns.args or alltests
+ if self.ns.single:
+ self.selected = self.selected[:1]
+ try:
+ pos = alltests.index(self.selected[0])
+ self.next_single_test = alltests[pos + 1]
+ except IndexError:
+ pass
+
+ # Remove all the selected tests that precede start if it's set.
+ if self.ns.start:
+ try:
+ del self.selected[:self.selected.index(self.ns.start)]
+ except ValueError:
+ print("Couldn't find starting test (%s), using all tests"
+ % self.ns.start, file=sys.stderr)
+
+ if self.ns.randomize:
+ if self.ns.random_seed is None:
+ self.ns.random_seed = random.randrange(10000000)
+ random.seed(self.ns.random_seed)
+ random.shuffle(self.selected)
+
+ def list_tests(self):
+ for name in self.selected:
+ print(name)
+
+ def rerun_failed_tests(self):
+ self.ns.verbose = True
+ self.ns.failfast = False
+ self.ns.verbose3 = False
+ self.ns.match_tests = None
+
+ print("Re-running failed tests in verbose mode")
+ for test in self.bad[:]:
+ print("Re-running test %r in verbose mode" % test, flush=True)
+ try:
+ self.ns.verbose = True
+ ok = runtest(self.ns, test)
+ except KeyboardInterrupt:
+ # print a newline separate from the ^C
+ print()
+ break
+ else:
+ if ok[0] in {PASSED, ENV_CHANGED, SKIPPED, RESOURCE_DENIED}:
+ self.bad.remove(test)
+ else:
+ if self.bad:
+ print(count(len(self.bad), 'test'), "failed again:")
+ printlist(self.bad)
+
+ def display_result(self):
+ if self.interrupted:
+ # print a newline after ^C
+ print()
+ print("Test suite interrupted by signal SIGINT.")
+ executed = set(self.good) | set(self.bad) | set(self.skipped)
+ omitted = set(self.selected) - executed
+ print(count(len(omitted), "test"), "omitted:")
+ printlist(omitted)
+
+ # If running the test suite for PGO then no one cares about
+ # results.
+ if self.ns.pgo:
+ return
+
+ if self.good and not self.ns.quiet:
+ if (not self.bad
+ and not self.skipped
+ and not self.interrupted
+ and len(self.good) > 1):
+ print("All", end=' ')
+ print(count(len(self.good), "test"), "OK.")
+
+ if self.ns.print_slow:
+ self.test_times.sort(reverse=True)
+ print("10 slowest tests:")
+ for time, test in self.test_times[:10]:
+ print("%s: %.1fs" % (test, time))
+
+ if self.bad:
+ print(count(len(self.bad), "test"), "failed:")
+ printlist(self.bad)
+
+ if self.environment_changed:
+ print("{} altered the execution environment:".format(
+ count(len(self.environment_changed), "test")))
+ printlist(self.environment_changed)
+
+ if self.skipped and not self.ns.quiet:
+ print(count(len(self.skipped), "test"), "skipped:")
+ printlist(self.skipped)
+
+ def run_tests_sequential(self):
+ if self.ns.trace:
+ import trace
+ self.tracer = trace.Trace(trace=False, count=True)
+
+ save_modules = sys.modules.keys()
+
+ for test_index, test in enumerate(self.tests, 1):
+ self.display_progress(test_index, test)
+ if self.tracer:
+ # If we're tracing code coverage, then we don't exit with status
+ # if on a false return value from main.
+ cmd = ('result = runtest(self.ns, test); '
+ 'self.accumulate_result(test, result)')
+ self.tracer.runctx(cmd, globals=globals(), locals=vars())
+ else:
+ try:
+ result = runtest(self.ns, test)
+ self.accumulate_result(test, result)
+ except KeyboardInterrupt:
+ self.interrupted = True
+ break
+
+ if self.ns.findleaks:
+ gc.collect()
+ if gc.garbage:
+ print("Warning: test created", len(gc.garbage), end=' ')
+ print("uncollectable object(s).")
+ # move the uncollectable objects somewhere so we don't see
+ # them again
+ self.found_garbage.extend(gc.garbage)
+ del gc.garbage[:]
+
+ # Unload the newly imported modules (best effort finalization)
+ for module in sys.modules.keys():
+ if module not in save_modules and module.startswith("test."):
+ support.unload(module)
+
+ def _test_forever(self, tests):
+ while True:
+ for test in tests:
+ yield test
+ if self.bad:
+ return
+
+ def run_tests(self):
+ # For a partial run, we do not need to clutter the output.
+ if (self.ns.verbose
+ or self.ns.header
+ or not (self.ns.pgo or self.ns.quiet or self.ns.single
+ or self.tests or self.ns.args)):
+ # Print basic platform information
+ print("==", platform.python_implementation(), *sys.version.split())
+ print("== ", platform.platform(aliased=True),
+ "%s-endian" % sys.byteorder)
+ print("== ", "hash algorithm:", sys.hash_info.algorithm,
+ "64bit" if sys.maxsize > 2**32 else "32bit")
+ print("== ", os.getcwd())
+ print("Testing with flags:", sys.flags)
+
+ if self.ns.randomize:
+ print("Using random seed", self.ns.random_seed)
+
+ if self.ns.forever:
+ self.tests = self._test_forever(list(self.selected))
+ self.test_count = ''
+ self.test_count_width = 3
+ else:
+ self.tests = iter(self.selected)
+ self.test_count = '/{}'.format(len(self.selected))
+ self.test_count_width = len(self.test_count) - 1
+
+ if self.ns.use_mp:
+ from test.libregrtest.runtest_mp import run_tests_multiprocess
+ run_tests_multiprocess(self)
+ else:
+ self.run_tests_sequential()
+
+ def finalize(self):
+ if self.next_single_filename:
+ if self.next_single_test:
+ with open(self.next_single_filename, 'w') as fp:
+ fp.write(self.next_single_test + '\n')
+ else:
+ os.unlink(self.next_single_filename)
+
+ if self.tracer:
+ r = self.tracer.results()
+ r.write_results(show_missing=True, summary=True,
+ coverdir=self.ns.coverdir)
+
+ if self.ns.runleaks:
+ os.system("leaks %d" % os.getpid())
+
+ def main(self, tests=None, **kwargs):
+ self.ns = self.parse_args(kwargs)
+
+ if self.ns.slaveargs is not None:
+ from test.libregrtest.runtest_mp import run_tests_slave
+ run_tests_slave(self.ns.slaveargs)
+
+ if self.ns.wait:
+ input("Press any key to continue...")
+
+ setup_tests(self.ns)
+
+ self.find_tests(tests)
+
+ if self.ns.list_tests:
+ self.list_tests()
+ sys.exit(0)
+
+ self.run_tests()
+ self.display_result()
+
+ if self.ns.verbose2 and self.bad:
+ self.rerun_failed_tests()
+
+ self.finalize()
+ sys.exit(len(self.bad) > 0 or self.interrupted)
+
+
+def removepy(names):
+ if not names:
+ return
+ for idx, name in enumerate(names):
+ basename, ext = os.path.splitext(name)
+ if ext == '.py':
+ names[idx] = basename
+
+
+def count(n, word):
+ if n == 1:
+ return "%d %s" % (n, word)
+ else:
+ return "%d %ss" % (n, word)
+
+
+def printlist(x, width=70, indent=4):
+ """Print the elements of iterable x to stdout.
+
+ Optional arg width (default 70) is the maximum line length.
+ Optional arg indent (default 4) is the number of blanks with which to
+ begin each line.
+ """
+
+ blanks = ' ' * indent
+ # Print the sorted list: 'x' may be a '--random' list or a set()
+ print(textwrap.fill(' '.join(str(elt) for elt in sorted(x)), width,
+ initial_indent=blanks, subsequent_indent=blanks))
+
+
+def main(tests=None, **kwargs):
+ Regrtest().main(tests=tests, **kwargs)
+
+
+def main_in_temp_cwd():
+ """Run main() in a temporary working directory."""
+ if sysconfig.is_python_build():
+ try:
+ os.mkdir(TEMPDIR)
+ except FileExistsError:
+ pass
+
+ # Define a writable temp dir that will be used as cwd while running
+ # the tests. The name of the dir includes the pid to allow parallel
+ # testing (see the -j option).
+ test_cwd = 'test_python_{}'.format(os.getpid())
+ test_cwd = os.path.join(TEMPDIR, test_cwd)
+
+ # Run the tests in a context manager that temporarily changes the CWD to a
+ # temporary and writable directory. If it's not possible to create or
+ # change the CWD, the original CWD will be used. The original CWD is
+ # available from support.SAVEDCWD.
+ with support.temp_cwd(test_cwd, quiet=True):
+ main()
diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py
new file mode 100644
index 0000000..59dc49f
--- /dev/null
+++ b/Lib/test/libregrtest/refleak.py
@@ -0,0 +1,202 @@
+import errno
+import os
+import re
+import sys
+import warnings
+from inspect import isabstract
+from test import support
+
+
+try:
+ MAXFD = os.sysconf("SC_OPEN_MAX")
+except Exception:
+ MAXFD = 256
+
+
+def fd_count():
+ """Count the number of open file descriptors"""
+ if sys.platform.startswith(('linux', 'freebsd')):
+ try:
+ names = os.listdir("/proc/self/fd")
+ return len(names)
+ except FileNotFoundError:
+ pass
+
+ count = 0
+ for fd in range(MAXFD):
+ try:
+ # Prefer dup() over fstat(). fstat() can require input/output
+ # whereas dup() doesn't.
+ fd2 = os.dup(fd)
+ except OSError as e:
+ if e.errno != errno.EBADF:
+ raise
+ else:
+ os.close(fd2)
+ count += 1
+ return count
+
+
+def dash_R(the_module, test, indirect_test, huntrleaks):
+ """Run a test multiple times, looking for reference leaks.
+
+ Returns:
+ False if the test didn't leak references; True if we detected refleaks.
+ """
+ # This code is hackish and inelegant, but it seems to do the job.
+ import copyreg
+ import collections.abc
+
+ if not hasattr(sys, 'gettotalrefcount'):
+ raise Exception("Tracking reference leaks requires a debug build "
+ "of Python")
+
+ # Save current values for dash_R_cleanup() to restore.
+ fs = warnings.filters[:]
+ ps = copyreg.dispatch_table.copy()
+ pic = sys.path_importer_cache.copy()
+ try:
+ import zipimport
+ except ImportError:
+ zdc = None # Run unmodified on platforms without zipimport support
+ else:
+ zdc = zipimport._zip_directory_cache.copy()
+ abcs = {}
+ for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]:
+ if not isabstract(abc):
+ continue
+ for obj in abc.__subclasses__() + [abc]:
+ abcs[obj] = obj._abc_registry.copy()
+
+ nwarmup, ntracked, fname = huntrleaks
+ fname = os.path.join(support.SAVEDCWD, fname)
+ repcount = nwarmup + ntracked
+ rc_deltas = [0] * repcount
+ alloc_deltas = [0] * repcount
+ fd_deltas = [0] * repcount
+
+ print("beginning", repcount, "repetitions", file=sys.stderr)
+ print(("1234567890"*(repcount//10 + 1))[:repcount], file=sys.stderr,
+ flush=True)
+ # initialize variables to make pyflakes quiet
+ rc_before = alloc_before = fd_before = 0
+ for i in range(repcount):
+ indirect_test()
+ alloc_after, rc_after, fd_after = dash_R_cleanup(fs, ps, pic, zdc,
+ abcs)
+ print('.', end='', flush=True)
+ if i >= nwarmup:
+ rc_deltas[i] = rc_after - rc_before
+ alloc_deltas[i] = alloc_after - alloc_before
+ fd_deltas[i] = fd_after - fd_before
+ alloc_before = alloc_after
+ rc_before = rc_after
+ fd_before = fd_after
+ print(file=sys.stderr)
+ # These checkers return False on success, True on failure
+ def check_rc_deltas(deltas):
+ return any(deltas)
+ def check_alloc_deltas(deltas):
+ # At least 1/3rd of 0s
+ if 3 * deltas.count(0) < len(deltas):
+ return True
+ # Nothing else than 1s, 0s and -1s
+ if not set(deltas) <= {1,0,-1}:
+ return True
+ return False
+ failed = False
+ for deltas, item_name, checker in [
+ (rc_deltas, 'references', check_rc_deltas),
+ (alloc_deltas, 'memory blocks', check_alloc_deltas),
+ (fd_deltas, 'file descriptors', check_rc_deltas)]:
+ if checker(deltas):
+ msg = '%s leaked %s %s, sum=%s' % (
+ test, deltas[nwarmup:], item_name, sum(deltas))
+ print(msg, file=sys.stderr, flush=True)
+ with open(fname, "a") as refrep:
+ print(msg, file=refrep)
+ refrep.flush()
+ failed = True
+ return failed
+
+
+def dash_R_cleanup(fs, ps, pic, zdc, abcs):
+ import gc, copyreg
+ import _strptime, linecache
+ import urllib.parse, urllib.request, mimetypes, doctest
+ import struct, filecmp, collections.abc
+ from distutils.dir_util import _path_created
+ from weakref import WeakSet
+
+ # Clear the warnings registry, so they can be displayed again
+ for mod in sys.modules.values():
+ if hasattr(mod, '__warningregistry__'):
+ del mod.__warningregistry__
+
+ # Restore some original values.
+ warnings.filters[:] = fs
+ copyreg.dispatch_table.clear()
+ copyreg.dispatch_table.update(ps)
+ sys.path_importer_cache.clear()
+ sys.path_importer_cache.update(pic)
+ try:
+ import zipimport
+ except ImportError:
+ pass # Run unmodified on platforms without zipimport support
+ else:
+ zipimport._zip_directory_cache.clear()
+ zipimport._zip_directory_cache.update(zdc)
+
+ # clear type cache
+ sys._clear_type_cache()
+
+ # Clear ABC registries, restoring previously saved ABC registries.
+ for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]:
+ if not isabstract(abc):
+ continue
+ for obj in abc.__subclasses__() + [abc]:
+ obj._abc_registry = abcs.get(obj, WeakSet()).copy()
+ obj._abc_cache.clear()
+ obj._abc_negative_cache.clear()
+
+ # Flush standard output, so that buffered data is sent to the OS and
+ # associated Python objects are reclaimed.
+ for stream in (sys.stdout, sys.stderr, sys.__stdout__, sys.__stderr__):
+ if stream is not None:
+ stream.flush()
+
+ # Clear assorted module caches.
+ _path_created.clear()
+ re.purge()
+ _strptime._regex_cache.clear()
+ urllib.parse.clear_cache()
+ urllib.request.urlcleanup()
+ linecache.clearcache()
+ mimetypes._default_mime_types()
+ filecmp._cache.clear()
+ struct._clearcache()
+ doctest.master = None
+ try:
+ import ctypes
+ except ImportError:
+ # Don't worry about resetting the cache if ctypes is not supported
+ pass
+ else:
+ ctypes._reset_cache()
+
+ # Collect cyclic trash and read memory statistics immediately after.
+ func1 = sys.getallocatedblocks
+ func2 = sys.gettotalrefcount
+ gc.collect()
+ return func1(), func2(), fd_count()
+
+
+def warm_caches():
+ # char cache
+ s = bytes(range(256))
+ for i in range(256):
+ s[i:i+1]
+ # unicode cache
+ [chr(i) for i in range(256)]
+ # int cache
+ list(range(-5, 257))
diff --git a/Lib/test/libregrtest/runtest.py b/Lib/test/libregrtest/runtest.py
new file mode 100644
index 0000000..043f23c
--- /dev/null
+++ b/Lib/test/libregrtest/runtest.py
@@ -0,0 +1,242 @@
+import faulthandler
+import importlib
+import io
+import os
+import sys
+import time
+import traceback
+import unittest
+from test import support
+from test.libregrtest.refleak import dash_R
+from test.libregrtest.save_env import saved_test_environment
+
+
+# Test result constants.
+PASSED = 1
+FAILED = 0
+ENV_CHANGED = -1
+SKIPPED = -2
+RESOURCE_DENIED = -3
+INTERRUPTED = -4
+CHILD_ERROR = -5 # error in a child process
+
+
+# small set of tests to determine if we have a basically functioning interpreter
+# (i.e. if any of these fail, then anything else is likely to follow)
+STDTESTS = [
+ 'test_grammar',
+ 'test_opcodes',
+ 'test_dict',
+ 'test_builtin',
+ 'test_exceptions',
+ 'test_types',
+ 'test_unittest',
+ 'test_doctest',
+ 'test_doctest2',
+ 'test_support'
+]
+
+# set of tests that we don't want to be executed when using regrtest
+NOTTESTS = set()
+
+
+def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS):
+ """Return a list of all applicable test modules."""
+ testdir = findtestdir(testdir)
+ names = os.listdir(testdir)
+ tests = []
+ others = set(stdtests) | nottests
+ for name in names:
+ mod, ext = os.path.splitext(name)
+ if mod[:5] == "test_" and ext in (".py", "") and mod not in others:
+ tests.append(mod)
+ return stdtests + sorted(tests)
+
+
+def runtest(ns, test):
+ """Run a single test.
+
+ test -- the name of the test
+ verbose -- if true, print more messages
+ quiet -- if true, don't print 'skipped' messages (probably redundant)
+ huntrleaks -- run multiple times to test for leaks; requires a debug
+ build; a triple corresponding to -R's three arguments
+ output_on_failure -- if true, display test output on failure
+ timeout -- dump the traceback and exit if a test takes more than
+ timeout seconds
+ failfast, match_tests -- See regrtest command-line flags for these.
+ pgo -- if true, suppress any info irrelevant to a generating a PGO build
+
+ Returns the tuple result, test_time, where result is one of the constants:
+ INTERRUPTED KeyboardInterrupt when run under -j
+ RESOURCE_DENIED test skipped because resource denied
+ SKIPPED test skipped for some other reason
+ ENV_CHANGED test failed because it changed the execution environment
+ FAILED test failed
+ PASSED test passed
+ """
+
+ verbose = ns.verbose
+ quiet = ns.quiet
+ huntrleaks = ns.huntrleaks
+ output_on_failure = ns.verbose3
+ failfast = ns.failfast
+ match_tests = ns.match_tests
+ timeout = ns.timeout
+ pgo = ns.pgo
+
+ use_timeout = (timeout is not None)
+ if use_timeout:
+ faulthandler.dump_traceback_later(timeout, exit=True)
+ try:
+ support.match_tests = match_tests
+ if failfast:
+ support.failfast = True
+ if output_on_failure:
+ support.verbose = True
+
+ # Reuse the same instance to all calls to runtest(). Some
+ # tests keep a reference to sys.stdout or sys.stderr
+ # (eg. test_argparse).
+ if runtest.stringio is None:
+ stream = io.StringIO()
+ runtest.stringio = stream
+ else:
+ stream = runtest.stringio
+ stream.seek(0)
+ stream.truncate()
+
+ orig_stdout = sys.stdout
+ orig_stderr = sys.stderr
+ try:
+ sys.stdout = stream
+ sys.stderr = stream
+ result = runtest_inner(test, verbose, quiet, huntrleaks,
+ display_failure=False, pgo=pgo)
+ if result[0] == FAILED:
+ output = stream.getvalue()
+ orig_stderr.write(output)
+ orig_stderr.flush()
+ finally:
+ sys.stdout = orig_stdout
+ sys.stderr = orig_stderr
+ else:
+ support.verbose = verbose # Tell tests to be moderately quiet
+ result = runtest_inner(test, verbose, quiet, huntrleaks,
+ display_failure=not verbose, pgo=pgo)
+ return result
+ finally:
+ if use_timeout:
+ faulthandler.cancel_dump_traceback_later()
+ cleanup_test_droppings(test, verbose)
+runtest.stringio = None
+
+
+def runtest_inner(test, verbose, quiet,
+ huntrleaks=False, display_failure=True, *, pgo=False):
+ support.unload(test)
+
+ test_time = 0.0
+ refleak = False # True if the test leaked references.
+ try:
+ if test.startswith('test.'):
+ abstest = test
+ else:
+ # Always import it from the test package
+ abstest = 'test.' + test
+ with saved_test_environment(test, verbose, quiet, pgo=pgo) as environment:
+ start_time = time.time()
+ the_module = importlib.import_module(abstest)
+ # If the test has a test_main, that will run the appropriate
+ # tests. If not, use normal unittest test loading.
+ test_runner = getattr(the_module, "test_main", None)
+ if test_runner is None:
+ def test_runner():
+ loader = unittest.TestLoader()
+ tests = loader.loadTestsFromModule(the_module)
+ for error in loader.errors:
+ print(error, file=sys.stderr)
+ if loader.errors:
+ raise Exception("errors while loading tests")
+ support.run_unittest(tests)
+ test_runner()
+ if huntrleaks:
+ refleak = dash_R(the_module, test, test_runner, huntrleaks)
+ test_time = time.time() - start_time
+ except support.ResourceDenied as msg:
+ if not quiet and not pgo:
+ print(test, "skipped --", msg, flush=True)
+ return RESOURCE_DENIED, test_time
+ except unittest.SkipTest as msg:
+ if not quiet and not pgo:
+ print(test, "skipped --", msg, flush=True)
+ return SKIPPED, test_time
+ except KeyboardInterrupt:
+ raise
+ except support.TestFailed as msg:
+ if not pgo:
+ if display_failure:
+ print("test", test, "failed --", msg, file=sys.stderr,
+ flush=True)
+ else:
+ print("test", test, "failed", file=sys.stderr, flush=True)
+ return FAILED, test_time
+ except:
+ msg = traceback.format_exc()
+ if not pgo:
+ print("test", test, "crashed --", msg, file=sys.stderr,
+ flush=True)
+ return FAILED, test_time
+ else:
+ if refleak:
+ return FAILED, test_time
+ if environment.changed:
+ return ENV_CHANGED, test_time
+ return PASSED, test_time
+
+
+def cleanup_test_droppings(testname, verbose):
+ import shutil
+ import stat
+ import gc
+
+ # First kill any dangling references to open files etc.
+ # This can also issue some ResourceWarnings which would otherwise get
+ # triggered during the following test run, and possibly produce failures.
+ gc.collect()
+
+ # Try to clean up junk commonly left behind. While tests shouldn't leave
+ # any files or directories behind, when a test fails that can be tedious
+ # for it to arrange. The consequences can be especially nasty on Windows,
+ # since if a test leaves a file open, it cannot be deleted by name (while
+ # there's nothing we can do about that here either, we can display the
+ # name of the offending test, which is a real help).
+ for name in (support.TESTFN,
+ "db_home",
+ ):
+ if not os.path.exists(name):
+ continue
+
+ if os.path.isdir(name):
+ kind, nuker = "directory", shutil.rmtree
+ elif os.path.isfile(name):
+ kind, nuker = "file", os.unlink
+ else:
+ raise SystemError("os.path says %r exists but is neither "
+ "directory nor file" % name)
+
+ if verbose:
+ print("%r left behind %s %r" % (testname, kind, name))
+ try:
+ # if we have chmod, fix possible permissions problems
+ # that might prevent cleanup
+ if (hasattr(os, 'chmod')):
+ os.chmod(name, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
+ nuker(name)
+ except Exception as msg:
+ print(("%r left behind %s %r and it couldn't be "
+ "removed: %s" % (testname, kind, name, msg)), file=sys.stderr)
+
+
+def findtestdir(path=None):
+ return path or os.path.dirname(os.path.dirname(__file__)) or os.curdir
diff --git a/Lib/test/libregrtest/runtest_mp.py b/Lib/test/libregrtest/runtest_mp.py
new file mode 100644
index 0000000..4473db4
--- /dev/null
+++ b/Lib/test/libregrtest/runtest_mp.py
@@ -0,0 +1,224 @@
+import json
+import os
+import queue
+import sys
+import time
+import traceback
+import types
+from test import support
+try:
+ import threading
+except ImportError:
+ print("Multiprocess option requires thread support")
+ sys.exit(2)
+
+from test.libregrtest.runtest import runtest, INTERRUPTED, CHILD_ERROR
+from test.libregrtest.setup import setup_tests
+
+
+# Minimum duration of a test to display its duration or to mention that
+# the test is running in background
+PROGRESS_MIN_TIME = 30.0 # seconds
+
+# Display the running tests if nothing happened last N seconds
+PROGRESS_UPDATE = 60.0 # seconds
+
+
+def run_test_in_subprocess(testname, ns):
+ """Run the given test in a subprocess with --slaveargs.
+
+ ns is the option Namespace parsed from command-line arguments. regrtest
+ is invoked in a subprocess with the --slaveargs argument; when the
+ subprocess exits, its return code, stdout and stderr are returned as a
+ 3-tuple.
+ """
+ from subprocess import Popen, PIPE
+
+ ns_dict = vars(ns)
+ slaveargs = (ns_dict, testname)
+ slaveargs = json.dumps(slaveargs)
+
+ cmd = [sys.executable, *support.args_from_interpreter_flags(),
+ '-X', 'faulthandler',
+ '-m', 'test.regrtest',
+ '--slaveargs', slaveargs]
+ if ns.pgo:
+ cmd += ['--pgo']
+
+ # Running the child from the same working directory as regrtest's original
+ # invocation ensures that TEMPDIR for the child is the same when
+ # sysconfig.is_python_build() is true. See issue 15300.
+ popen = Popen(cmd,
+ stdout=PIPE, stderr=PIPE,
+ universal_newlines=True,
+ close_fds=(os.name != 'nt'),
+ cwd=support.SAVEDCWD)
+ with popen:
+ stdout, stderr = popen.communicate()
+ retcode = popen.wait()
+ return retcode, stdout, stderr
+
+
+def run_tests_slave(slaveargs):
+ ns_dict, testname = json.loads(slaveargs)
+ ns = types.SimpleNamespace(**ns_dict)
+
+ setup_tests(ns)
+
+ try:
+ result = runtest(ns, testname)
+ except KeyboardInterrupt:
+ result = INTERRUPTED, ''
+ except BaseException as e:
+ traceback.print_exc()
+ result = CHILD_ERROR, str(e)
+
+ print() # Force a newline (just in case)
+ print(json.dumps(result), flush=True)
+ sys.exit(0)
+
+
+# We do not use a generator so multiple threads can call next().
+class MultiprocessIterator:
+
+ """A thread-safe iterator over tests for multiprocess mode."""
+
+ def __init__(self, tests):
+ self.interrupted = False
+ self.lock = threading.Lock()
+ self.tests = tests
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ with self.lock:
+ if self.interrupted:
+ raise StopIteration('tests interrupted')
+ return next(self.tests)
+
+
+class MultiprocessThread(threading.Thread):
+ def __init__(self, pending, output, ns):
+ super().__init__()
+ self.pending = pending
+ self.output = output
+ self.ns = ns
+ self.current_test = None
+ self.start_time = None
+
+ def _runtest(self):
+ try:
+ test = next(self.pending)
+ except StopIteration:
+ self.output.put((None, None, None, None))
+ return True
+
+ try:
+ self.start_time = time.monotonic()
+ self.current_test = test
+
+ retcode, stdout, stderr = run_test_in_subprocess(test, self.ns)
+ finally:
+ self.current_test = None
+
+ stdout, _, result = stdout.strip().rpartition("\n")
+ if retcode != 0:
+ result = (CHILD_ERROR, "Exit code %s" % retcode)
+ self.output.put((test, stdout.rstrip(), stderr.rstrip(),
+ result))
+ return True
+
+ if not result:
+ self.output.put((None, None, None, None))
+ return True
+
+ result = json.loads(result)
+ self.output.put((test, stdout.rstrip(), stderr.rstrip(),
+ result))
+ return False
+
+ def run(self):
+ try:
+ stop = False
+ while not stop:
+ stop = self._runtest()
+ except BaseException:
+ self.output.put((None, None, None, None))
+ raise
+
+
+def run_tests_multiprocess(regrtest):
+ output = queue.Queue()
+ pending = MultiprocessIterator(regrtest.tests)
+
+ workers = [MultiprocessThread(pending, output, regrtest.ns)
+ for i in range(regrtest.ns.use_mp)]
+ for worker in workers:
+ worker.start()
+
+ def get_running(workers):
+ running = []
+ for worker in workers:
+ current_test = worker.current_test
+ if not current_test:
+ continue
+ dt = time.monotonic() - worker.start_time
+ if dt >= PROGRESS_MIN_TIME:
+ running.append('%s (%.0f sec)' % (current_test, dt))
+ return running
+
+ finished = 0
+ test_index = 1
+ timeout = max(PROGRESS_UPDATE, PROGRESS_MIN_TIME)
+ try:
+ while finished < regrtest.ns.use_mp:
+ try:
+ item = output.get(timeout=timeout)
+ except queue.Empty:
+ running = get_running(workers)
+ if running and not regrtest.ns.pgo:
+ print('running: %s' % ', '.join(running))
+ continue
+
+ test, stdout, stderr, result = item
+ if test is None:
+ finished += 1
+ continue
+ regrtest.accumulate_result(test, result)
+
+ # Display progress
+ text = test
+ ok, test_time = result
+ if (ok not in (CHILD_ERROR, INTERRUPTED)
+ and test_time >= PROGRESS_MIN_TIME
+ and not regrtest.ns.pgo):
+ text += ' (%.0f sec)' % test_time
+ running = get_running(workers)
+ if running and not regrtest.ns.pgo:
+ text += ' -- running: %s' % ', '.join(running)
+ regrtest.display_progress(test_index, text)
+
+ # Copy stdout and stderr from the child process
+ if stdout:
+ print(stdout, flush=True)
+ if stderr and not regrtest.ns.pgo:
+ print(stderr, file=sys.stderr, flush=True)
+
+ if result[0] == INTERRUPTED:
+ raise KeyboardInterrupt
+ if result[0] == CHILD_ERROR:
+ msg = "Child error on {}: {}".format(test, result[1])
+ raise Exception(msg)
+ test_index += 1
+ except KeyboardInterrupt:
+ regrtest.interrupted = True
+ pending.interrupted = True
+ print()
+
+ running = [worker.current_test for worker in workers]
+ running = list(filter(bool, running))
+ if running:
+ print("Waiting for %s" % ', '.join(running))
+ for worker in workers:
+ worker.join()
diff --git a/Lib/test/libregrtest/save_env.py b/Lib/test/libregrtest/save_env.py
new file mode 100644
index 0000000..90900a9
--- /dev/null
+++ b/Lib/test/libregrtest/save_env.py
@@ -0,0 +1,285 @@
+import builtins
+import locale
+import logging
+import os
+import shutil
+import sys
+import sysconfig
+import warnings
+from test import support
+try:
+ import threading
+except ImportError:
+ threading = None
+try:
+ import _multiprocessing, multiprocessing.process
+except ImportError:
+ multiprocessing = None
+
+
+# Unit tests are supposed to leave the execution environment unchanged
+# once they complete. But sometimes tests have bugs, especially when
+# tests fail, and the changes to environment go on to mess up other
+# tests. This can cause issues with buildbot stability, since tests
+# are run in random order and so problems may appear to come and go.
+# There are a few things we can save and restore to mitigate this, and
+# the following context manager handles this task.
+
+class saved_test_environment:
+ """Save bits of the test environment and restore them at block exit.
+
+ with saved_test_environment(testname, verbose, quiet):
+ #stuff
+
+ Unless quiet is True, a warning is printed to stderr if any of
+ the saved items was changed by the test. The attribute 'changed'
+ is initially False, but is set to True if a change is detected.
+
+ If verbose is more than 1, the before and after state of changed
+ items is also printed.
+ """
+
+ changed = False
+
+ def __init__(self, testname, verbose=0, quiet=False, *, pgo=False):
+ self.testname = testname
+ self.verbose = verbose
+ self.quiet = quiet
+ self.pgo = pgo
+
+ # To add things to save and restore, add a name XXX to the resources list
+ # and add corresponding get_XXX/restore_XXX functions. get_XXX should
+ # return the value to be saved and compared against a second call to the
+ # get function when test execution completes. restore_XXX should accept
+ # the saved value and restore the resource using it. It will be called if
+ # and only if a change in the value is detected.
+ #
+ # Note: XXX will have any '.' replaced with '_' characters when determining
+ # the corresponding method names.
+
+ resources = ('sys.argv', 'cwd', 'sys.stdin', 'sys.stdout', 'sys.stderr',
+ 'os.environ', 'sys.path', 'sys.path_hooks', '__import__',
+ 'warnings.filters', 'asyncore.socket_map',
+ 'logging._handlers', 'logging._handlerList', 'sys.gettrace',
+ 'sys.warnoptions',
+ # multiprocessing.process._cleanup() may release ref
+ # to a thread, so check processes first.
+ 'multiprocessing.process._dangling', 'threading._dangling',
+ 'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES',
+ 'files', 'locale', 'warnings.showwarning',
+ )
+
+ def get_sys_argv(self):
+ return id(sys.argv), sys.argv, sys.argv[:]
+ def restore_sys_argv(self, saved_argv):
+ sys.argv = saved_argv[1]
+ sys.argv[:] = saved_argv[2]
+
+ def get_cwd(self):
+ return os.getcwd()
+ def restore_cwd(self, saved_cwd):
+ os.chdir(saved_cwd)
+
+ def get_sys_stdout(self):
+ return sys.stdout
+ def restore_sys_stdout(self, saved_stdout):
+ sys.stdout = saved_stdout
+
+ def get_sys_stderr(self):
+ return sys.stderr
+ def restore_sys_stderr(self, saved_stderr):
+ sys.stderr = saved_stderr
+
+ def get_sys_stdin(self):
+ return sys.stdin
+ def restore_sys_stdin(self, saved_stdin):
+ sys.stdin = saved_stdin
+
+ def get_os_environ(self):
+ return id(os.environ), os.environ, dict(os.environ)
+ def restore_os_environ(self, saved_environ):
+ os.environ = saved_environ[1]
+ os.environ.clear()
+ os.environ.update(saved_environ[2])
+
+ def get_sys_path(self):
+ return id(sys.path), sys.path, sys.path[:]
+ def restore_sys_path(self, saved_path):
+ sys.path = saved_path[1]
+ sys.path[:] = saved_path[2]
+
+ def get_sys_path_hooks(self):
+ return id(sys.path_hooks), sys.path_hooks, sys.path_hooks[:]
+ def restore_sys_path_hooks(self, saved_hooks):
+ sys.path_hooks = saved_hooks[1]
+ sys.path_hooks[:] = saved_hooks[2]
+
+ def get_sys_gettrace(self):
+ return sys.gettrace()
+ def restore_sys_gettrace(self, trace_fxn):
+ sys.settrace(trace_fxn)
+
+ def get___import__(self):
+ return builtins.__import__
+ def restore___import__(self, import_):
+ builtins.__import__ = import_
+
+ def get_warnings_filters(self):
+ return id(warnings.filters), warnings.filters, warnings.filters[:]
+ def restore_warnings_filters(self, saved_filters):
+ warnings.filters = saved_filters[1]
+ warnings.filters[:] = saved_filters[2]
+
+ def get_asyncore_socket_map(self):
+ asyncore = sys.modules.get('asyncore')
+ # XXX Making a copy keeps objects alive until __exit__ gets called.
+ return asyncore and asyncore.socket_map.copy() or {}
+ def restore_asyncore_socket_map(self, saved_map):
+ asyncore = sys.modules.get('asyncore')
+ if asyncore is not None:
+ asyncore.close_all(ignore_all=True)
+ asyncore.socket_map.update(saved_map)
+
+ def get_shutil_archive_formats(self):
+ # we could call get_archives_formats() but that only returns the
+ # registry keys; we want to check the values too (the functions that
+ # are registered)
+ return shutil._ARCHIVE_FORMATS, shutil._ARCHIVE_FORMATS.copy()
+ def restore_shutil_archive_formats(self, saved):
+ shutil._ARCHIVE_FORMATS = saved[0]
+ shutil._ARCHIVE_FORMATS.clear()
+ shutil._ARCHIVE_FORMATS.update(saved[1])
+
+ def get_shutil_unpack_formats(self):
+ return shutil._UNPACK_FORMATS, shutil._UNPACK_FORMATS.copy()
+ def restore_shutil_unpack_formats(self, saved):
+ shutil._UNPACK_FORMATS = saved[0]
+ shutil._UNPACK_FORMATS.clear()
+ shutil._UNPACK_FORMATS.update(saved[1])
+
+ def get_logging__handlers(self):
+ # _handlers is a WeakValueDictionary
+ return id(logging._handlers), logging._handlers, logging._handlers.copy()
+ def restore_logging__handlers(self, saved_handlers):
+ # Can't easily revert the logging state
+ pass
+
+ def get_logging__handlerList(self):
+ # _handlerList is a list of weakrefs to handlers
+ return id(logging._handlerList), logging._handlerList, logging._handlerList[:]
+ def restore_logging__handlerList(self, saved_handlerList):
+ # Can't easily revert the logging state
+ pass
+
+ def get_sys_warnoptions(self):
+ return id(sys.warnoptions), sys.warnoptions, sys.warnoptions[:]
+ def restore_sys_warnoptions(self, saved_options):
+ sys.warnoptions = saved_options[1]
+ sys.warnoptions[:] = saved_options[2]
+
+ # Controlling dangling references to Thread objects can make it easier
+ # to track reference leaks.
+ def get_threading__dangling(self):
+ if not threading:
+ return None
+ # This copies the weakrefs without making any strong reference
+ return threading._dangling.copy()
+ def restore_threading__dangling(self, saved):
+ if not threading:
+ return
+ threading._dangling.clear()
+ threading._dangling.update(saved)
+
+ # Same for Process objects
+ def get_multiprocessing_process__dangling(self):
+ if not multiprocessing:
+ return None
+ # Unjoined process objects can survive after process exits
+ multiprocessing.process._cleanup()
+ # This copies the weakrefs without making any strong reference
+ return multiprocessing.process._dangling.copy()
+ def restore_multiprocessing_process__dangling(self, saved):
+ if not multiprocessing:
+ return
+ multiprocessing.process._dangling.clear()
+ multiprocessing.process._dangling.update(saved)
+
+ def get_sysconfig__CONFIG_VARS(self):
+ # make sure the dict is initialized
+ sysconfig.get_config_var('prefix')
+ return (id(sysconfig._CONFIG_VARS), sysconfig._CONFIG_VARS,
+ dict(sysconfig._CONFIG_VARS))
+ def restore_sysconfig__CONFIG_VARS(self, saved):
+ sysconfig._CONFIG_VARS = saved[1]
+ sysconfig._CONFIG_VARS.clear()
+ sysconfig._CONFIG_VARS.update(saved[2])
+
+ def get_sysconfig__INSTALL_SCHEMES(self):
+ return (id(sysconfig._INSTALL_SCHEMES), sysconfig._INSTALL_SCHEMES,
+ sysconfig._INSTALL_SCHEMES.copy())
+ def restore_sysconfig__INSTALL_SCHEMES(self, saved):
+ sysconfig._INSTALL_SCHEMES = saved[1]
+ sysconfig._INSTALL_SCHEMES.clear()
+ sysconfig._INSTALL_SCHEMES.update(saved[2])
+
+ def get_files(self):
+ return sorted(fn + ('/' if os.path.isdir(fn) else '')
+ for fn in os.listdir())
+ def restore_files(self, saved_value):
+ fn = support.TESTFN
+ if fn not in saved_value and (fn + '/') not in saved_value:
+ if os.path.isfile(fn):
+ support.unlink(fn)
+ elif os.path.isdir(fn):
+ support.rmtree(fn)
+
+ _lc = [getattr(locale, lc) for lc in dir(locale)
+ if lc.startswith('LC_')]
+ def get_locale(self):
+ pairings = []
+ for lc in self._lc:
+ try:
+ pairings.append((lc, locale.setlocale(lc, None)))
+ except (TypeError, ValueError):
+ continue
+ return pairings
+ def restore_locale(self, saved):
+ for lc, setting in saved:
+ locale.setlocale(lc, setting)
+
+ def get_warnings_showwarning(self):
+ return warnings.showwarning
+ def restore_warnings_showwarning(self, fxn):
+ warnings.showwarning = fxn
+
+ def resource_info(self):
+ for name in self.resources:
+ method_suffix = name.replace('.', '_')
+ get_name = 'get_' + method_suffix
+ restore_name = 'restore_' + method_suffix
+ yield name, getattr(self, get_name), getattr(self, restore_name)
+
+ def __enter__(self):
+ self.saved_values = dict((name, get()) for name, get, restore
+ in self.resource_info())
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ saved_values = self.saved_values
+ del self.saved_values
+ for name, get, restore in self.resource_info():
+ current = get()
+ original = saved_values.pop(name)
+ # Check for changes to the resource's value
+ if current != original:
+ self.changed = True
+ restore(original)
+ if not self.quiet and not self.pgo:
+ print("Warning -- {} was modified by {}".format(
+ name, self.testname),
+ file=sys.stderr)
+ if self.verbose > 1:
+ print(" Before: {}\n After: {} ".format(
+ original, current),
+ file=sys.stderr)
+ return False
diff --git a/Lib/test/libregrtest/setup.py b/Lib/test/libregrtest/setup.py
new file mode 100644
index 0000000..6e05c7e
--- /dev/null
+++ b/Lib/test/libregrtest/setup.py
@@ -0,0 +1,116 @@
+import atexit
+import faulthandler
+import os
+import signal
+import sys
+import unittest
+from test import support
+try:
+ import gc
+except ImportError:
+ gc = None
+
+from test.libregrtest.refleak import warm_caches
+
+
+def setup_tests(ns):
+ # Display the Python traceback on fatal errors (e.g. segfault)
+ faulthandler.enable(all_threads=True)
+
+ # Display the Python traceback on SIGALRM or SIGUSR1 signal
+ signals = []
+ if hasattr(signal, 'SIGALRM'):
+ signals.append(signal.SIGALRM)
+ if hasattr(signal, 'SIGUSR1'):
+ signals.append(signal.SIGUSR1)
+ for signum in signals:
+ faulthandler.register(signum, chain=True)
+
+ replace_stdout()
+ support.record_original_stdout(sys.stdout)
+
+ # Some times __path__ and __file__ are not absolute (e.g. while running from
+ # Lib/) and, if we change the CWD to run the tests in a temporary dir, some
+ # imports might fail. This affects only the modules imported before os.chdir().
+ # These modules are searched first in sys.path[0] (so '' -- the CWD) and if
+ # they are found in the CWD their __file__ and __path__ will be relative (this
+ # happens before the chdir). All the modules imported after the chdir, are
+ # not found in the CWD, and since the other paths in sys.path[1:] are absolute
+ # (site.py absolutize them), the __file__ and __path__ will be absolute too.
+ # Therefore it is necessary to absolutize manually the __file__ and __path__ of
+ # the packages to prevent later imports to fail when the CWD is different.
+ for module in sys.modules.values():
+ if hasattr(module, '__path__'):
+ module.__path__ = [os.path.abspath(path)
+ for path in module.__path__]
+ if hasattr(module, '__file__'):
+ module.__file__ = os.path.abspath(module.__file__)
+
+ # MacOSX (a.k.a. Darwin) has a default stack size that is too small
+ # for deeply recursive regular expressions. We see this as crashes in
+ # the Python test suite when running test_re.py and test_sre.py. The
+ # fix is to set the stack limit to 2048.
+ # This approach may also be useful for other Unixy platforms that
+ # suffer from small default stack limits.
+ if sys.platform == 'darwin':
+ try:
+ import resource
+ except ImportError:
+ pass
+ else:
+ soft, hard = resource.getrlimit(resource.RLIMIT_STACK)
+ newsoft = min(hard, max(soft, 1024*2048))
+ resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard))
+
+ if ns.huntrleaks:
+ unittest.BaseTestSuite._cleanup = False
+
+ # Avoid false positives due to various caches
+ # filling slowly with random data:
+ warm_caches()
+
+ if ns.memlimit is not None:
+ support.set_memlimit(ns.memlimit)
+
+ if ns.threshold is not None:
+ gc.set_threshold(ns.threshold)
+
+ try:
+ import msvcrt
+ except ImportError:
+ pass
+ else:
+ msvcrt.SetErrorMode(msvcrt.SEM_FAILCRITICALERRORS|
+ msvcrt.SEM_NOALIGNMENTFAULTEXCEPT|
+ msvcrt.SEM_NOGPFAULTERRORBOX|
+ msvcrt.SEM_NOOPENFILEERRORBOX)
+ try:
+ msvcrt.CrtSetReportMode
+ except AttributeError:
+ # release build
+ pass
+ else:
+ for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]:
+ if ns.verbose and ns.verbose >= 2:
+ msvcrt.CrtSetReportMode(m, msvcrt.CRTDBG_MODE_FILE)
+ msvcrt.CrtSetReportFile(m, msvcrt.CRTDBG_FILE_STDERR)
+ else:
+ msvcrt.CrtSetReportMode(m, 0)
+
+ support.use_resources = ns.use_resources
+
+
+def replace_stdout():
+ """Set stdout encoder error handler to backslashreplace (as stderr error
+ handler) to avoid UnicodeEncodeError when printing a traceback"""
+ stdout = sys.stdout
+ sys.stdout = open(stdout.fileno(), 'w',
+ encoding=stdout.encoding,
+ errors="backslashreplace",
+ closefd=False,
+ newline='\n')
+
+ def restore_stdout():
+ sys.stdout.close()
+ sys.stdout = stdout
+ atexit.register(restore_stdout)
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py
index afd6873..055bf28 100644
--- a/Lib/test/lock_tests.py
+++ b/Lib/test/lock_tests.py
@@ -7,6 +7,7 @@
from _thread import start_new_thread, TIMEOUT_MAX
import threading
import unittest
+import weakref
from test import support
@@ -198,6 +199,17 @@
self.assertFalse(results[0])
self.assertTimeout(results[1], 0.5)
+ def test_weakref_exists(self):
+ lock = self.locktype()
+ ref = weakref.ref(lock)
+ self.assertIsNotNone(ref())
+
+ def test_weakref_deleted(self):
+ lock = self.locktype()
+ ref = weakref.ref(lock)
+ del lock
+ self.assertIsNone(ref())
+
class LockTests(BaseLockTests):
"""
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
old mode 100755
new mode 100644
index c246fe0..fcc3937
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -6,1588 +6,12 @@
Run this script with -h or --help for documentation.
"""
-USAGE = """\
-python -m test [options] [test_name1 [test_name2 ...]]
-python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
-"""
-
-DESCRIPTION = """\
-Run Python regression tests.
-
-If no arguments or options are provided, finds all files matching
-the pattern "test_*" in the Lib/test subdirectory and runs
-them in alphabetical order (but see -M and -u, below, for exceptions).
-
-For more rigorous testing, it is useful to use the following
-command line:
-
-python -E -Wd -m test [options] [test_name1 ...]
-"""
-
-EPILOG = """\
-Additional option details:
-
--r randomizes test execution order. You can use --randseed=int to provide a
-int seed value for the randomizer; this is useful for reproducing troublesome
-test orders.
-
--s On the first invocation of regrtest using -s, the first test file found
-or the first test file given on the command line is run, and the name of
-the next test is recorded in a file named pynexttest. If run from the
-Python build directory, pynexttest is located in the 'build' subdirectory,
-otherwise it is located in tempfile.gettempdir(). On subsequent runs,
-the test in pynexttest is run, and the next test is written to pynexttest.
-When the last test has been run, pynexttest is deleted. In this way it
-is possible to single step through the test files. This is useful when
-doing memory analysis on the Python interpreter, which process tends to
-consume too many resources to run the full regression test non-stop.
-
--S is used to continue running tests after an aborted run. It will
-maintain the order a standard run (ie, this assumes -r is not used).
-This is useful after the tests have prematurely stopped for some external
-reason and you want to start running from where you left off rather
-than starting from the beginning.
-
--f reads the names of tests from the file given as f's argument, one
-or more test names per line. Whitespace is ignored. Blank lines and
-lines beginning with '#' are ignored. This is especially useful for
-whittling down failures involving interactions among tests.
-
--L causes the leaks(1) command to be run just before exit if it exists.
-leaks(1) is available on Mac OS X and presumably on some other
-FreeBSD-derived systems.
-
--R runs each test several times and examines sys.gettotalrefcount() to
-see if the test appears to be leaking references. The argument should
-be of the form stab:run:fname where 'stab' is the number of times the
-test is run to let gettotalrefcount settle down, 'run' is the number
-of times further it is run and 'fname' is the name of the file the
-reports are written to. These parameters all have defaults (5, 4 and
-"reflog.txt" respectively), and the minimal invocation is '-R :'.
-
--M runs tests that require an exorbitant amount of memory. These tests
-typically try to ascertain containers keep working when containing more than
-2 billion objects, which only works on 64-bit systems. There are also some
-tests that try to exhaust the address space of the process, which only makes
-sense on 32-bit systems with at least 2Gb of memory. The passed-in memlimit,
-which is a string in the form of '2.5Gb', determines howmuch memory the
-tests will limit themselves to (but they may go slightly over.) The number
-shouldn't be more memory than the machine has (including swap memory). You
-should also keep in mind that swap memory is generally much, much slower
-than RAM, and setting memlimit to all available RAM or higher will heavily
-tax the machine. On the other hand, it is no use running these tests with a
-limit of less than 2.5Gb, and many require more than 20Gb. Tests that expect
-to use more than memlimit memory will be skipped. The big-memory tests
-generally run very, very long.
-
--u is used to specify which special resource intensive tests to run,
-such as those requiring large file support or network connectivity.
-The argument is a comma-separated list of words indicating the
-resources to test. Currently only the following are defined:
-
- all - Enable all special resources.
-
- none - Disable all special resources (this is the default).
-
- audio - Tests that use the audio device. (There are known
- cases of broken audio drivers that can crash Python or
- even the Linux kernel.)
-
- curses - Tests that use curses and will modify the terminal's
- state and output modes.
-
- largefile - It is okay to run some test that may create huge
- files. These tests can take a long time and may
- consume >2GB of disk space temporarily.
-
- network - It is okay to run tests that use external network
- resource, e.g. testing SSL support for sockets.
-
- decimal - Test the decimal module against a large suite that
- verifies compliance with standards.
-
- cpu - Used for certain CPU-heavy tests.
-
- subprocess Run all tests for the subprocess module.
-
- urlfetch - It is okay to download files required on testing.
-
- gui - Run tests that require a running GUI.
-
-To enable all resources except one, use '-uall,-<resource>'. For
-example, to run all the tests except for the gui tests, give the
-option '-uall,-gui'.
-"""
-
# We import importlib *ASAP* in order to test #15386
import importlib
-import argparse
-import builtins
-import faulthandler
-import io
-import json
-import locale
-import logging
import os
-import platform
-import random
-import re
-import shutil
-import signal
import sys
-import sysconfig
-import tempfile
-import time
-import traceback
-import unittest
-import warnings
-from inspect import isabstract
-
-try:
- import threading
-except ImportError:
- threading = None
-try:
- import _multiprocessing, multiprocessing.process
-except ImportError:
- multiprocessing = None
-
-
-# Some times __path__ and __file__ are not absolute (e.g. while running from
-# Lib/) and, if we change the CWD to run the tests in a temporary dir, some
-# imports might fail. This affects only the modules imported before os.chdir().
-# These modules are searched first in sys.path[0] (so '' -- the CWD) and if
-# they are found in the CWD their __file__ and __path__ will be relative (this
-# happens before the chdir). All the modules imported after the chdir, are
-# not found in the CWD, and since the other paths in sys.path[1:] are absolute
-# (site.py absolutize them), the __file__ and __path__ will be absolute too.
-# Therefore it is necessary to absolutize manually the __file__ and __path__ of
-# the packages to prevent later imports to fail when the CWD is different.
-for module in sys.modules.values():
- if hasattr(module, '__path__'):
- module.__path__ = [os.path.abspath(path) for path in module.__path__]
- if hasattr(module, '__file__'):
- module.__file__ = os.path.abspath(module.__file__)
-
-
-# MacOSX (a.k.a. Darwin) has a default stack size that is too small
-# for deeply recursive regular expressions. We see this as crashes in
-# the Python test suite when running test_re.py and test_sre.py. The
-# fix is to set the stack limit to 2048.
-# This approach may also be useful for other Unixy platforms that
-# suffer from small default stack limits.
-if sys.platform == 'darwin':
- try:
- import resource
- except ImportError:
- pass
- else:
- soft, hard = resource.getrlimit(resource.RLIMIT_STACK)
- newsoft = min(hard, max(soft, 1024*2048))
- resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard))
-
-# Test result constants.
-PASSED = 1
-FAILED = 0
-ENV_CHANGED = -1
-SKIPPED = -2
-RESOURCE_DENIED = -3
-INTERRUPTED = -4
-CHILD_ERROR = -5 # error in a child process
-
-from test import support
-
-RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network',
- 'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui')
-
-# When tests are run from the Python build directory, it is best practice
-# to keep the test files in a subfolder. This eases the cleanup of leftover
-# files using the "make distclean" command.
-if sysconfig.is_python_build():
- TEMPDIR = os.path.join(sysconfig.get_config_var('srcdir'), 'build')
-else:
- TEMPDIR = tempfile.gettempdir()
-TEMPDIR = os.path.abspath(TEMPDIR)
-
-class _ArgParser(argparse.ArgumentParser):
-
- def error(self, message):
- super().error(message + "\nPass -h or --help for complete help.")
-
-def _create_parser():
- # Set prog to prevent the uninformative "__main__.py" from displaying in
- # error messages when using "python -m test ...".
- parser = _ArgParser(prog='regrtest.py',
- usage=USAGE,
- description=DESCRIPTION,
- epilog=EPILOG,
- add_help=False,
- formatter_class=argparse.RawDescriptionHelpFormatter)
-
- # Arguments with this clause added to its help are described further in
- # the epilog's "Additional option details" section.
- more_details = ' See the section at bottom for more details.'
-
- group = parser.add_argument_group('General options')
- # We add help explicitly to control what argument group it renders under.
- group.add_argument('-h', '--help', action='help',
- help='show this help message and exit')
- group.add_argument('--timeout', metavar='TIMEOUT', type=float,
- help='dump the traceback and exit if a test takes '
- 'more than TIMEOUT seconds; disabled if TIMEOUT '
- 'is negative or equals to zero')
- group.add_argument('--wait', action='store_true',
- help='wait for user input, e.g., allow a debugger '
- 'to be attached')
- group.add_argument('--slaveargs', metavar='ARGS')
- group.add_argument('-S', '--start', metavar='START',
- help='the name of the test at which to start.' +
- more_details)
-
- group = parser.add_argument_group('Verbosity')
- group.add_argument('-v', '--verbose', action='count',
- help='run tests in verbose mode with output to stdout')
- group.add_argument('-w', '--verbose2', action='store_true',
- help='re-run failed tests in verbose mode')
- group.add_argument('-W', '--verbose3', action='store_true',
- help='display test output on failure')
- group.add_argument('-q', '--quiet', action='store_true',
- help='no output unless one or more tests fail')
- group.add_argument('-o', '--slow', action='store_true', dest='print_slow',
- help='print the slowest 10 tests')
- group.add_argument('--header', action='store_true',
- help='print header with interpreter info')
-
- group = parser.add_argument_group('Selecting tests')
- group.add_argument('-r', '--randomize', action='store_true',
- help='randomize test execution order.' + more_details)
- group.add_argument('--randseed', metavar='SEED',
- dest='random_seed', type=int,
- help='pass a random seed to reproduce a previous '
- 'random run')
- group.add_argument('-f', '--fromfile', metavar='FILE',
- help='read names of tests to run from a file.' +
- more_details)
- group.add_argument('-x', '--exclude', action='store_true',
- help='arguments are tests to *exclude*')
- group.add_argument('-s', '--single', action='store_true',
- help='single step through a set of tests.' +
- more_details)
- group.add_argument('-m', '--match', metavar='PAT',
- dest='match_tests',
- help='match test cases and methods with glob pattern PAT')
- group.add_argument('-G', '--failfast', action='store_true',
- help='fail as soon as a test fails (only with -v or -W)')
- group.add_argument('-u', '--use', metavar='RES1,RES2,...',
- action='append', type=resources_list,
- help='specify which special resource intensive tests '
- 'to run.' + more_details)
- group.add_argument('-M', '--memlimit', metavar='LIMIT',
- help='run very large memory-consuming tests.' +
- more_details)
- group.add_argument('--testdir', metavar='DIR',
- type=relative_filename,
- help='execute test files in the specified directory '
- '(instead of the Python stdlib test suite)')
-
- group = parser.add_argument_group('Special runs')
- group.add_argument('-l', '--findleaks', action='store_true',
- help='if GC is available detect tests that leak memory')
- group.add_argument('-L', '--runleaks', action='store_true',
- help='run the leaks(1) command just before exit.' +
- more_details)
- group.add_argument('-R', '--huntrleaks', metavar='RUNCOUNTS',
- type=huntrleaks,
- help='search for reference leaks (needs debug build, '
- 'very slow).' + more_details)
- group.add_argument('-j', '--multiprocess', metavar='PROCESSES',
- dest='use_mp', type=int,
- help='run PROCESSES processes at once')
- group.add_argument('-T', '--coverage', action='store_true',
- dest='trace',
- help='turn on code coverage tracing using the trace '
- 'module')
- group.add_argument('-D', '--coverdir', metavar='DIR',
- type=relative_filename,
- help='directory where coverage files are put')
- group.add_argument('-N', '--nocoverdir',
- action='store_const', const=None, dest='coverdir',
- help='put coverage files alongside modules')
- group.add_argument('-t', '--threshold', metavar='THRESHOLD',
- type=int,
- help='call gc.set_threshold(THRESHOLD)')
- group.add_argument('-n', '--nowindows', action='store_true',
- help='suppress error message boxes on Windows')
- group.add_argument('-F', '--forever', action='store_true',
- help='run the specified tests in a loop, until an '
- 'error happens')
- group.add_argument('-P', '--pgo', dest='pgo', action='store_true',
- help='enable Profile Guided Optimization training')
-
- parser.add_argument('args', nargs=argparse.REMAINDER,
- help=argparse.SUPPRESS)
-
- return parser
-
-def relative_filename(string):
- # CWD is replaced with a temporary dir before calling main(), so we
- # join it with the saved CWD so it ends up where the user expects.
- return os.path.join(support.SAVEDCWD, string)
-
-def huntrleaks(string):
- args = string.split(':')
- if len(args) not in (2, 3):
- raise argparse.ArgumentTypeError(
- 'needs 2 or 3 colon-separated arguments')
- nwarmup = int(args[0]) if args[0] else 5
- ntracked = int(args[1]) if args[1] else 4
- fname = args[2] if len(args) > 2 and args[2] else 'reflog.txt'
- return nwarmup, ntracked, fname
-
-def resources_list(string):
- u = [x.lower() for x in string.split(',')]
- for r in u:
- if r == 'all' or r == 'none':
- continue
- if r[0] == '-':
- r = r[1:]
- if r not in RESOURCE_NAMES:
- raise argparse.ArgumentTypeError('invalid resource: ' + r)
- return u
-
-def _parse_args(args, **kwargs):
- # Defaults
- ns = argparse.Namespace(testdir=None, verbose=0, quiet=False,
- exclude=False, single=False, randomize=False, fromfile=None,
- findleaks=False, use_resources=None, trace=False, coverdir='coverage',
- runleaks=False, huntrleaks=False, verbose2=False, print_slow=False,
- random_seed=None, use_mp=None, verbose3=False, forever=False,
- header=False, failfast=False, match_tests=None, pgo=False)
- for k, v in kwargs.items():
- if not hasattr(ns, k):
- raise TypeError('%r is an invalid keyword argument '
- 'for this function' % k)
- setattr(ns, k, v)
- if ns.use_resources is None:
- ns.use_resources = []
-
- parser = _create_parser()
- parser.parse_args(args=args, namespace=ns)
-
- if ns.single and ns.fromfile:
- parser.error("-s and -f don't go together!")
- if ns.use_mp and ns.trace:
- parser.error("-T and -j don't go together!")
- if ns.use_mp and ns.findleaks:
- parser.error("-l and -j don't go together!")
- if ns.use_mp and ns.memlimit:
- parser.error("-M and -j don't go together!")
- if ns.failfast and not (ns.verbose or ns.verbose3):
- parser.error("-G/--failfast needs either -v or -W")
-
- if ns.quiet:
- ns.verbose = 0
- if ns.timeout is not None:
- if hasattr(faulthandler, 'dump_traceback_later'):
- if ns.timeout <= 0:
- ns.timeout = None
- else:
- print("Warning: The timeout option requires "
- "faulthandler.dump_traceback_later")
- ns.timeout = None
- if ns.use_mp is not None:
- if ns.use_mp <= 0:
- # Use all cores + extras for tests that like to sleep
- ns.use_mp = 2 + (os.cpu_count() or 1)
- if ns.use_mp == 1:
- ns.use_mp = None
- if ns.use:
- for a in ns.use:
- for r in a:
- if r == 'all':
- ns.use_resources[:] = RESOURCE_NAMES
- continue
- if r == 'none':
- del ns.use_resources[:]
- continue
- remove = False
- if r[0] == '-':
- remove = True
- r = r[1:]
- if remove:
- if r in ns.use_resources:
- ns.use_resources.remove(r)
- elif r not in ns.use_resources:
- ns.use_resources.append(r)
- if ns.random_seed is not None:
- ns.randomize = True
-
- return ns
-
-
-def run_test_in_subprocess(testname, ns):
- """Run the given test in a subprocess with --slaveargs.
-
- ns is the option Namespace parsed from command-line arguments. regrtest
- is invoked in a subprocess with the --slaveargs argument; when the
- subprocess exits, its return code, stdout and stderr are returned as a
- 3-tuple.
- """
- from subprocess import Popen, PIPE
- base_cmd = ([sys.executable] + support.args_from_interpreter_flags() +
- ['-X', 'faulthandler', '-m', 'test.regrtest'])
- # required to spawn a new process with PGO flag on/off
- if ns.pgo:
- base_cmd = base_cmd + ['--pgo']
- slaveargs = (
- (testname, ns.verbose, ns.quiet),
- dict(huntrleaks=ns.huntrleaks,
- use_resources=ns.use_resources,
- output_on_failure=ns.verbose3,
- timeout=ns.timeout, failfast=ns.failfast,
- match_tests=ns.match_tests, pgo=ns.pgo))
- # Running the child from the same working directory as regrtest's original
- # invocation ensures that TEMPDIR for the child is the same when
- # sysconfig.is_python_build() is true. See issue 15300.
- popen = Popen(base_cmd + ['--slaveargs', json.dumps(slaveargs)],
- stdout=PIPE, stderr=PIPE,
- universal_newlines=True,
- close_fds=(os.name != 'nt'),
- cwd=support.SAVEDCWD)
- stdout, stderr = popen.communicate()
- retcode = popen.wait()
- return retcode, stdout, stderr
-
-
-def main(tests=None, **kwargs):
- """Execute a test suite.
-
- This also parses command-line options and modifies its behavior
- accordingly.
-
- tests -- a list of strings containing test names (optional)
- testdir -- the directory in which to look for tests (optional)
-
- Users other than the Python test suite will certainly want to
- specify testdir; if it's omitted, the directory containing the
- Python test suite is searched for.
-
- If the tests argument is omitted, the tests listed on the
- command-line will be used. If that's empty, too, then all *.py
- files beginning with test_ will be used.
-
- The other default arguments (verbose, quiet, exclude,
- single, randomize, findleaks, use_resources, trace, coverdir,
- print_slow, and random_seed) allow programmers calling main()
- directly to set the values that would normally be set by flags
- on the command line.
- """
- # Display the Python traceback on fatal errors (e.g. segfault)
- faulthandler.enable(all_threads=True)
-
- # Display the Python traceback on SIGALRM or SIGUSR1 signal
- signals = []
- if hasattr(signal, 'SIGALRM'):
- signals.append(signal.SIGALRM)
- if hasattr(signal, 'SIGUSR1'):
- signals.append(signal.SIGUSR1)
- for signum in signals:
- faulthandler.register(signum, chain=True)
-
- replace_stdout()
-
- support.record_original_stdout(sys.stdout)
-
- ns = _parse_args(sys.argv[1:], **kwargs)
-
- if ns.huntrleaks:
- # Avoid false positives due to various caches
- # filling slowly with random data:
- warm_caches()
- if ns.memlimit is not None:
- support.set_memlimit(ns.memlimit)
- if ns.threshold is not None:
- import gc
- gc.set_threshold(ns.threshold)
- if ns.nowindows:
- print('The --nowindows (-n) option is deprecated. '
- 'Use -vv to display assertions in stderr.')
- try:
- import msvcrt
- except ImportError:
- pass
- else:
- msvcrt.SetErrorMode(msvcrt.SEM_FAILCRITICALERRORS|
- msvcrt.SEM_NOALIGNMENTFAULTEXCEPT|
- msvcrt.SEM_NOGPFAULTERRORBOX|
- msvcrt.SEM_NOOPENFILEERRORBOX)
- try:
- msvcrt.CrtSetReportMode
- except AttributeError:
- # release build
- pass
- else:
- for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]:
- if ns.verbose and ns.verbose >= 2:
- msvcrt.CrtSetReportMode(m, msvcrt.CRTDBG_MODE_FILE)
- msvcrt.CrtSetReportFile(m, msvcrt.CRTDBG_FILE_STDERR)
- else:
- msvcrt.CrtSetReportMode(m, 0)
- if ns.wait:
- input("Press any key to continue...")
-
- if ns.slaveargs is not None:
- args, kwargs = json.loads(ns.slaveargs)
- if kwargs.get('huntrleaks'):
- unittest.BaseTestSuite._cleanup = False
- try:
- result = runtest(*args, **kwargs)
- except KeyboardInterrupt:
- result = INTERRUPTED, ''
- except BaseException as e:
- traceback.print_exc()
- result = CHILD_ERROR, str(e)
- sys.stdout.flush()
- print() # Force a newline (just in case)
- print(json.dumps(result))
- sys.exit(0)
-
- good = []
- bad = []
- skipped = []
- resource_denieds = []
- environment_changed = []
- interrupted = False
-
- if ns.findleaks:
- try:
- import gc
- except ImportError:
- print('No GC available, disabling findleaks.')
- ns.findleaks = False
- else:
- # Uncomment the line below to report garbage that is not
- # freeable by reference counting alone. By default only
- # garbage that is not collectable by the GC is reported.
- #gc.set_debug(gc.DEBUG_SAVEALL)
- found_garbage = []
-
- if ns.huntrleaks:
- unittest.BaseTestSuite._cleanup = False
-
- if ns.single:
- filename = os.path.join(TEMPDIR, 'pynexttest')
- try:
- with open(filename, 'r') as fp:
- next_test = fp.read().strip()
- tests = [next_test]
- except OSError:
- pass
-
- if ns.fromfile:
- tests = []
- with open(os.path.join(support.SAVEDCWD, ns.fromfile)) as fp:
- count_pat = re.compile(r'\[\s*\d+/\s*\d+\]')
- for line in fp:
- line = count_pat.sub('', line)
- guts = line.split() # assuming no test has whitespace in its name
- if guts and not guts[0].startswith('#'):
- tests.extend(guts)
-
- # Strip .py extensions.
- removepy(ns.args)
- removepy(tests)
-
- stdtests = STDTESTS[:]
- nottests = NOTTESTS.copy()
- if ns.exclude:
- for arg in ns.args:
- if arg in stdtests:
- stdtests.remove(arg)
- nottests.add(arg)
- ns.args = []
-
- # For a partial run, we do not need to clutter the output.
- if (ns.verbose or ns.header or
- not (ns.pgo or ns.quiet or ns.single or tests or ns.args)):
- # Print basic platform information
- print("==", platform.python_implementation(), *sys.version.split())
- print("== ", platform.platform(aliased=True),
- "%s-endian" % sys.byteorder)
- print("== ", "hash algorithm:", sys.hash_info.algorithm,
- "64bit" if sys.maxsize > 2**32 else "32bit")
- print("== ", os.getcwd())
- print("Testing with flags:", sys.flags)
-
- # if testdir is set, then we are not running the python tests suite, so
- # don't add default tests to be executed or skipped (pass empty values)
- if ns.testdir:
- alltests = findtests(ns.testdir, list(), set())
- else:
- alltests = findtests(ns.testdir, stdtests, nottests)
-
- selected = tests or ns.args or alltests
- if ns.single:
- selected = selected[:1]
- try:
- next_single_test = alltests[alltests.index(selected[0])+1]
- except IndexError:
- next_single_test = None
- # Remove all the selected tests that precede start if it's set.
- if ns.start:
- try:
- del selected[:selected.index(ns.start)]
- except ValueError:
- print("Couldn't find starting test (%s), using all tests" % ns.start)
- if ns.randomize:
- if ns.random_seed is None:
- ns.random_seed = random.randrange(10000000)
- random.seed(ns.random_seed)
- print("Using random seed", ns.random_seed)
- random.shuffle(selected)
- if ns.trace:
- import trace, tempfile
- tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,
- tempfile.gettempdir()],
- trace=False, count=True)
-
- test_times = []
- support.verbose = ns.verbose # Tell tests to be moderately quiet
- support.use_resources = ns.use_resources
- save_modules = sys.modules.keys()
-
- def accumulate_result(test, result):
- ok, test_time = result
- test_times.append((test_time, test))
- if ok == PASSED:
- good.append(test)
- elif ok == FAILED:
- bad.append(test)
- elif ok == ENV_CHANGED:
- environment_changed.append(test)
- elif ok == SKIPPED:
- skipped.append(test)
- elif ok == RESOURCE_DENIED:
- skipped.append(test)
- resource_denieds.append(test)
-
- if ns.forever:
- def test_forever(tests=list(selected)):
- while True:
- for test in tests:
- yield test
- if bad:
- return
- tests = test_forever()
- test_count = ''
- test_count_width = 3
- else:
- tests = iter(selected)
- test_count = '/{}'.format(len(selected))
- test_count_width = len(test_count) - 1
-
- if ns.use_mp:
- try:
- from threading import Thread
- except ImportError:
- print("Multiprocess option requires thread support")
- sys.exit(2)
- from queue import Queue
- debug_output_pat = re.compile(r"\[\d+ refs, \d+ blocks\]$")
- output = Queue()
- pending = MultiprocessTests(tests)
- def work():
- # A worker thread.
- try:
- while True:
- try:
- test = next(pending)
- except StopIteration:
- output.put((None, None, None, None))
- return
- retcode, stdout, stderr = run_test_in_subprocess(test, ns)
- # Strip last refcount output line if it exists, since it
- # comes from the shutdown of the interpreter in the subcommand.
- stderr = debug_output_pat.sub("", stderr)
- stdout, _, result = stdout.strip().rpartition("\n")
- if retcode != 0:
- result = (CHILD_ERROR, "Exit code %s" % retcode)
- output.put((test, stdout.rstrip(), stderr.rstrip(), result))
- return
- if not result:
- output.put((None, None, None, None))
- return
- result = json.loads(result)
- output.put((test, stdout.rstrip(), stderr.rstrip(), result))
- except BaseException:
- output.put((None, None, None, None))
- raise
- workers = [Thread(target=work) for i in range(ns.use_mp)]
- for worker in workers:
- worker.start()
- finished = 0
- test_index = 1
- try:
- while finished < ns.use_mp:
- test, stdout, stderr, result = output.get()
- if test is None:
- finished += 1
- continue
- accumulate_result(test, result)
- if not ns.quiet:
- if bad and not ns.pgo:
- fmt = "[{1:{0}}{2}/{3}] {4}"
- else:
- fmt = "[{1:{0}}{2}] {4}"
- print(fmt.format(
- test_count_width, test_index, test_count,
- len(bad), test))
- if stdout:
- print(stdout)
- if stderr and not ns.pgo:
- print(stderr, file=sys.stderr)
- sys.stdout.flush()
- sys.stderr.flush()
- if result[0] == INTERRUPTED:
- raise KeyboardInterrupt
- if result[0] == CHILD_ERROR:
- raise Exception("Child error on {}: {}".format(test, result[1]))
- test_index += 1
- except KeyboardInterrupt:
- interrupted = True
- pending.interrupted = True
- for worker in workers:
- worker.join()
- else:
- for test_index, test in enumerate(tests, 1):
- if not ns.quiet:
- if bad and not ns.pgo:
- fmt = "[{1:{0}}{2}/{3}] {4}"
- else:
- fmt = "[{1:{0}}{2}] {4}"
- print(fmt.format(
- test_count_width, test_index, test_count, len(bad), test))
- sys.stdout.flush()
- if ns.trace:
- # If we're tracing code coverage, then we don't exit with status
- # if on a false return value from main.
- tracer.runctx('runtest(test, ns.verbose, ns.quiet, timeout=ns.timeout)',
- globals=globals(), locals=vars())
- else:
- try:
- result = runtest(test, ns.verbose, ns.quiet,
- ns.huntrleaks,
- output_on_failure=ns.verbose3,
- timeout=ns.timeout, failfast=ns.failfast,
- match_tests=ns.match_tests, pgo=ns.pgo)
- accumulate_result(test, result)
- except KeyboardInterrupt:
- interrupted = True
- break
- if ns.findleaks:
- gc.collect()
- if gc.garbage:
- print("Warning: test created", len(gc.garbage), end=' ')
- print("uncollectable object(s).")
- # move the uncollectable objects somewhere so we don't see
- # them again
- found_garbage.extend(gc.garbage)
- del gc.garbage[:]
- # Unload the newly imported modules (best effort finalization)
- for module in sys.modules.keys():
- if module not in save_modules and module.startswith("test."):
- support.unload(module)
-
- if interrupted and not ns.pgo:
- # print a newline after ^C
- print()
- print("Test suite interrupted by signal SIGINT.")
- omitted = set(selected) - set(good) - set(bad) - set(skipped)
- print(count(len(omitted), "test"), "omitted:")
- printlist(omitted)
- if good and not ns.quiet and not ns.pgo:
- if not bad and not skipped and not interrupted and len(good) > 1:
- print("All", end=' ')
- print(count(len(good), "test"), "OK.")
- if ns.print_slow:
- test_times.sort(reverse=True)
- print("10 slowest tests:")
- for time, test in test_times[:10]:
- print("%s: %.1fs" % (test, time))
- if bad and not ns.pgo:
- print(count(len(bad), "test"), "failed:")
- printlist(bad)
- if environment_changed and not ns.pgo:
- print("{} altered the execution environment:".format(
- count(len(environment_changed), "test")))
- printlist(environment_changed)
- if skipped and not ns.quiet and not ns.pgo:
- print(count(len(skipped), "test"), "skipped:")
- printlist(skipped)
-
- if ns.verbose2 and bad:
- print("Re-running failed tests in verbose mode")
- for test in bad[:]:
- if not ns.pgo:
- print("Re-running test %r in verbose mode" % test)
- sys.stdout.flush()
- try:
- ns.verbose = True
- ok = runtest(test, True, ns.quiet, ns.huntrleaks,
- timeout=ns.timeout, pgo=ns.pgo)
- except KeyboardInterrupt:
- # print a newline separate from the ^C
- print()
- break
- else:
- if ok[0] in {PASSED, ENV_CHANGED, SKIPPED, RESOURCE_DENIED}:
- bad.remove(test)
- else:
- if bad:
- print(count(len(bad), 'test'), "failed again:")
- printlist(bad)
-
- if ns.single:
- if next_single_test:
- with open(filename, 'w') as fp:
- fp.write(next_single_test + '\n')
- else:
- os.unlink(filename)
-
- if ns.trace:
- r = tracer.results()
- r.write_results(show_missing=True, summary=True, coverdir=ns.coverdir)
-
- if ns.runleaks:
- os.system("leaks %d" % os.getpid())
-
- sys.exit(len(bad) > 0 or interrupted)
-
-
-# small set of tests to determine if we have a basically functioning interpreter
-# (i.e. if any of these fail, then anything else is likely to follow)
-STDTESTS = [
- 'test_grammar',
- 'test_opcodes',
- 'test_dict',
- 'test_builtin',
- 'test_exceptions',
- 'test_types',
- 'test_unittest',
- 'test_doctest',
- 'test_doctest2',
- 'test_support'
-]
-
-# set of tests that we don't want to be executed when using regrtest
-NOTTESTS = set()
-
-def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS):
- """Return a list of all applicable test modules."""
- testdir = findtestdir(testdir)
- names = os.listdir(testdir)
- tests = []
- others = set(stdtests) | nottests
- for name in names:
- mod, ext = os.path.splitext(name)
- if mod[:5] == "test_" and ext in (".py", "") and mod not in others:
- tests.append(mod)
- return stdtests + sorted(tests)
-
-# We do not use a generator so multiple threads can call next().
-class MultiprocessTests(object):
-
- """A thread-safe iterator over tests for multiprocess mode."""
-
- def __init__(self, tests):
- self.interrupted = False
- self.lock = threading.Lock()
- self.tests = tests
-
- def __iter__(self):
- return self
-
- def __next__(self):
- with self.lock:
- if self.interrupted:
- raise StopIteration('tests interrupted')
- return next(self.tests)
-
-def replace_stdout():
- """Set stdout encoder error handler to backslashreplace (as stderr error
- handler) to avoid UnicodeEncodeError when printing a traceback"""
- import atexit
-
- stdout = sys.stdout
- sys.stdout = open(stdout.fileno(), 'w',
- encoding=stdout.encoding,
- errors="backslashreplace",
- closefd=False,
- newline='\n')
-
- def restore_stdout():
- sys.stdout.close()
- sys.stdout = stdout
- atexit.register(restore_stdout)
-
-def runtest(test, verbose, quiet,
- huntrleaks=False, use_resources=None,
- output_on_failure=False, failfast=False, match_tests=None,
- timeout=None, *, pgo=False):
- """Run a single test.
-
- test -- the name of the test
- verbose -- if true, print more messages
- quiet -- if true, don't print 'skipped' messages (probably redundant)
- huntrleaks -- run multiple times to test for leaks; requires a debug
- build; a triple corresponding to -R's three arguments
- use_resources -- list of extra resources to use
- output_on_failure -- if true, display test output on failure
- timeout -- dump the traceback and exit if a test takes more than
- timeout seconds
- failfast, match_tests -- See regrtest command-line flags for these.
- pgo -- if true, do not print unnecessary info when running the test
- for Profile Guided Optimization build
-
- Returns the tuple result, test_time, where result is one of the constants:
- INTERRUPTED KeyboardInterrupt when run under -j
- RESOURCE_DENIED test skipped because resource denied
- SKIPPED test skipped for some other reason
- ENV_CHANGED test failed because it changed the execution environment
- FAILED test failed
- PASSED test passed
- """
- if use_resources is not None:
- support.use_resources = use_resources
- use_timeout = (timeout is not None)
- if use_timeout:
- faulthandler.dump_traceback_later(timeout, exit=True)
- try:
- support.match_tests = match_tests
- if failfast:
- support.failfast = True
- if output_on_failure:
- support.verbose = True
-
- # Reuse the same instance to all calls to runtest(). Some
- # tests keep a reference to sys.stdout or sys.stderr
- # (eg. test_argparse).
- if runtest.stringio is None:
- stream = io.StringIO()
- runtest.stringio = stream
- else:
- stream = runtest.stringio
- stream.seek(0)
- stream.truncate()
-
- orig_stdout = sys.stdout
- orig_stderr = sys.stderr
- try:
- sys.stdout = stream
- sys.stderr = stream
- result = runtest_inner(test, verbose, quiet, huntrleaks,
- display_failure=False, pgo=pgo)
- if result[0] == FAILED and not pgo:
- output = stream.getvalue()
- orig_stderr.write(output)
- orig_stderr.flush()
- finally:
- sys.stdout = orig_stdout
- sys.stderr = orig_stderr
- else:
- support.verbose = verbose # Tell tests to be moderately quiet
- result = runtest_inner(test, verbose, quiet, huntrleaks,
- display_failure=not verbose, pgo=pgo)
- return result
- finally:
- if use_timeout:
- faulthandler.cancel_dump_traceback_later()
- cleanup_test_droppings(test, verbose)
-runtest.stringio = None
-
-# Unit tests are supposed to leave the execution environment unchanged
-# once they complete. But sometimes tests have bugs, especially when
-# tests fail, and the changes to environment go on to mess up other
-# tests. This can cause issues with buildbot stability, since tests
-# are run in random order and so problems may appear to come and go.
-# There are a few things we can save and restore to mitigate this, and
-# the following context manager handles this task.
-
-class saved_test_environment:
- """Save bits of the test environment and restore them at block exit.
-
- with saved_test_environment(testname, verbose, quiet):
- #stuff
-
- Unless quiet is True, a warning is printed to stderr if any of
- the saved items was changed by the test. The attribute 'changed'
- is initially False, but is set to True if a change is detected.
-
- If verbose is more than 1, the before and after state of changed
- items is also printed.
- """
-
- changed = False
-
- def __init__(self, testname, verbose=0, quiet=False, *, pgo=False):
- self.testname = testname
- self.verbose = verbose
- self.quiet = quiet
- self.pgo = pgo
-
- # To add things to save and restore, add a name XXX to the resources list
- # and add corresponding get_XXX/restore_XXX functions. get_XXX should
- # return the value to be saved and compared against a second call to the
- # get function when test execution completes. restore_XXX should accept
- # the saved value and restore the resource using it. It will be called if
- # and only if a change in the value is detected.
- #
- # Note: XXX will have any '.' replaced with '_' characters when determining
- # the corresponding method names.
-
- resources = ('sys.argv', 'cwd', 'sys.stdin', 'sys.stdout', 'sys.stderr',
- 'os.environ', 'sys.path', 'sys.path_hooks', '__import__',
- 'warnings.filters', 'asyncore.socket_map',
- 'logging._handlers', 'logging._handlerList', 'sys.gettrace',
- 'sys.warnoptions',
- # multiprocessing.process._cleanup() may release ref
- # to a thread, so check processes first.
- 'multiprocessing.process._dangling', 'threading._dangling',
- 'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES',
- 'files', 'locale', 'warnings.showwarning',
- )
-
- def get_sys_argv(self):
- return id(sys.argv), sys.argv, sys.argv[:]
- def restore_sys_argv(self, saved_argv):
- sys.argv = saved_argv[1]
- sys.argv[:] = saved_argv[2]
-
- def get_cwd(self):
- return os.getcwd()
- def restore_cwd(self, saved_cwd):
- os.chdir(saved_cwd)
-
- def get_sys_stdout(self):
- return sys.stdout
- def restore_sys_stdout(self, saved_stdout):
- sys.stdout = saved_stdout
-
- def get_sys_stderr(self):
- return sys.stderr
- def restore_sys_stderr(self, saved_stderr):
- sys.stderr = saved_stderr
-
- def get_sys_stdin(self):
- return sys.stdin
- def restore_sys_stdin(self, saved_stdin):
- sys.stdin = saved_stdin
-
- def get_os_environ(self):
- return id(os.environ), os.environ, dict(os.environ)
- def restore_os_environ(self, saved_environ):
- os.environ = saved_environ[1]
- os.environ.clear()
- os.environ.update(saved_environ[2])
-
- def get_sys_path(self):
- return id(sys.path), sys.path, sys.path[:]
- def restore_sys_path(self, saved_path):
- sys.path = saved_path[1]
- sys.path[:] = saved_path[2]
-
- def get_sys_path_hooks(self):
- return id(sys.path_hooks), sys.path_hooks, sys.path_hooks[:]
- def restore_sys_path_hooks(self, saved_hooks):
- sys.path_hooks = saved_hooks[1]
- sys.path_hooks[:] = saved_hooks[2]
-
- def get_sys_gettrace(self):
- return sys.gettrace()
- def restore_sys_gettrace(self, trace_fxn):
- sys.settrace(trace_fxn)
-
- def get___import__(self):
- return builtins.__import__
- def restore___import__(self, import_):
- builtins.__import__ = import_
-
- def get_warnings_filters(self):
- return id(warnings.filters), warnings.filters, warnings.filters[:]
- def restore_warnings_filters(self, saved_filters):
- warnings.filters = saved_filters[1]
- warnings.filters[:] = saved_filters[2]
-
- def get_asyncore_socket_map(self):
- asyncore = sys.modules.get('asyncore')
- # XXX Making a copy keeps objects alive until __exit__ gets called.
- return asyncore and asyncore.socket_map.copy() or {}
- def restore_asyncore_socket_map(self, saved_map):
- asyncore = sys.modules.get('asyncore')
- if asyncore is not None:
- asyncore.close_all(ignore_all=True)
- asyncore.socket_map.update(saved_map)
-
- def get_shutil_archive_formats(self):
- # we could call get_archives_formats() but that only returns the
- # registry keys; we want to check the values too (the functions that
- # are registered)
- return shutil._ARCHIVE_FORMATS, shutil._ARCHIVE_FORMATS.copy()
- def restore_shutil_archive_formats(self, saved):
- shutil._ARCHIVE_FORMATS = saved[0]
- shutil._ARCHIVE_FORMATS.clear()
- shutil._ARCHIVE_FORMATS.update(saved[1])
-
- def get_shutil_unpack_formats(self):
- return shutil._UNPACK_FORMATS, shutil._UNPACK_FORMATS.copy()
- def restore_shutil_unpack_formats(self, saved):
- shutil._UNPACK_FORMATS = saved[0]
- shutil._UNPACK_FORMATS.clear()
- shutil._UNPACK_FORMATS.update(saved[1])
-
- def get_logging__handlers(self):
- # _handlers is a WeakValueDictionary
- return id(logging._handlers), logging._handlers, logging._handlers.copy()
- def restore_logging__handlers(self, saved_handlers):
- # Can't easily revert the logging state
- pass
-
- def get_logging__handlerList(self):
- # _handlerList is a list of weakrefs to handlers
- return id(logging._handlerList), logging._handlerList, logging._handlerList[:]
- def restore_logging__handlerList(self, saved_handlerList):
- # Can't easily revert the logging state
- pass
-
- def get_sys_warnoptions(self):
- return id(sys.warnoptions), sys.warnoptions, sys.warnoptions[:]
- def restore_sys_warnoptions(self, saved_options):
- sys.warnoptions = saved_options[1]
- sys.warnoptions[:] = saved_options[2]
-
- # Controlling dangling references to Thread objects can make it easier
- # to track reference leaks.
- def get_threading__dangling(self):
- if not threading:
- return None
- # This copies the weakrefs without making any strong reference
- return threading._dangling.copy()
- def restore_threading__dangling(self, saved):
- if not threading:
- return
- threading._dangling.clear()
- threading._dangling.update(saved)
-
- # Same for Process objects
- def get_multiprocessing_process__dangling(self):
- if not multiprocessing:
- return None
- # Unjoined process objects can survive after process exits
- multiprocessing.process._cleanup()
- # This copies the weakrefs without making any strong reference
- return multiprocessing.process._dangling.copy()
- def restore_multiprocessing_process__dangling(self, saved):
- if not multiprocessing:
- return
- multiprocessing.process._dangling.clear()
- multiprocessing.process._dangling.update(saved)
-
- def get_sysconfig__CONFIG_VARS(self):
- # make sure the dict is initialized
- sysconfig.get_config_var('prefix')
- return (id(sysconfig._CONFIG_VARS), sysconfig._CONFIG_VARS,
- dict(sysconfig._CONFIG_VARS))
- def restore_sysconfig__CONFIG_VARS(self, saved):
- sysconfig._CONFIG_VARS = saved[1]
- sysconfig._CONFIG_VARS.clear()
- sysconfig._CONFIG_VARS.update(saved[2])
-
- def get_sysconfig__INSTALL_SCHEMES(self):
- return (id(sysconfig._INSTALL_SCHEMES), sysconfig._INSTALL_SCHEMES,
- sysconfig._INSTALL_SCHEMES.copy())
- def restore_sysconfig__INSTALL_SCHEMES(self, saved):
- sysconfig._INSTALL_SCHEMES = saved[1]
- sysconfig._INSTALL_SCHEMES.clear()
- sysconfig._INSTALL_SCHEMES.update(saved[2])
-
- def get_files(self):
- return sorted(fn + ('/' if os.path.isdir(fn) else '')
- for fn in os.listdir())
- def restore_files(self, saved_value):
- fn = support.TESTFN
- if fn not in saved_value and (fn + '/') not in saved_value:
- if os.path.isfile(fn):
- support.unlink(fn)
- elif os.path.isdir(fn):
- support.rmtree(fn)
-
- _lc = [getattr(locale, lc) for lc in dir(locale)
- if lc.startswith('LC_')]
- def get_locale(self):
- pairings = []
- for lc in self._lc:
- try:
- pairings.append((lc, locale.setlocale(lc, None)))
- except (TypeError, ValueError):
- continue
- return pairings
- def restore_locale(self, saved):
- for lc, setting in saved:
- locale.setlocale(lc, setting)
-
- def get_warnings_showwarning(self):
- return warnings.showwarning
- def restore_warnings_showwarning(self, fxn):
- warnings.showwarning = fxn
-
- def resource_info(self):
- for name in self.resources:
- method_suffix = name.replace('.', '_')
- get_name = 'get_' + method_suffix
- restore_name = 'restore_' + method_suffix
- yield name, getattr(self, get_name), getattr(self, restore_name)
-
- def __enter__(self):
- self.saved_values = dict((name, get()) for name, get, restore
- in self.resource_info())
- return self
-
- def __exit__(self, exc_type, exc_val, exc_tb):
- saved_values = self.saved_values
- del self.saved_values
- for name, get, restore in self.resource_info():
- current = get()
- original = saved_values.pop(name)
- # Check for changes to the resource's value
- if current != original:
- self.changed = True
- restore(original)
- if not self.quiet and not self.pgo:
- print("Warning -- {} was modified by {}".format(
- name, self.testname),
- file=sys.stderr)
- if self.verbose > 1 and not self.pgo:
- print(" Before: {}\n After: {} ".format(
- original, current),
- file=sys.stderr)
- return False
-
-
-def runtest_inner(test, verbose, quiet,
- huntrleaks=False, display_failure=True, pgo=False):
- support.unload(test)
-
- test_time = 0.0
- refleak = False # True if the test leaked references.
- try:
- if test.startswith('test.'):
- abstest = test
- else:
- # Always import it from the test package
- abstest = 'test.' + test
- with saved_test_environment(test, verbose, quiet, pgo=pgo) as environment:
- start_time = time.time()
- the_module = importlib.import_module(abstest)
- # If the test has a test_main, that will run the appropriate
- # tests. If not, use normal unittest test loading.
- test_runner = getattr(the_module, "test_main", None)
- if test_runner is None:
- def test_runner():
- loader = unittest.TestLoader()
- tests = loader.loadTestsFromModule(the_module)
- for error in loader.errors:
- print(error, file=sys.stderr)
- if loader.errors:
- raise Exception("errors while loading tests")
- support.run_unittest(tests)
- test_runner()
- if huntrleaks:
- refleak = dash_R(the_module, test, test_runner, huntrleaks)
- test_time = time.time() - start_time
- except support.ResourceDenied as msg:
- if not quiet and not pgo:
- print(test, "skipped --", msg)
- sys.stdout.flush()
- return RESOURCE_DENIED, test_time
- except unittest.SkipTest as msg:
- if not quiet and not pgo:
- print(test, "skipped --", msg)
- sys.stdout.flush()
- return SKIPPED, test_time
- except KeyboardInterrupt:
- raise
- except support.TestFailed as msg:
- if not pgo:
- if display_failure:
- print("test", test, "failed --", msg, file=sys.stderr)
- else:
- print("test", test, "failed", file=sys.stderr)
- sys.stderr.flush()
- return FAILED, test_time
- except:
- msg = traceback.format_exc()
- if not pgo:
- print("test", test, "crashed --", msg, file=sys.stderr)
- sys.stderr.flush()
- return FAILED, test_time
- else:
- if refleak:
- return FAILED, test_time
- if environment.changed:
- return ENV_CHANGED, test_time
- return PASSED, test_time
-
-def cleanup_test_droppings(testname, verbose):
- import shutil
- import stat
- import gc
-
- # First kill any dangling references to open files etc.
- # This can also issue some ResourceWarnings which would otherwise get
- # triggered during the following test run, and possibly produce failures.
- gc.collect()
-
- # Try to clean up junk commonly left behind. While tests shouldn't leave
- # any files or directories behind, when a test fails that can be tedious
- # for it to arrange. The consequences can be especially nasty on Windows,
- # since if a test leaves a file open, it cannot be deleted by name (while
- # there's nothing we can do about that here either, we can display the
- # name of the offending test, which is a real help).
- for name in (support.TESTFN,
- "db_home",
- ):
- if not os.path.exists(name):
- continue
-
- if os.path.isdir(name):
- kind, nuker = "directory", shutil.rmtree
- elif os.path.isfile(name):
- kind, nuker = "file", os.unlink
- else:
- raise SystemError("os.path says %r exists but is neither "
- "directory nor file" % name)
-
- if verbose:
- print("%r left behind %s %r" % (testname, kind, name))
- try:
- # if we have chmod, fix possible permissions problems
- # that might prevent cleanup
- if (hasattr(os, 'chmod')):
- os.chmod(name, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
- nuker(name)
- except Exception as msg:
- print(("%r left behind %s %r and it couldn't be "
- "removed: %s" % (testname, kind, name, msg)), file=sys.stderr)
-
-def dash_R(the_module, test, indirect_test, huntrleaks):
- """Run a test multiple times, looking for reference leaks.
-
- Returns:
- False if the test didn't leak references; True if we detected refleaks.
- """
- # This code is hackish and inelegant, but it seems to do the job.
- import copyreg
- import collections.abc
-
- if not hasattr(sys, 'gettotalrefcount'):
- raise Exception("Tracking reference leaks requires a debug build "
- "of Python")
-
- # Save current values for dash_R_cleanup() to restore.
- fs = warnings.filters[:]
- ps = copyreg.dispatch_table.copy()
- pic = sys.path_importer_cache.copy()
- try:
- import zipimport
- except ImportError:
- zdc = None # Run unmodified on platforms without zipimport support
- else:
- zdc = zipimport._zip_directory_cache.copy()
- abcs = {}
- for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]:
- if not isabstract(abc):
- continue
- for obj in abc.__subclasses__() + [abc]:
- abcs[obj] = obj._abc_registry.copy()
-
- nwarmup, ntracked, fname = huntrleaks
- fname = os.path.join(support.SAVEDCWD, fname)
- repcount = nwarmup + ntracked
- rc_deltas = [0] * repcount
- alloc_deltas = [0] * repcount
-
- print("beginning", repcount, "repetitions", file=sys.stderr)
- print(("1234567890"*(repcount//10 + 1))[:repcount], file=sys.stderr)
- sys.stderr.flush()
- for i in range(repcount):
- indirect_test()
- alloc_after, rc_after = dash_R_cleanup(fs, ps, pic, zdc, abcs)
- sys.stderr.write('.')
- sys.stderr.flush()
- if i >= nwarmup:
- rc_deltas[i] = rc_after - rc_before
- alloc_deltas[i] = alloc_after - alloc_before
- alloc_before, rc_before = alloc_after, rc_after
- print(file=sys.stderr)
- # These checkers return False on success, True on failure
- def check_rc_deltas(deltas):
- return any(deltas)
- def check_alloc_deltas(deltas):
- # At least 1/3rd of 0s
- if 3 * deltas.count(0) < len(deltas):
- return True
- # Nothing else than 1s, 0s and -1s
- if not set(deltas) <= {1,0,-1}:
- return True
- return False
- failed = False
- for deltas, item_name, checker in [
- (rc_deltas, 'references', check_rc_deltas),
- (alloc_deltas, 'memory blocks', check_alloc_deltas)]:
- if checker(deltas):
- msg = '%s leaked %s %s, sum=%s' % (
- test, deltas[nwarmup:], item_name, sum(deltas))
- print(msg, file=sys.stderr)
- sys.stderr.flush()
- with open(fname, "a") as refrep:
- print(msg, file=refrep)
- refrep.flush()
- failed = True
- return failed
-
-def dash_R_cleanup(fs, ps, pic, zdc, abcs):
- import gc, copyreg
- import _strptime, linecache
- import urllib.parse, urllib.request, mimetypes, doctest
- import struct, filecmp, collections.abc
- from distutils.dir_util import _path_created
- from weakref import WeakSet
-
- # Clear the warnings registry, so they can be displayed again
- for mod in sys.modules.values():
- if hasattr(mod, '__warningregistry__'):
- del mod.__warningregistry__
-
- # Restore some original values.
- warnings.filters[:] = fs
- copyreg.dispatch_table.clear()
- copyreg.dispatch_table.update(ps)
- sys.path_importer_cache.clear()
- sys.path_importer_cache.update(pic)
- try:
- import zipimport
- except ImportError:
- pass # Run unmodified on platforms without zipimport support
- else:
- zipimport._zip_directory_cache.clear()
- zipimport._zip_directory_cache.update(zdc)
-
- # clear type cache
- sys._clear_type_cache()
-
- # Clear ABC registries, restoring previously saved ABC registries.
- for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]:
- if not isabstract(abc):
- continue
- for obj in abc.__subclasses__() + [abc]:
- obj._abc_registry = abcs.get(obj, WeakSet()).copy()
- obj._abc_cache.clear()
- obj._abc_negative_cache.clear()
-
- # Flush standard output, so that buffered data is sent to the OS and
- # associated Python objects are reclaimed.
- for stream in (sys.stdout, sys.stderr, sys.__stdout__, sys.__stderr__):
- if stream is not None:
- stream.flush()
-
- # Clear assorted module caches.
- _path_created.clear()
- re.purge()
- _strptime._regex_cache.clear()
- urllib.parse.clear_cache()
- urllib.request.urlcleanup()
- linecache.clearcache()
- mimetypes._default_mime_types()
- filecmp._cache.clear()
- struct._clearcache()
- doctest.master = None
- try:
- import ctypes
- except ImportError:
- # Don't worry about resetting the cache if ctypes is not supported
- pass
- else:
- ctypes._reset_cache()
-
- # Collect cyclic trash and read memory statistics immediately after.
- func1 = sys.getallocatedblocks
- func2 = sys.gettotalrefcount
- gc.collect()
- return func1(), func2()
-
-def warm_caches():
- # char cache
- s = bytes(range(256))
- for i in range(256):
- s[i:i+1]
- # unicode cache
- x = [chr(i) for i in range(256)]
- # int cache
- x = list(range(-5, 257))
-
-def findtestdir(path=None):
- return path or os.path.dirname(__file__) or os.curdir
-
-def removepy(names):
- if not names:
- return
- for idx, name in enumerate(names):
- basename, ext = os.path.splitext(name)
- if ext == '.py':
- names[idx] = basename
-
-def count(n, word):
- if n == 1:
- return "%d %s" % (n, word)
- else:
- return "%d %ss" % (n, word)
-
-def printlist(x, width=70, indent=4):
- """Print the elements of iterable x to stdout.
-
- Optional arg width (default 70) is the maximum line length.
- Optional arg indent (default 4) is the number of blanks with which to
- begin each line.
- """
-
- from textwrap import fill
- blanks = ' ' * indent
- # Print the sorted list: 'x' may be a '--random' list or a set()
- print(fill(' '.join(str(elt) for elt in sorted(x)), width,
- initial_indent=blanks, subsequent_indent=blanks))
-
-
-def main_in_temp_cwd():
- """Run main() in a temporary working directory."""
- if sysconfig.is_python_build():
- try:
- os.mkdir(TEMPDIR)
- except FileExistsError:
- pass
-
- # Define a writable temp dir that will be used as cwd while running
- # the tests. The name of the dir includes the pid to allow parallel
- # testing (see the -j option).
- test_cwd = 'test_python_{}'.format(os.getpid())
- test_cwd = os.path.join(TEMPDIR, test_cwd)
-
- # Run the tests in a context manager that temporarily changes the CWD to a
- # temporary and writable directory. If it's not possible to create or
- # change the CWD, the original CWD will be used. The original CWD is
- # available from support.SAVEDCWD.
- with support.temp_cwd(test_cwd, quiet=True):
- main()
+from test.libregrtest import main, main_in_temp_cwd
if __name__ == '__main__':
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py
index 27bfad5..893ec39 100644
--- a/Lib/test/test_argparse.py
+++ b/Lib/test/test_argparse.py
@@ -4512,6 +4512,21 @@
string = "Namespace(bar='spam', foo=42)"
self.assertStringEqual(ns, string)
+ def test_namespace_starkwargs_notidentifier(self):
+ ns = argparse.Namespace(**{'"': 'quote'})
+ string = """Namespace(**{'"': 'quote'})"""
+ self.assertStringEqual(ns, string)
+
+ def test_namespace_kwargs_and_starkwargs_notidentifier(self):
+ ns = argparse.Namespace(a=1, **{'"': 'quote'})
+ string = """Namespace(a=1, **{'"': 'quote'})"""
+ self.assertStringEqual(ns, string)
+
+ def test_namespace_starkwargs_identifier(self):
+ ns = argparse.Namespace(**{'valid': True})
+ string = "Namespace(valid=True)"
+ self.assertStringEqual(ns, string)
+
def test_parser(self):
parser = argparse.ArgumentParser(prog='PROG')
string = (
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index cc1f11a..ff314b1 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -27,6 +27,7 @@
self.assertEqual(coder(input), (expect, len(input)))
return check
+
class Queue(object):
"""
queue: write bytes at one end, read bytes from the other end
@@ -47,6 +48,7 @@
self._buffer = self._buffer[size:]
return s
+
class MixInCheckStateHandling:
def check_state_handling_decode(self, encoding, u, s):
for i in range(len(s)+1):
@@ -80,6 +82,7 @@
part2 = d.encode(u[i:], True)
self.assertEqual(s, part1+part2)
+
class ReadTest(MixInCheckStateHandling):
def check_partial(self, input, partialresults):
# get a StreamReader for the encoding and feed the bytestring version
@@ -358,6 +361,12 @@
self.assertEqual("[\uDC80]".encode(self.encoding, "replace"),
"[?]".encode(self.encoding))
+ # sequential surrogate characters
+ self.assertEqual("[\uD800\uDC80]".encode(self.encoding, "ignore"),
+ "[]".encode(self.encoding))
+ self.assertEqual("[\uD800\uDC80]".encode(self.encoding, "replace"),
+ "[??]".encode(self.encoding))
+
bom = "".encode(self.encoding)
for before, after in [("\U00010fff", "A"), ("[", "]"),
("A", "\U00010fff")]:
@@ -383,6 +392,7 @@
self.assertEqual(test_sequence.decode(self.encoding, "backslashreplace"),
before + backslashreplace + after)
+
class UTF32Test(ReadTest, unittest.TestCase):
encoding = "utf-32"
if sys.byteorder == 'little':
@@ -478,6 +488,7 @@
self.assertEqual('\U00010000' * 1024,
codecs.utf_32_decode(encoded_be)[0])
+
class UTF32LETest(ReadTest, unittest.TestCase):
encoding = "utf-32-le"
ill_formed_sequence = b"\x80\xdc\x00\x00"
@@ -523,6 +534,7 @@
self.assertEqual('\U00010000' * 1024,
codecs.utf_32_le_decode(encoded)[0])
+
class UTF32BETest(ReadTest, unittest.TestCase):
encoding = "utf-32-be"
ill_formed_sequence = b"\x00\x00\xdc\x80"
@@ -747,6 +759,7 @@
encoding = "utf-8"
ill_formed_sequence = b"\xed\xb2\x80"
ill_formed_sequence_replace = "\ufffd" * 3
+ BOM = b''
def test_partial(self):
self.check_partial(
@@ -775,27 +788,49 @@
self.check_state_handling_decode(self.encoding,
u, u.encode(self.encoding))
+ def test_decode_error(self):
+ for data, error_handler, expected in (
+ (b'[\x80\xff]', 'ignore', '[]'),
+ (b'[\x80\xff]', 'replace', '[\ufffd\ufffd]'),
+ (b'[\x80\xff]', 'surrogateescape', '[\udc80\udcff]'),
+ (b'[\x80\xff]', 'backslashreplace', '[\\x80\\xff]'),
+ ):
+ with self.subTest(data=data, error_handler=error_handler,
+ expected=expected):
+ self.assertEqual(data.decode(self.encoding, error_handler),
+ expected)
+
def test_lone_surrogates(self):
super().test_lone_surrogates()
# not sure if this is making sense for
# UTF-16 and UTF-32
- self.assertEqual("[\uDC80]".encode('utf-8', "surrogateescape"),
- b'[\x80]')
+ self.assertEqual("[\uDC80]".encode(self.encoding, "surrogateescape"),
+ self.BOM + b'[\x80]')
+
+ with self.assertRaises(UnicodeEncodeError) as cm:
+ "[\uDC80\uD800\uDFFF]".encode(self.encoding, "surrogateescape")
+ exc = cm.exception
+ self.assertEqual(exc.object[exc.start:exc.end], '\uD800\uDFFF')
def test_surrogatepass_handler(self):
- self.assertEqual("abc\ud800def".encode("utf-8", "surrogatepass"),
- b"abc\xed\xa0\x80def")
- self.assertEqual(b"abc\xed\xa0\x80def".decode("utf-8", "surrogatepass"),
+ self.assertEqual("abc\ud800def".encode(self.encoding, "surrogatepass"),
+ self.BOM + b"abc\xed\xa0\x80def")
+ self.assertEqual("\U00010fff\uD800".encode(self.encoding, "surrogatepass"),
+ self.BOM + b"\xf0\x90\xbf\xbf\xed\xa0\x80")
+ self.assertEqual("[\uD800\uDC80]".encode(self.encoding, "surrogatepass"),
+ self.BOM + b'[\xed\xa0\x80\xed\xb2\x80]')
+
+ self.assertEqual(b"abc\xed\xa0\x80def".decode(self.encoding, "surrogatepass"),
"abc\ud800def")
- self.assertEqual("\U00010fff\uD800".encode("utf-8", "surrogatepass"),
- b"\xf0\x90\xbf\xbf\xed\xa0\x80")
- self.assertEqual(b"\xf0\x90\xbf\xbf\xed\xa0\x80".decode("utf-8", "surrogatepass"),
+ self.assertEqual(b"\xf0\x90\xbf\xbf\xed\xa0\x80".decode(self.encoding, "surrogatepass"),
"\U00010fff\uD800")
+
self.assertTrue(codecs.lookup_error("surrogatepass"))
with self.assertRaises(UnicodeDecodeError):
- b"abc\xed\xa0".decode("utf-8", "surrogatepass")
+ b"abc\xed\xa0".decode(self.encoding, "surrogatepass")
with self.assertRaises(UnicodeDecodeError):
- b"abc\xed\xa0z".decode("utf-8", "surrogatepass")
+ b"abc\xed\xa0z".decode(self.encoding, "surrogatepass")
+
@unittest.skipUnless(sys.platform == 'win32',
'cp65001 is a Windows-only codec')
@@ -1059,6 +1094,7 @@
class UTF8SigTest(UTF8Test, unittest.TestCase):
encoding = "utf-8-sig"
+ BOM = codecs.BOM_UTF8
def test_partial(self):
self.check_partial(
@@ -1194,6 +1230,7 @@
self.assertEqual(decode(br"[\x0]\x0", "ignore"), (b"[]", 8))
self.assertEqual(decode(br"[\x0]\x0", "replace"), (b"[?]?", 8))
+
class RecodingTest(unittest.TestCase):
def test_recoding(self):
f = io.BytesIO()
@@ -1313,6 +1350,7 @@
if len(i)!=2:
print(repr(i))
+
class PunycodeTest(unittest.TestCase):
def test_encode(self):
for uni, puny in punycode_testcases:
@@ -1332,6 +1370,7 @@
puny = puny.decode("ascii").encode("ascii")
self.assertEqual(uni, puny.decode("punycode"))
+
class UnicodeInternalTest(unittest.TestCase):
@unittest.skipUnless(SIZEOF_WCHAR_T == 4, 'specific to 32-bit wchar_t')
def test_bug1251300(self):
@@ -1586,6 +1625,7 @@
except Exception as e:
raise support.TestFailed("Test 3.%d: %s" % (pos+1, str(e)))
+
class IDNACodecTest(unittest.TestCase):
def test_builtin_decode(self):
self.assertEqual(str(b"python.org", "idna"), "python.org")
@@ -1672,6 +1712,7 @@
self.assertRaises(Exception,
b"python.org".decode, "idna", errors)
+
class CodecsModuleTest(unittest.TestCase):
def test_decode(self):
@@ -1780,6 +1821,7 @@
self.assertRaises(UnicodeError,
codecs.decode, b'abc', 'undefined', errors)
+
class StreamReaderTest(unittest.TestCase):
def setUp(self):
@@ -1790,6 +1832,7 @@
f = self.reader(self.stream)
self.assertEqual(f.readlines(), ['\ud55c\n', '\uae00'])
+
class EncodedFileTest(unittest.TestCase):
def test_basic(self):
@@ -1920,6 +1963,7 @@
"unicode_internal"
]
+
class BasicUnicodeTest(unittest.TestCase, MixInCheckStateHandling):
def test_basics(self):
s = "abc123" # all codecs should be able to encode these
@@ -2082,6 +2126,7 @@
self.check_state_handling_decode(encoding, u, u.encode(encoding))
self.check_state_handling_encode(encoding, u, u.encode(encoding))
+
class CharmapTest(unittest.TestCase):
def test_decode_with_string_map(self):
self.assertEqual(
@@ -2332,6 +2377,7 @@
info.streamwriter, 'strict') as srw:
self.assertEqual(srw.read(), "\xfc")
+
class TypesTest(unittest.TestCase):
def test_decode_unicode(self):
# Most decoders don't accept unicode input
@@ -2622,6 +2668,7 @@
bytes_transform_encodings.append("bz2_codec")
transform_aliases["bz2_codec"] = ["bz2"]
+
class TransformCodecTest(unittest.TestCase):
def test_basics(self):
@@ -3099,5 +3146,81 @@
self.assertEqual(decoded, ('abc', 3))
+class ASCIITest(unittest.TestCase):
+ def test_encode(self):
+ self.assertEqual('abc123'.encode('ascii'), b'abc123')
+
+ def test_encode_error(self):
+ for data, error_handler, expected in (
+ ('[\x80\xff\u20ac]', 'ignore', b'[]'),
+ ('[\x80\xff\u20ac]', 'replace', b'[???]'),
+ ('[\x80\xff\u20ac]', 'xmlcharrefreplace', b'[€ÿ€]'),
+ ('[\x80\xff\u20ac\U000abcde]', 'backslashreplace',
+ b'[\\x80\\xff\\u20ac\\U000abcde]'),
+ ('[\udc80\udcff]', 'surrogateescape', b'[\x80\xff]'),
+ ):
+ with self.subTest(data=data, error_handler=error_handler,
+ expected=expected):
+ self.assertEqual(data.encode('ascii', error_handler),
+ expected)
+
+ def test_encode_surrogateescape_error(self):
+ with self.assertRaises(UnicodeEncodeError):
+ # the first character can be decoded, but not the second
+ '\udc80\xff'.encode('ascii', 'surrogateescape')
+
+ def test_decode(self):
+ self.assertEqual(b'abc'.decode('ascii'), 'abc')
+
+ def test_decode_error(self):
+ for data, error_handler, expected in (
+ (b'[\x80\xff]', 'ignore', '[]'),
+ (b'[\x80\xff]', 'replace', '[\ufffd\ufffd]'),
+ (b'[\x80\xff]', 'surrogateescape', '[\udc80\udcff]'),
+ (b'[\x80\xff]', 'backslashreplace', '[\\x80\\xff]'),
+ ):
+ with self.subTest(data=data, error_handler=error_handler,
+ expected=expected):
+ self.assertEqual(data.decode('ascii', error_handler),
+ expected)
+
+
+class Latin1Test(unittest.TestCase):
+ def test_encode(self):
+ for data, expected in (
+ ('abc', b'abc'),
+ ('\x80\xe9\xff', b'\x80\xe9\xff'),
+ ):
+ with self.subTest(data=data, expected=expected):
+ self.assertEqual(data.encode('latin1'), expected)
+
+ def test_encode_errors(self):
+ for data, error_handler, expected in (
+ ('[\u20ac\udc80]', 'ignore', b'[]'),
+ ('[\u20ac\udc80]', 'replace', b'[??]'),
+ ('[\u20ac\U000abcde]', 'backslashreplace',
+ b'[\\u20ac\\U000abcde]'),
+ ('[\u20ac\udc80]', 'xmlcharrefreplace', b'[€�]'),
+ ('[\udc80\udcff]', 'surrogateescape', b'[\x80\xff]'),
+ ):
+ with self.subTest(data=data, error_handler=error_handler,
+ expected=expected):
+ self.assertEqual(data.encode('latin1', error_handler),
+ expected)
+
+ def test_encode_surrogateescape_error(self):
+ with self.assertRaises(UnicodeEncodeError):
+ # the first character can be decoded, but not the second
+ '\udc80\u20ac'.encode('latin1', 'surrogateescape')
+
+ def test_decode(self):
+ for data, expected in (
+ (b'abc', 'abc'),
+ (b'[\x80\xff]', '[\x80\xff]'),
+ ):
+ with self.subTest(data=data, expected=expected):
+ self.assertEqual(data.decode('latin1'), expected)
+
+
if __name__ == "__main__":
unittest.main()
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 4124f91..cd238bc 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -2002,6 +2002,14 @@
od = OrderedDict(**d)
self.assertGreater(sys.getsizeof(od), sys.getsizeof(d))
+ def test_views(self):
+ OrderedDict = self.module.OrderedDict
+ # See http://bugs.python.org/issue24286
+ s = 'the quick brown fox jumped over a lazy dog yesterday before dawn'.split()
+ od = OrderedDict.fromkeys(s)
+ self.assertEqual(od.keys(), dict(od).keys())
+ self.assertEqual(od.items(), dict(od).items())
+
def test_override_update(self):
OrderedDict = self.module.OrderedDict
# Verify that subclasses can override update() without breaking __init__()
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py
index 8718716..c61e80b 100644
--- a/Lib/test/test_deque.py
+++ b/Lib/test/test_deque.py
@@ -654,6 +654,15 @@
self.assertNotEqual(id(d), id(e))
self.assertEqual(list(d), list(e))
+ for i in range(5):
+ for maxlen in range(-1, 6):
+ s = [random.random() for j in range(i)]
+ d = deque(s) if maxlen == -1 else deque(s, maxlen)
+ e = d.copy()
+ self.assertEqual(d, e)
+ self.assertEqual(d.maxlen, e.maxlen)
+ self.assertTrue(all(x is y for x, y in zip(d, e)))
+
def test_copy_method(self):
mut = [10]
d = deque([mut])
diff --git a/Lib/test/test_dictviews.py b/Lib/test/test_dictviews.py
index 8d33801..fcb6814 100644
--- a/Lib/test/test_dictviews.py
+++ b/Lib/test/test_dictviews.py
@@ -1,3 +1,4 @@
+import collections
import unittest
class DictSetTest(unittest.TestCase):
@@ -197,6 +198,27 @@
d[42] = d.values()
self.assertRaises(RecursionError, repr, d)
+ def test_abc_registry(self):
+ d = dict(a=1)
+
+ self.assertIsInstance(d.keys(), collections.KeysView)
+ self.assertIsInstance(d.keys(), collections.MappingView)
+ self.assertIsInstance(d.keys(), collections.Set)
+ self.assertIsInstance(d.keys(), collections.Sized)
+ self.assertIsInstance(d.keys(), collections.Iterable)
+ self.assertIsInstance(d.keys(), collections.Container)
+
+ self.assertIsInstance(d.values(), collections.ValuesView)
+ self.assertIsInstance(d.values(), collections.MappingView)
+ self.assertIsInstance(d.values(), collections.Sized)
+
+ self.assertIsInstance(d.items(), collections.ItemsView)
+ self.assertIsInstance(d.items(), collections.MappingView)
+ self.assertIsInstance(d.items(), collections.Set)
+ self.assertIsInstance(d.items(), collections.Sized)
+ self.assertIsInstance(d.items(), collections.Iterable)
+ self.assertIsInstance(d.items(), collections.Container)
+
if __name__ == "__main__":
unittest.main()
diff --git a/Lib/test/test_eintr.py b/Lib/test/test_eintr.py
index aabad83..75452f2 100644
--- a/Lib/test/test_eintr.py
+++ b/Lib/test/test_eintr.py
@@ -16,14 +16,8 @@
# Run the tester in a sub-process, to make sure there is only one
# thread (for reliable signal delivery).
tester = support.findfile("eintr_tester.py", subdir="eintrdata")
-
- if support.verbose:
- args = [sys.executable, tester]
- with subprocess.Popen(args) as proc:
- exitcode = proc.wait()
- self.assertEqual(exitcode, 0)
- else:
- script_helper.assert_python_ok(tester)
+ # use -u to try to get the full output if the test hangs or crash
+ script_helper.assert_python_ok("-u", tester)
if __name__ == "__main__":
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py
index 4b5d0d0..0f7b769 100644
--- a/Lib/test/test_enum.py
+++ b/Lib/test/test_enum.py
@@ -270,6 +270,13 @@
class Wrong(Enum):
_any_name_ = 9
+ def test_bool(self):
+ class Logic(Enum):
+ true = True
+ false = False
+ self.assertTrue(Logic.true)
+ self.assertFalse(Logic.false)
+
def test_contains(self):
Season = self.Season
self.assertIn(Season.AUTUMN, Season)
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py
index 4e392b7..67c3d86 100644
--- a/Lib/test/test_file.py
+++ b/Lib/test/test_file.py
@@ -139,7 +139,7 @@
def testModeStrings(self):
# check invalid mode strings
- for mode in ("", "aU", "wU+"):
+ for mode in ("", "aU", "wU+", "U+", "+U", "rU+"):
try:
f = self.open(TESTFN, mode)
except ValueError:
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index 9b13632..9924fde 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -300,6 +300,8 @@
testcommon(b"%c", 7, b"\x07")
testcommon(b"%c", b"Z", b"Z")
testcommon(b"%c", bytearray(b"Z"), b"Z")
+ testcommon(b"%5c", 65, b" A")
+ testcommon(b"%-5c", 65, b"A ")
# %b will insert a series of bytes, either from a type that supports
# the Py_buffer protocol, or something that has a __bytes__ method
class FakeBytes(object):
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
new file mode 100644
index 0000000..d6f781c
--- /dev/null
+++ b/Lib/test/test_fstring.py
@@ -0,0 +1,734 @@
+import ast
+import types
+import decimal
+import unittest
+
+a_global = 'global variable'
+
+# You could argue that I'm too strict in looking for specific error
+# values with assertRaisesRegex, but without it it's way too easy to
+# make a syntax error in the test strings. Especially with all of the
+# triple quotes, raw strings, backslashes, etc. I think it's a
+# worthwhile tradeoff. When I switched to this method, I found many
+# examples where I wasn't testing what I thought I was.
+
+class TestCase(unittest.TestCase):
+ def assertAllRaise(self, exception_type, regex, error_strings):
+ for str in error_strings:
+ with self.subTest(str=str):
+ with self.assertRaisesRegex(exception_type, regex):
+ eval(str)
+
+ def test__format__lookup(self):
+ # Make sure __format__ is looked up on the type, not the instance.
+ class X:
+ def __format__(self, spec):
+ return 'class'
+
+ x = X()
+
+ # Add a bound __format__ method to the 'y' instance, but not
+ # the 'x' instance.
+ y = X()
+ y.__format__ = types.MethodType(lambda self, spec: 'instance', y)
+
+ self.assertEqual(f'{y}', format(y))
+ self.assertEqual(f'{y}', 'class')
+ self.assertEqual(format(x), format(y))
+
+ # __format__ is not called this way, but still make sure it
+ # returns what we expect (so we can make sure we're bypassing
+ # it).
+ self.assertEqual(x.__format__(''), 'class')
+ self.assertEqual(y.__format__(''), 'instance')
+
+ # This is how __format__ is actually called.
+ self.assertEqual(type(x).__format__(x, ''), 'class')
+ self.assertEqual(type(y).__format__(y, ''), 'class')
+
+ def test_ast(self):
+ # Inspired by http://bugs.python.org/issue24975
+ class X:
+ def __init__(self):
+ self.called = False
+ def __call__(self):
+ self.called = True
+ return 4
+ x = X()
+ expr = """
+a = 10
+f'{a * x()}'"""
+ t = ast.parse(expr)
+ c = compile(t, '', 'exec')
+
+ # Make sure x was not called.
+ self.assertFalse(x.called)
+
+ # Actually run the code.
+ exec(c)
+
+ # Make sure x was called.
+ self.assertTrue(x.called)
+
+ def test_literal_eval(self):
+ # With no expressions, an f-string is okay.
+ self.assertEqual(ast.literal_eval("f'x'"), 'x')
+ self.assertEqual(ast.literal_eval("f'x' 'y'"), 'xy')
+
+ # But this should raise an error.
+ with self.assertRaisesRegex(ValueError, 'malformed node or string'):
+ ast.literal_eval("f'x{3}'")
+
+ # As should this, which uses a different ast node
+ with self.assertRaisesRegex(ValueError, 'malformed node or string'):
+ ast.literal_eval("f'{3}'")
+
+ def test_ast_compile_time_concat(self):
+ x = ['']
+
+ expr = """x[0] = 'foo' f'{3}'"""
+ t = ast.parse(expr)
+ c = compile(t, '', 'exec')
+ exec(c)
+ self.assertEqual(x[0], 'foo3')
+
+ def test_literal(self):
+ self.assertEqual(f'', '')
+ self.assertEqual(f'a', 'a')
+ self.assertEqual(f' ', ' ')
+ self.assertEqual(f'\N{GREEK CAPITAL LETTER DELTA}',
+ '\N{GREEK CAPITAL LETTER DELTA}')
+ self.assertEqual(f'\N{GREEK CAPITAL LETTER DELTA}',
+ '\u0394')
+ self.assertEqual(f'\N{True}', '\u22a8')
+ self.assertEqual(rf'\N{True}', r'\NTrue')
+
+ def test_escape_order(self):
+ # note that hex(ord('{')) == 0x7b, so this
+ # string becomes f'a{4*10}b'
+ self.assertEqual(f'a\u007b4*10}b', 'a40b')
+ self.assertEqual(f'a\x7b4*10}b', 'a40b')
+ self.assertEqual(f'a\x7b4*10\N{RIGHT CURLY BRACKET}b', 'a40b')
+ self.assertEqual(f'{"a"!\N{LATIN SMALL LETTER R}}', "'a'")
+ self.assertEqual(f'{10\x3a02X}', '0A')
+ self.assertEqual(f'{10:02\N{LATIN CAPITAL LETTER X}}', '0A')
+
+ self.assertAllRaise(SyntaxError, "f-string: single '}' is not allowed",
+ [r"""f'a{\u007b4*10}b'""", # mis-matched brackets
+ ])
+ self.assertAllRaise(SyntaxError, 'unexpected character after line continuation character',
+ [r"""f'{"a"\!r}'""",
+ r"""f'{a\!r}'""",
+ ])
+
+ def test_unterminated_string(self):
+ self.assertAllRaise(SyntaxError, 'f-string: unterminated string',
+ [r"""f'{"x'""",
+ r"""f'{"x}'""",
+ r"""f'{("x'""",
+ r"""f'{("x}'""",
+ ])
+
+ def test_mismatched_parens(self):
+ self.assertAllRaise(SyntaxError, 'f-string: mismatched',
+ ["f'{((}'",
+ ])
+
+ def test_double_braces(self):
+ self.assertEqual(f'{{', '{')
+ self.assertEqual(f'a{{', 'a{')
+ self.assertEqual(f'{{b', '{b')
+ self.assertEqual(f'a{{b', 'a{b')
+ self.assertEqual(f'}}', '}')
+ self.assertEqual(f'a}}', 'a}')
+ self.assertEqual(f'}}b', '}b')
+ self.assertEqual(f'a}}b', 'a}b')
+
+ self.assertEqual(f'{{{10}', '{10')
+ self.assertEqual(f'}}{10}', '}10')
+ self.assertEqual(f'}}{{{10}', '}{10')
+ self.assertEqual(f'}}a{{{10}', '}a{10')
+
+ self.assertEqual(f'{10}{{', '10{')
+ self.assertEqual(f'{10}}}', '10}')
+ self.assertEqual(f'{10}}}{{', '10}{')
+ self.assertEqual(f'{10}}}a{{' '}', '10}a{}')
+
+ # Inside of strings, don't interpret doubled brackets.
+ self.assertEqual(f'{"{{}}"}', '{{}}')
+
+ self.assertAllRaise(TypeError, 'unhashable type',
+ ["f'{ {{}} }'", # dict in a set
+ ])
+
+ def test_compile_time_concat(self):
+ x = 'def'
+ self.assertEqual('abc' f'## {x}ghi', 'abc## defghi')
+ self.assertEqual('abc' f'{x}' 'ghi', 'abcdefghi')
+ self.assertEqual('abc' f'{x}' 'gh' f'i{x:4}', 'abcdefghidef ')
+ self.assertEqual('{x}' f'{x}', '{x}def')
+ self.assertEqual('{x' f'{x}', '{xdef')
+ self.assertEqual('{x}' f'{x}', '{x}def')
+ self.assertEqual('{{x}}' f'{x}', '{{x}}def')
+ self.assertEqual('{{x' f'{x}', '{{xdef')
+ self.assertEqual('x}}' f'{x}', 'x}}def')
+ self.assertEqual(f'{x}' 'x}}', 'defx}}')
+ self.assertEqual(f'{x}' '', 'def')
+ self.assertEqual('' f'{x}' '', 'def')
+ self.assertEqual('' f'{x}', 'def')
+ self.assertEqual(f'{x}' '2', 'def2')
+ self.assertEqual('1' f'{x}' '2', '1def2')
+ self.assertEqual('1' f'{x}', '1def')
+ self.assertEqual(f'{x}' f'-{x}', 'def-def')
+ self.assertEqual('' f'', '')
+ self.assertEqual('' f'' '', '')
+ self.assertEqual('' f'' '' f'', '')
+ self.assertEqual(f'', '')
+ self.assertEqual(f'' '', '')
+ self.assertEqual(f'' '' f'', '')
+ self.assertEqual(f'' '' f'' '', '')
+
+ self.assertAllRaise(SyntaxError, "f-string: expecting '}'",
+ ["f'{3' f'}'", # can't concat to get a valid f-string
+ ])
+
+ def test_comments(self):
+ # These aren't comments, since they're in strings.
+ d = {'#': 'hash'}
+ self.assertEqual(f'{"#"}', '#')
+ self.assertEqual(f'{d["#"]}', 'hash')
+
+ self.assertAllRaise(SyntaxError, "f-string cannot include '#'",
+ ["f'{1#}'", # error because the expression becomes "(1#)"
+ "f'{3(#)}'",
+ ])
+
+ def test_many_expressions(self):
+ # Create a string with many expressions in it. Note that
+ # because we have a space in here as a literal, we're actually
+ # going to use twice as many ast nodes: one for each literal
+ # plus one for each expression.
+ def build_fstr(n, extra=''):
+ return "f'" + ('{x} ' * n) + extra + "'"
+
+ x = 'X'
+ width = 1
+
+ # Test around 256.
+ for i in range(250, 260):
+ self.assertEqual(eval(build_fstr(i)), (x+' ')*i)
+
+ # Test concatenating 2 largs fstrings.
+ self.assertEqual(eval(build_fstr(255)*256), (x+' ')*(255*256))
+
+ s = build_fstr(253, '{x:{width}} ')
+ self.assertEqual(eval(s), (x+' ')*254)
+
+ # Test lots of expressions and constants, concatenated.
+ s = "f'{1}' 'x' 'y'" * 1024
+ self.assertEqual(eval(s), '1xy' * 1024)
+
+ def test_format_specifier_expressions(self):
+ width = 10
+ precision = 4
+ value = decimal.Decimal('12.34567')
+ self.assertEqual(f'result: {value:{width}.{precision}}', 'result: 12.35')
+ self.assertEqual(f'result: {value:{width!r}.{precision}}', 'result: 12.35')
+ self.assertEqual(f'result: {value:{width:0}.{precision:1}}', 'result: 12.35')
+ self.assertEqual(f'result: {value:{1}{0:0}.{precision:1}}', 'result: 12.35')
+ self.assertEqual(f'result: {value:{ 1}{ 0:0}.{ precision:1}}', 'result: 12.35')
+ self.assertEqual(f'{10:#{1}0x}', ' 0xa')
+ self.assertEqual(f'{10:{"#"}1{0}{"x"}}', ' 0xa')
+ self.assertEqual(f'{-10:-{"#"}1{0}x}', ' -0xa')
+ self.assertEqual(f'{-10:{"-"}#{1}0{"x"}}', ' -0xa')
+ self.assertEqual(f'{10:#{3 != {4:5} and width}x}', ' 0xa')
+
+ self.assertAllRaise(SyntaxError, "f-string: expecting '}'",
+ ["""f'{"s"!r{":10"}}'""",
+
+ # This looks like a nested format spec.
+ ])
+
+ self.assertAllRaise(SyntaxError, "invalid syntax",
+ [# Invalid sytax inside a nested spec.
+ "f'{4:{/5}}'",
+ ])
+
+ self.assertAllRaise(SyntaxError, "f-string: expressions nested too deeply",
+ [# Can't nest format specifiers.
+ "f'result: {value:{width:{0}}.{precision:1}}'",
+ ])
+
+ self.assertAllRaise(SyntaxError, 'f-string: invalid conversion character',
+ [# No expansion inside conversion or for
+ # the : or ! itself.
+ """f'{"s"!{"r"}}'""",
+ ])
+
+ def test_side_effect_order(self):
+ class X:
+ def __init__(self):
+ self.i = 0
+ def __format__(self, spec):
+ self.i += 1
+ return str(self.i)
+
+ x = X()
+ self.assertEqual(f'{x} {x}', '1 2')
+
+ def test_missing_expression(self):
+ self.assertAllRaise(SyntaxError, 'f-string: empty expression not allowed',
+ ["f'{}'",
+ "f'{ }'"
+ "f' {} '",
+ "f'{!r}'",
+ "f'{ !r}'",
+ "f'{10:{ }}'",
+ "f' { } '",
+ r"f'{\n}'",
+ r"f'{\n \n}'",
+
+ # Catch the empty expression before the
+ # invalid conversion.
+ "f'{!x}'",
+ "f'{ !xr}'",
+ "f'{!x:}'",
+ "f'{!x:a}'",
+ "f'{ !xr:}'",
+ "f'{ !xr:a}'",
+
+ "f'{!}'",
+ "f'{:}'",
+
+ # We find the empty expression before the
+ # missing closing brace.
+ "f'{!'",
+ "f'{!s:'",
+ "f'{:'",
+ "f'{:x'",
+ ])
+
+ def test_parens_in_expressions(self):
+ self.assertEqual(f'{3,}', '(3,)')
+
+ # Add these because when an expression is evaluated, parens
+ # are added around it. But we shouldn't go from an invalid
+ # expression to a valid one. The added parens are just
+ # supposed to allow whitespace (including newlines).
+ self.assertAllRaise(SyntaxError, 'invalid syntax',
+ ["f'{,}'",
+ "f'{,}'", # this is (,), which is an error
+ ])
+
+ self.assertAllRaise(SyntaxError, "f-string: expecting '}'",
+ ["f'{3)+(4}'",
+ ])
+
+ self.assertAllRaise(SyntaxError, 'EOL while scanning string literal',
+ ["f'{\n}'",
+ ])
+
+ def test_newlines_in_expressions(self):
+ self.assertEqual(f'{0}', '0')
+ self.assertEqual(f'{0\n}', '0')
+ self.assertEqual(f'{0\r}', '0')
+ self.assertEqual(f'{\n0\n}', '0')
+ self.assertEqual(f'{\r0\r}', '0')
+ self.assertEqual(f'{\n0\r}', '0')
+ self.assertEqual(f'{\n0}', '0')
+ self.assertEqual(f'{3+\n4}', '7')
+ self.assertEqual(f'{3+\\\n4}', '7')
+ self.assertEqual(rf'''{3+
+4}''', '7')
+ self.assertEqual(f'''{3+\
+4}''', '7')
+
+ self.assertAllRaise(SyntaxError, 'f-string: empty expression not allowed',
+ [r"f'{\n}'",
+ ])
+
+ def test_lambda(self):
+ x = 5
+ self.assertEqual(f'{(lambda y:x*y)("8")!r}', "'88888'")
+ self.assertEqual(f'{(lambda y:x*y)("8")!r:10}', "'88888' ")
+ self.assertEqual(f'{(lambda y:x*y)("8"):10}', "88888 ")
+
+ # lambda doesn't work without parens, because the colon
+ # makes the parser think it's a format_spec
+ self.assertAllRaise(SyntaxError, 'unexpected EOF while parsing',
+ ["f'{lambda x:x}'",
+ ])
+
+ def test_yield(self):
+ # Not terribly useful, but make sure the yield turns
+ # a function into a generator
+ def fn(y):
+ f'y:{yield y*2}'
+
+ g = fn(4)
+ self.assertEqual(next(g), 8)
+
+ def test_yield_send(self):
+ def fn(x):
+ yield f'x:{yield (lambda i: x * i)}'
+
+ g = fn(10)
+ the_lambda = next(g)
+ self.assertEqual(the_lambda(4), 40)
+ self.assertEqual(g.send('string'), 'x:string')
+
+ def test_expressions_with_triple_quoted_strings(self):
+ self.assertEqual(f"{'''x'''}", 'x')
+ self.assertEqual(f"{'''eric's'''}", "eric's")
+ self.assertEqual(f'{"""eric\'s"""}', "eric's")
+ self.assertEqual(f"{'''eric\"s'''}", 'eric"s')
+ self.assertEqual(f'{"""eric"s"""}', 'eric"s')
+
+ # Test concatenation within an expression
+ self.assertEqual(f'{"x" """eric"s""" "y"}', 'xeric"sy')
+ self.assertEqual(f'{"x" """eric"s"""}', 'xeric"s')
+ self.assertEqual(f'{"""eric"s""" "y"}', 'eric"sy')
+ self.assertEqual(f'{"""x""" """eric"s""" "y"}', 'xeric"sy')
+ self.assertEqual(f'{"""x""" """eric"s""" """y"""}', 'xeric"sy')
+ self.assertEqual(f'{r"""x""" """eric"s""" """y"""}', 'xeric"sy')
+
+ def test_multiple_vars(self):
+ x = 98
+ y = 'abc'
+ self.assertEqual(f'{x}{y}', '98abc')
+
+ self.assertEqual(f'X{x}{y}', 'X98abc')
+ self.assertEqual(f'{x}X{y}', '98Xabc')
+ self.assertEqual(f'{x}{y}X', '98abcX')
+
+ self.assertEqual(f'X{x}Y{y}', 'X98Yabc')
+ self.assertEqual(f'X{x}{y}Y', 'X98abcY')
+ self.assertEqual(f'{x}X{y}Y', '98XabcY')
+
+ self.assertEqual(f'X{x}Y{y}Z', 'X98YabcZ')
+
+ def test_closure(self):
+ def outer(x):
+ def inner():
+ return f'x:{x}'
+ return inner
+
+ self.assertEqual(outer('987')(), 'x:987')
+ self.assertEqual(outer(7)(), 'x:7')
+
+ def test_arguments(self):
+ y = 2
+ def f(x, width):
+ return f'x={x*y:{width}}'
+
+ self.assertEqual(f('foo', 10), 'x=foofoo ')
+ x = 'bar'
+ self.assertEqual(f(10, 10), 'x= 20')
+
+ def test_locals(self):
+ value = 123
+ self.assertEqual(f'v:{value}', 'v:123')
+
+ def test_missing_variable(self):
+ with self.assertRaises(NameError):
+ f'v:{value}'
+
+ def test_missing_format_spec(self):
+ class O:
+ def __format__(self, spec):
+ if not spec:
+ return '*'
+ return spec
+
+ self.assertEqual(f'{O():x}', 'x')
+ self.assertEqual(f'{O()}', '*')
+ self.assertEqual(f'{O():}', '*')
+
+ self.assertEqual(f'{3:}', '3')
+ self.assertEqual(f'{3!s:}', '3')
+
+ def test_global(self):
+ self.assertEqual(f'g:{a_global}', 'g:global variable')
+ self.assertEqual(f'g:{a_global!r}', "g:'global variable'")
+
+ a_local = 'local variable'
+ self.assertEqual(f'g:{a_global} l:{a_local}',
+ 'g:global variable l:local variable')
+ self.assertEqual(f'g:{a_global!r}',
+ "g:'global variable'")
+ self.assertEqual(f'g:{a_global} l:{a_local!r}',
+ "g:global variable l:'local variable'")
+
+ self.assertIn("module 'unittest' from", f'{unittest}')
+
+ def test_shadowed_global(self):
+ a_global = 'really a local'
+ self.assertEqual(f'g:{a_global}', 'g:really a local')
+ self.assertEqual(f'g:{a_global!r}', "g:'really a local'")
+
+ a_local = 'local variable'
+ self.assertEqual(f'g:{a_global} l:{a_local}',
+ 'g:really a local l:local variable')
+ self.assertEqual(f'g:{a_global!r}',
+ "g:'really a local'")
+ self.assertEqual(f'g:{a_global} l:{a_local!r}',
+ "g:really a local l:'local variable'")
+
+ def test_call(self):
+ def foo(x):
+ return 'x=' + str(x)
+
+ self.assertEqual(f'{foo(10)}', 'x=10')
+
+ def test_nested_fstrings(self):
+ y = 5
+ self.assertEqual(f'{f"{0}"*3}', '000')
+ self.assertEqual(f'{f"{y}"*3}', '555')
+ self.assertEqual(f'{f"{\'x\'}"*3}', 'xxx')
+
+ self.assertEqual(f"{r'x' f'{\"s\"}'}", 'xs')
+ self.assertEqual(f"{r'x'rf'{\"s\"}'}", 'xs')
+
+ def test_invalid_string_prefixes(self):
+ self.assertAllRaise(SyntaxError, 'unexpected EOF while parsing',
+ ["fu''",
+ "uf''",
+ "Fu''",
+ "fU''",
+ "Uf''",
+ "uF''",
+ "ufr''",
+ "urf''",
+ "fur''",
+ "fru''",
+ "rfu''",
+ "ruf''",
+ "FUR''",
+ "Fur''",
+ ])
+
+ def test_leading_trailing_spaces(self):
+ self.assertEqual(f'{ 3}', '3')
+ self.assertEqual(f'{ 3}', '3')
+ self.assertEqual(f'{\t3}', '3')
+ self.assertEqual(f'{\t\t3}', '3')
+ self.assertEqual(f'{3 }', '3')
+ self.assertEqual(f'{3 }', '3')
+ self.assertEqual(f'{3\t}', '3')
+ self.assertEqual(f'{3\t\t}', '3')
+
+ self.assertEqual(f'expr={ {x: y for x, y in [(1, 2), ]}}',
+ 'expr={1: 2}')
+ self.assertEqual(f'expr={ {x: y for x, y in [(1, 2), ]} }',
+ 'expr={1: 2}')
+
+ def test_character_name(self):
+ self.assertEqual(f'{4}\N{GREEK CAPITAL LETTER DELTA}{3}',
+ '4\N{GREEK CAPITAL LETTER DELTA}3')
+ self.assertEqual(f'{{}}\N{GREEK CAPITAL LETTER DELTA}{3}',
+ '{}\N{GREEK CAPITAL LETTER DELTA}3')
+
+ def test_not_equal(self):
+ # There's a special test for this because there's a special
+ # case in the f-string parser to look for != as not ending an
+ # expression. Normally it would, while looking for !s or !r.
+
+ self.assertEqual(f'{3!=4}', 'True')
+ self.assertEqual(f'{3!=4:}', 'True')
+ self.assertEqual(f'{3!=4!s}', 'True')
+ self.assertEqual(f'{3!=4!s:.3}', 'Tru')
+
+ def test_conversions(self):
+ self.assertEqual(f'{3.14:10.10}', ' 3.14')
+ self.assertEqual(f'{3.14!s:10.10}', '3.14 ')
+ self.assertEqual(f'{3.14!r:10.10}', '3.14 ')
+ self.assertEqual(f'{3.14!a:10.10}', '3.14 ')
+
+ self.assertEqual(f'{"a"}', 'a')
+ self.assertEqual(f'{"a"!r}', "'a'")
+ self.assertEqual(f'{"a"!a}', "'a'")
+
+ # Not a conversion.
+ self.assertEqual(f'{"a!r"}', "a!r")
+
+ # Not a conversion, but show that ! is allowed in a format spec.
+ self.assertEqual(f'{3.14:!<10.10}', '3.14!!!!!!')
+
+ self.assertEqual(f'{"\N{GREEK CAPITAL LETTER DELTA}"}', '\u0394')
+ self.assertEqual(f'{"\N{GREEK CAPITAL LETTER DELTA}"!r}', "'\u0394'")
+ self.assertEqual(f'{"\N{GREEK CAPITAL LETTER DELTA}"!a}', "'\\u0394'")
+
+ self.assertAllRaise(SyntaxError, 'f-string: invalid conversion character',
+ ["f'{3!g}'",
+ "f'{3!A}'",
+ "f'{3!A}'",
+ "f'{3!A}'",
+ "f'{3!!}'",
+ "f'{3!:}'",
+ "f'{3!\N{GREEK CAPITAL LETTER DELTA}}'",
+ "f'{3! s}'", # no space before conversion char
+ "f'{x!\\x00:.<10}'",
+ ])
+
+ self.assertAllRaise(SyntaxError, "f-string: expecting '}'",
+ ["f'{x!s{y}}'",
+ "f'{3!ss}'",
+ "f'{3!ss:}'",
+ "f'{3!ss:s}'",
+ ])
+
+ def test_assignment(self):
+ self.assertAllRaise(SyntaxError, 'invalid syntax',
+ ["f'' = 3",
+ "f'{0}' = x",
+ "f'{x}' = x",
+ ])
+
+ def test_del(self):
+ self.assertAllRaise(SyntaxError, 'invalid syntax',
+ ["del f''",
+ "del '' f''",
+ ])
+
+ def test_mismatched_braces(self):
+ self.assertAllRaise(SyntaxError, "f-string: single '}' is not allowed",
+ ["f'{{}'",
+ "f'{{}}}'",
+ "f'}'",
+ "f'x}'",
+ "f'x}x'",
+
+ # Can't have { or } in a format spec.
+ "f'{3:}>10}'",
+ r"f'{3:\\}>10}'",
+ "f'{3:}}>10}'",
+ ])
+
+ self.assertAllRaise(SyntaxError, "f-string: expecting '}'",
+ ["f'{3:{{>10}'",
+ "f'{3'",
+ "f'{3!'",
+ "f'{3:'",
+ "f'{3!s'",
+ "f'{3!s:'",
+ "f'{3!s:3'",
+ "f'x{'",
+ "f'x{x'",
+ "f'{3:s'",
+ "f'{{{'",
+ "f'{{}}{'",
+ "f'{'",
+ ])
+
+ self.assertAllRaise(SyntaxError, 'invalid syntax',
+ [r"f'{3:\\{>10}'",
+ ])
+
+ # But these are just normal strings.
+ self.assertEqual(f'{"{"}', '{')
+ self.assertEqual(f'{"}"}', '}')
+ self.assertEqual(f'{3:{"}"}>10}', '}}}}}}}}}3')
+ self.assertEqual(f'{2:{"{"}>10}', '{{{{{{{{{2')
+
+ def test_if_conditional(self):
+ # There's special logic in compile.c to test if the
+ # conditional for an if (and while) are constants. Exercise
+ # that code.
+
+ def test_fstring(x, expected):
+ flag = 0
+ if f'{x}':
+ flag = 1
+ else:
+ flag = 2
+ self.assertEqual(flag, expected)
+
+ def test_concat_empty(x, expected):
+ flag = 0
+ if '' f'{x}':
+ flag = 1
+ else:
+ flag = 2
+ self.assertEqual(flag, expected)
+
+ def test_concat_non_empty(x, expected):
+ flag = 0
+ if ' ' f'{x}':
+ flag = 1
+ else:
+ flag = 2
+ self.assertEqual(flag, expected)
+
+ test_fstring('', 2)
+ test_fstring(' ', 1)
+
+ test_concat_empty('', 2)
+ test_concat_empty(' ', 1)
+
+ test_concat_non_empty('', 1)
+ test_concat_non_empty(' ', 1)
+
+ def test_empty_format_specifier(self):
+ x = 'test'
+ self.assertEqual(f'{x}', 'test')
+ self.assertEqual(f'{x:}', 'test')
+ self.assertEqual(f'{x!s:}', 'test')
+ self.assertEqual(f'{x!r:}', "'test'")
+
+ def test_str_format_differences(self):
+ d = {'a': 'string',
+ 0: 'integer',
+ }
+ a = 0
+ self.assertEqual(f'{d[0]}', 'integer')
+ self.assertEqual(f'{d["a"]}', 'string')
+ self.assertEqual(f'{d[a]}', 'integer')
+ self.assertEqual('{d[a]}'.format(d=d), 'string')
+ self.assertEqual('{d[0]}'.format(d=d), 'integer')
+
+ def test_invalid_expressions(self):
+ self.assertAllRaise(SyntaxError, 'invalid syntax',
+ [r"f'{a[4)}'",
+ r"f'{a(4]}'",
+ ])
+
+ def test_loop(self):
+ for i in range(1000):
+ self.assertEqual(f'i:{i}', 'i:' + str(i))
+
+ def test_dict(self):
+ d = {'"': 'dquote',
+ "'": 'squote',
+ 'foo': 'bar',
+ }
+ self.assertEqual(f'{d["\'"]}', 'squote')
+ self.assertEqual(f"{d['\"']}", 'dquote')
+
+ self.assertEqual(f'''{d["'"]}''', 'squote')
+ self.assertEqual(f"""{d['"']}""", 'dquote')
+
+ self.assertEqual(f'{d["foo"]}', 'bar')
+ self.assertEqual(f"{d['foo']}", 'bar')
+ self.assertEqual(f'{d[\'foo\']}', 'bar')
+ self.assertEqual(f"{d[\"foo\"]}", 'bar')
+
+ def test_escaped_quotes(self):
+ d = {'"': 'a',
+ "'": 'b'}
+
+ self.assertEqual(fr"{d['\"']}", 'a')
+ self.assertEqual(fr'{d["\'"]}', 'b')
+ self.assertEqual(fr"{'\"'}", '"')
+ self.assertEqual(fr'{"\'"}', "'")
+ self.assertEqual(f'{"\\"3"}', '"3')
+
+ self.assertAllRaise(SyntaxError, 'f-string: unterminated string',
+ [r'''f'{"""\\}' ''', # Backslash at end of expression
+ ])
+ self.assertAllRaise(SyntaxError, 'unexpected character after line continuation',
+ [r"rf'{3\}'",
+ ])
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index ec3d783..8f8d71c 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -295,6 +295,10 @@
pos2key2dict(1,2,k2=100,tokwarg1=100,tokwarg2=200)
pos2key2dict(1,2,tokwarg1=100,tokwarg2=200, k2=100)
+ self.assertRaises(SyntaxError, eval, "def f(*): pass")
+ self.assertRaises(SyntaxError, eval, "def f(*,): pass")
+ self.assertRaises(SyntaxError, eval, "def f(*, **kwds): pass")
+
# keyword arguments after *arglist
def f(*args, **kwargs):
return args, kwargs
@@ -352,6 +356,23 @@
check_syntax_error(self, "f(*g(1=2))")
check_syntax_error(self, "f(**g(1=2))")
+ # Check trailing commas are permitted in funcdef argument list
+ def f(a,): pass
+ def f(*args,): pass
+ def f(**kwds,): pass
+ def f(a, *args,): pass
+ def f(a, **kwds,): pass
+ def f(*args, b,): pass
+ def f(*, b,): pass
+ def f(*args, **kwds,): pass
+ def f(a, *args, b,): pass
+ def f(a, *, b,): pass
+ def f(a, *args, **kwds,): pass
+ def f(*args, b, **kwds,): pass
+ def f(*, b, **kwds,): pass
+ def f(a, *args, b, **kwds,): pass
+ def f(a, *, b, **kwds,): pass
+
def test_lambdef(self):
### lambdef: 'lambda' [varargslist] ':' test
l1 = lambda : 0
@@ -370,6 +391,23 @@
self.assertEqual(l6(1,2), 1+2+20)
self.assertEqual(l6(1,2,k=10), 1+2+10)
+ # check that trailing commas are permitted
+ l10 = lambda a,: 0
+ l11 = lambda *args,: 0
+ l12 = lambda **kwds,: 0
+ l13 = lambda a, *args,: 0
+ l14 = lambda a, **kwds,: 0
+ l15 = lambda *args, b,: 0
+ l16 = lambda *, b,: 0
+ l17 = lambda *args, **kwds,: 0
+ l18 = lambda a, *args, b,: 0
+ l19 = lambda a, *, b,: 0
+ l20 = lambda a, *args, **kwds,: 0
+ l21 = lambda *args, b, **kwds,: 0
+ l22 = lambda *, b, **kwds,: 0
+ l23 = lambda a, *args, b, **kwds,: 0
+ l24 = lambda a, *, b, **kwds,: 0
+
### stmt: simple_stmt | compound_stmt
# Tested below
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 955b2ad..db15b39 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -38,7 +38,7 @@
# ismodule, isclass, ismethod, isfunction, istraceback, isframe, iscode,
# isbuiltin, isroutine, isgenerator, isgeneratorfunction, getmembers,
# getdoc, getfile, getmodule, getsourcefile, getcomments, getsource,
-# getclasstree, getargspec, getargvalues, formatargspec, formatargvalues,
+# getclasstree, getargvalues, formatargspec, formatargvalues,
# currentframe, stack, trace, isdatadescriptor
# NOTE: There are some additional tests relating to interaction with
@@ -628,18 +628,6 @@
got = inspect.getmro(D)
self.assertEqual(expected, got)
- def assertArgSpecEquals(self, routine, args_e, varargs_e=None,
- varkw_e=None, defaults_e=None, formatted=None):
- with self.assertWarns(DeprecationWarning):
- args, varargs, varkw, defaults = inspect.getargspec(routine)
- self.assertEqual(args, args_e)
- self.assertEqual(varargs, varargs_e)
- self.assertEqual(varkw, varkw_e)
- self.assertEqual(defaults, defaults_e)
- if formatted is not None:
- self.assertEqual(inspect.formatargspec(args, varargs, varkw, defaults),
- formatted)
-
def assertFullArgSpecEquals(self, routine, args_e, varargs_e=None,
varkw_e=None, defaults_e=None,
kwonlyargs_e=[], kwonlydefaults_e=None,
@@ -658,23 +646,6 @@
kwonlyargs, kwonlydefaults, ann),
formatted)
- def test_getargspec(self):
- self.assertArgSpecEquals(mod.eggs, ['x', 'y'], formatted='(x, y)')
-
- self.assertArgSpecEquals(mod.spam,
- ['a', 'b', 'c', 'd', 'e', 'f'],
- 'g', 'h', (3, 4, 5),
- '(a, b, c, d=3, e=4, f=5, *g, **h)')
-
- self.assertRaises(ValueError, self.assertArgSpecEquals,
- mod2.keyworded, [])
-
- self.assertRaises(ValueError, self.assertArgSpecEquals,
- mod2.annotated, [])
- self.assertRaises(ValueError, self.assertArgSpecEquals,
- mod2.keyword_only_arg, [])
-
-
def test_getfullargspec(self):
self.assertFullArgSpecEquals(mod2.keyworded, [], varargs_e='arg1',
kwonlyargs_e=['arg2'],
@@ -688,20 +659,19 @@
kwonlyargs_e=['arg'],
formatted='(*, arg)')
- def test_argspec_api_ignores_wrapped(self):
+ def test_fullargspec_api_ignores_wrapped(self):
# Issue 20684: low level introspection API must ignore __wrapped__
@functools.wraps(mod.spam)
def ham(x, y):
pass
# Basic check
- self.assertArgSpecEquals(ham, ['x', 'y'], formatted='(x, y)')
self.assertFullArgSpecEquals(ham, ['x', 'y'], formatted='(x, y)')
self.assertFullArgSpecEquals(functools.partial(ham),
['x', 'y'], formatted='(x, y)')
# Other variants
def check_method(f):
- self.assertArgSpecEquals(f, ['self', 'x', 'y'],
- formatted='(self, x, y)')
+ self.assertFullArgSpecEquals(f, ['self', 'x', 'y'],
+ formatted='(self, x, y)')
class C:
@functools.wraps(mod.spam)
def ham(self, x, y):
@@ -779,11 +749,11 @@
with self.assertRaises(TypeError):
inspect.getfullargspec(builtin)
- def test_getargspec_method(self):
+ def test_getfullargspec_method(self):
class A(object):
def m(self):
pass
- self.assertArgSpecEquals(A.m, ['self'])
+ self.assertFullArgSpecEquals(A.m, ['self'])
def test_classify_newstyle(self):
class A(object):
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index 5b3ba7e..9e55b2a 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -613,6 +613,56 @@
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
self.pickletest(proto, cycle('abc'))
+ for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+ # test with partial consumed input iterable
+ it = iter('abcde')
+ c = cycle(it)
+ _ = [next(c) for i in range(2)] # consume 2 of 5 inputs
+ p = pickle.dumps(c, proto)
+ d = pickle.loads(p) # rebuild the cycle object
+ self.assertEqual(take(20, d), list('cdeabcdeabcdeabcdeab'))
+
+ # test with completely consumed input iterable
+ it = iter('abcde')
+ c = cycle(it)
+ _ = [next(c) for i in range(7)] # consume 7 of 5 inputs
+ p = pickle.dumps(c, proto)
+ d = pickle.loads(p) # rebuild the cycle object
+ self.assertEqual(take(20, d), list('cdeabcdeabcdeabcdeab'))
+
+ def test_cycle_setstate(self):
+ # Verify both modes for restoring state
+
+ # Mode 0 is efficient. It uses an incompletely consumed input
+ # iterator to build a cycle object and then passes in state with
+ # a list of previously consumed values. There is no data
+ # overlap bewteen the two.
+ c = cycle('defg')
+ c.__setstate__((list('abc'), 0))
+ self.assertEqual(take(20, c), list('defgabcdefgabcdefgab'))
+
+ # Mode 1 is inefficient. It starts with a cycle object built
+ # from an iterator over the remaining elements in a partial
+ # cycle and then passes in state with all of the previously
+ # seen values (this overlaps values included in the iterator).
+ c = cycle('defg')
+ c.__setstate__((list('abcdefg'), 1))
+ self.assertEqual(take(20, c), list('defgabcdefgabcdefgab'))
+
+ # The first argument to setstate needs to be a tuple
+ with self.assertRaises(SystemError):
+ cycle('defg').__setstate__([list('abcdefg'), 0])
+
+ # The first argument in the setstate tuple must be a list
+ with self.assertRaises(TypeError):
+ c = cycle('defg')
+ c.__setstate__((dict.fromkeys('defg'), 0))
+ take(20, c)
+
+ # The first argument in the setstate tuple must be a list
+ with self.assertRaises(TypeError):
+ cycle('defg').__setstate__((list('abcdefg'), 'x'))
+
def test_groupby(self):
# Check whether it accepts arguments correctly
self.assertEqual([], list(groupby([])))
diff --git a/Lib/test/test_linecache.py b/Lib/test/test_linecache.py
index 21ef738..240db7f 100644
--- a/Lib/test/test_linecache.py
+++ b/Lib/test/test_linecache.py
@@ -3,6 +3,8 @@
import linecache
import unittest
import os.path
+import tempfile
+import tokenize
from test import support
@@ -10,8 +12,6 @@
NONEXISTENT_FILENAME = FILENAME + '.missing'
INVALID_NAME = '!@$)(!@#_1'
EMPTY = ''
-TESTS = 'inspect_fodder inspect_fodder2 mapping_tests'
-TESTS = TESTS.split()
TEST_PATH = os.path.dirname(__file__)
MODULES = "linecache abc".split()
MODULE_PATH = os.path.dirname(FILENAME)
@@ -37,6 +37,65 @@
return 3''' # No ending newline
+class TempFile:
+
+ def setUp(self):
+ super().setUp()
+ with tempfile.NamedTemporaryFile(delete=False) as fp:
+ self.file_name = fp.name
+ fp.write(self.file_byte_string)
+ self.addCleanup(support.unlink, self.file_name)
+
+
+class GetLineTestsGoodData(TempFile):
+ # file_list = ['list\n', 'of\n', 'good\n', 'strings\n']
+
+ def setUp(self):
+ self.file_byte_string = ''.join(self.file_list).encode('utf-8')
+ super().setUp()
+
+ def test_getline(self):
+ with tokenize.open(self.file_name) as fp:
+ for index, line in enumerate(fp):
+ if not line.endswith('\n'):
+ line += '\n'
+
+ cached_line = linecache.getline(self.file_name, index + 1)
+ self.assertEqual(line, cached_line)
+
+ def test_getlines(self):
+ lines = linecache.getlines(self.file_name)
+ self.assertEqual(lines, self.file_list)
+
+
+class GetLineTestsBadData(TempFile):
+ # file_byte_string = b'Bad data goes here'
+
+ def test_getline(self):
+ self.assertRaises((SyntaxError, UnicodeDecodeError),
+ linecache.getline, self.file_name, 1)
+
+ def test_getlines(self):
+ self.assertRaises((SyntaxError, UnicodeDecodeError),
+ linecache.getlines, self.file_name)
+
+
+class EmptyFile(GetLineTestsGoodData, unittest.TestCase):
+ file_list = []
+
+
+class SingleEmptyLine(GetLineTestsGoodData, unittest.TestCase):
+ file_list = ['\n']
+
+
+class GoodUnicode(GetLineTestsGoodData, unittest.TestCase):
+ file_list = ['á\n', 'b\n', 'abcdef\n', 'ááááá\n']
+
+
+class BadUnicode(GetLineTestsBadData, unittest.TestCase):
+ file_byte_string = b'\x80abc'
+
+
class LineCacheTests(unittest.TestCase):
def test_getline(self):
@@ -53,13 +112,6 @@
self.assertEqual(getline(EMPTY, 1), EMPTY)
self.assertEqual(getline(INVALID_NAME, 1), EMPTY)
- # Check whether lines correspond to those from file iteration
- for entry in TESTS:
- filename = os.path.join(TEST_PATH, entry) + '.py'
- with open(filename) as file:
- for index, line in enumerate(file):
- self.assertEqual(line, getline(filename, index + 1))
-
# Check module loading
for entry in MODULES:
filename = os.path.join(MODULE_PATH, entry) + '.py'
@@ -80,12 +132,13 @@
def test_clearcache(self):
cached = []
- for entry in TESTS:
- filename = os.path.join(TEST_PATH, entry) + '.py'
+ for entry in MODULES:
+ filename = os.path.join(MODULE_PATH, entry) + '.py'
cached.append(filename)
linecache.getline(filename, 1)
# Are all files cached?
+ self.assertNotEqual(cached, [])
cached_empty = [fn for fn in cached if fn not in linecache.cache]
self.assertEqual(cached_empty, [])
diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py
index da9c8ef..27501c2 100644
--- a/Lib/test/test_operator.py
+++ b/Lib/test/test_operator.py
@@ -120,63 +120,63 @@
operator = self.module
self.assertRaises(TypeError, operator.add)
self.assertRaises(TypeError, operator.add, None, None)
- self.assertTrue(operator.add(3, 4) == 7)
+ self.assertEqual(operator.add(3, 4), 7)
def test_bitwise_and(self):
operator = self.module
self.assertRaises(TypeError, operator.and_)
self.assertRaises(TypeError, operator.and_, None, None)
- self.assertTrue(operator.and_(0xf, 0xa) == 0xa)
+ self.assertEqual(operator.and_(0xf, 0xa), 0xa)
def test_concat(self):
operator = self.module
self.assertRaises(TypeError, operator.concat)
self.assertRaises(TypeError, operator.concat, None, None)
- self.assertTrue(operator.concat('py', 'thon') == 'python')
- self.assertTrue(operator.concat([1, 2], [3, 4]) == [1, 2, 3, 4])
- self.assertTrue(operator.concat(Seq1([5, 6]), Seq1([7])) == [5, 6, 7])
- self.assertTrue(operator.concat(Seq2([5, 6]), Seq2([7])) == [5, 6, 7])
+ self.assertEqual(operator.concat('py', 'thon'), 'python')
+ self.assertEqual(operator.concat([1, 2], [3, 4]), [1, 2, 3, 4])
+ self.assertEqual(operator.concat(Seq1([5, 6]), Seq1([7])), [5, 6, 7])
+ self.assertEqual(operator.concat(Seq2([5, 6]), Seq2([7])), [5, 6, 7])
self.assertRaises(TypeError, operator.concat, 13, 29)
def test_countOf(self):
operator = self.module
self.assertRaises(TypeError, operator.countOf)
self.assertRaises(TypeError, operator.countOf, None, None)
- self.assertTrue(operator.countOf([1, 2, 1, 3, 1, 4], 3) == 1)
- self.assertTrue(operator.countOf([1, 2, 1, 3, 1, 4], 5) == 0)
+ self.assertEqual(operator.countOf([1, 2, 1, 3, 1, 4], 3), 1)
+ self.assertEqual(operator.countOf([1, 2, 1, 3, 1, 4], 5), 0)
def test_delitem(self):
operator = self.module
a = [4, 3, 2, 1]
self.assertRaises(TypeError, operator.delitem, a)
self.assertRaises(TypeError, operator.delitem, a, None)
- self.assertTrue(operator.delitem(a, 1) is None)
- self.assertTrue(a == [4, 2, 1])
+ self.assertIsNone(operator.delitem(a, 1))
+ self.assertEqual(a, [4, 2, 1])
def test_floordiv(self):
operator = self.module
self.assertRaises(TypeError, operator.floordiv, 5)
self.assertRaises(TypeError, operator.floordiv, None, None)
- self.assertTrue(operator.floordiv(5, 2) == 2)
+ self.assertEqual(operator.floordiv(5, 2), 2)
def test_truediv(self):
operator = self.module
self.assertRaises(TypeError, operator.truediv, 5)
self.assertRaises(TypeError, operator.truediv, None, None)
- self.assertTrue(operator.truediv(5, 2) == 2.5)
+ self.assertEqual(operator.truediv(5, 2), 2.5)
def test_getitem(self):
operator = self.module
a = range(10)
self.assertRaises(TypeError, operator.getitem)
self.assertRaises(TypeError, operator.getitem, a, None)
- self.assertTrue(operator.getitem(a, 2) == 2)
+ self.assertEqual(operator.getitem(a, 2), 2)
def test_indexOf(self):
operator = self.module
self.assertRaises(TypeError, operator.indexOf)
self.assertRaises(TypeError, operator.indexOf, None, None)
- self.assertTrue(operator.indexOf([4, 3, 2, 1], 3) == 1)
+ self.assertEqual(operator.indexOf([4, 3, 2, 1], 3), 1)
self.assertRaises(ValueError, operator.indexOf, [4, 3, 2, 1], 0)
def test_invert(self):
@@ -189,21 +189,21 @@
operator = self.module
self.assertRaises(TypeError, operator.lshift)
self.assertRaises(TypeError, operator.lshift, None, 42)
- self.assertTrue(operator.lshift(5, 1) == 10)
- self.assertTrue(operator.lshift(5, 0) == 5)
+ self.assertEqual(operator.lshift(5, 1), 10)
+ self.assertEqual(operator.lshift(5, 0), 5)
self.assertRaises(ValueError, operator.lshift, 2, -1)
def test_mod(self):
operator = self.module
self.assertRaises(TypeError, operator.mod)
self.assertRaises(TypeError, operator.mod, None, 42)
- self.assertTrue(operator.mod(5, 2) == 1)
+ self.assertEqual(operator.mod(5, 2), 1)
def test_mul(self):
operator = self.module
self.assertRaises(TypeError, operator.mul)
self.assertRaises(TypeError, operator.mul, None, None)
- self.assertTrue(operator.mul(5, 2) == 10)
+ self.assertEqual(operator.mul(5, 2), 10)
def test_matmul(self):
operator = self.module
@@ -227,7 +227,7 @@
operator = self.module
self.assertRaises(TypeError, operator.or_)
self.assertRaises(TypeError, operator.or_, None, None)
- self.assertTrue(operator.or_(0xa, 0x5) == 0xf)
+ self.assertEqual(operator.or_(0xa, 0x5), 0xf)
def test_pos(self):
operator = self.module
@@ -250,8 +250,8 @@
operator = self.module
self.assertRaises(TypeError, operator.rshift)
self.assertRaises(TypeError, operator.rshift, None, 42)
- self.assertTrue(operator.rshift(5, 1) == 2)
- self.assertTrue(operator.rshift(5, 0) == 5)
+ self.assertEqual(operator.rshift(5, 1), 2)
+ self.assertEqual(operator.rshift(5, 0), 5)
self.assertRaises(ValueError, operator.rshift, 2, -1)
def test_contains(self):
@@ -266,15 +266,15 @@
a = list(range(3))
self.assertRaises(TypeError, operator.setitem, a)
self.assertRaises(TypeError, operator.setitem, a, None, None)
- self.assertTrue(operator.setitem(a, 0, 2) is None)
- self.assertTrue(a == [2, 1, 2])
+ self.assertIsNone(operator.setitem(a, 0, 2))
+ self.assertEqual(a, [2, 1, 2])
self.assertRaises(IndexError, operator.setitem, a, 4, 2)
def test_sub(self):
operator = self.module
self.assertRaises(TypeError, operator.sub)
self.assertRaises(TypeError, operator.sub, None, None)
- self.assertTrue(operator.sub(5, 2) == 3)
+ self.assertEqual(operator.sub(5, 2), 3)
def test_truth(self):
operator = self.module
@@ -292,7 +292,7 @@
operator = self.module
self.assertRaises(TypeError, operator.xor)
self.assertRaises(TypeError, operator.xor, None, None)
- self.assertTrue(operator.xor(0xb, 0xc) == 0x7)
+ self.assertEqual(operator.xor(0xb, 0xc), 0x7)
def test_is(self):
operator = self.module
@@ -596,5 +596,38 @@
module2 = c_operator
+class SubscriptTestCase:
+ def test_subscript(self):
+ subscript = self.module.subscript
+ self.assertIsNone(subscript[None])
+ self.assertEqual(subscript[0], 0)
+ self.assertEqual(subscript[0:1:2], slice(0, 1, 2))
+ self.assertEqual(
+ subscript[0, ..., :2, ...],
+ (0, Ellipsis, slice(2), Ellipsis),
+ )
+
+ def test_pickle(self):
+ from operator import subscript
+ for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+ with self.subTest(proto=proto):
+ self.assertIs(
+ pickle.loads(pickle.dumps(subscript, proto)),
+ subscript,
+ )
+
+ def test_singleton(self):
+ with self.assertRaises(TypeError):
+ type(self.module.subscript)()
+
+ def test_immutable(self):
+ with self.assertRaises(AttributeError):
+ self.module.subscript.attr = None
+
+
+class PySubscriptTestCase(SubscriptTestCase, PyOperatorTestCase):
+ pass
+
+
if __name__ == "__main__":
unittest.main()
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index da5a130..d4b9e9c 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -226,15 +226,10 @@
# Test attributes on return values from os.*stat* family.
class StatAttributeTests(unittest.TestCase):
def setUp(self):
- os.mkdir(support.TESTFN)
- self.fname = os.path.join(support.TESTFN, "f1")
- f = open(self.fname, 'wb')
- f.write(b"ABC")
- f.close()
-
- def tearDown(self):
- os.unlink(self.fname)
- os.rmdir(support.TESTFN)
+ self.fname = support.TESTFN
+ self.addCleanup(support.unlink, self.fname)
+ with open(self.fname, 'wb') as fp:
+ fp.write(b"ABC")
@unittest.skipUnless(hasattr(os, 'stat'), 'test needs os.stat()')
def check_stat_attributes(self, fname):
@@ -426,7 +421,11 @@
0)
# test directory st_file_attributes (FILE_ATTRIBUTE_DIRECTORY set)
- result = os.stat(support.TESTFN)
+ dirname = support.TESTFN + "dir"
+ os.mkdir(dirname)
+ self.addCleanup(os.rmdir, dirname)
+
+ result = os.stat(dirname)
self.check_file_attributes(result)
self.assertEqual(
result.st_file_attributes & stat.FILE_ATTRIBUTE_DIRECTORY,
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index ec5c31b..0533a03 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -811,6 +811,22 @@
self.assertEqual(self._get_summary_line(t.wrap),
"wrap(text) method of textwrap.TextWrapper instance")
+ def test_field_order_for_named_tuples(self):
+ Person = namedtuple('Person', ['nickname', 'firstname', 'agegroup'])
+ s = pydoc.render_doc(Person)
+ self.assertLess(s.index('nickname'), s.index('firstname'))
+ self.assertLess(s.index('firstname'), s.index('agegroup'))
+
+ class NonIterableFields:
+ _fields = None
+
+ class NonHashableFields:
+ _fields = [[]]
+
+ # Make sure these doesn't fail
+ pydoc.render_doc(NonIterableFields)
+ pydoc.render_doc(NonHashableFields)
+
@requires_docstrings
def test_bound_builtin_method(self):
s = StringIO()
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index a398a4f..2e33555 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -1,21 +1,36 @@
"""
Tests of regrtest.py.
+
+Note: test_regrtest cannot be run twice in parallel.
"""
import argparse
import faulthandler
import getopt
import os.path
+import platform
+import re
+import subprocess
+import sys
+import textwrap
import unittest
-from test import regrtest, support
+from test import libregrtest
+from test import support
+
+
+Py_DEBUG = hasattr(sys, 'getobjects')
+ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..')
+ROOT_DIR = os.path.abspath(os.path.normpath(ROOT_DIR))
+
class ParseArgsTestCase(unittest.TestCase):
-
- """Test regrtest's argument parsing."""
+ """
+ Test regrtest's argument parsing, function _parse_args().
+ """
def checkError(self, args, msg):
with support.captured_stderr() as err, self.assertRaises(SystemExit):
- regrtest._parse_args(args)
+ libregrtest._parse_args(args)
self.assertIn(msg, err.getvalue())
def test_help(self):
@@ -23,82 +38,82 @@
with self.subTest(opt=opt):
with support.captured_stdout() as out, \
self.assertRaises(SystemExit):
- regrtest._parse_args([opt])
+ libregrtest._parse_args([opt])
self.assertIn('Run Python regression tests.', out.getvalue())
@unittest.skipUnless(hasattr(faulthandler, 'dump_traceback_later'),
"faulthandler.dump_traceback_later() required")
def test_timeout(self):
- ns = regrtest._parse_args(['--timeout', '4.2'])
+ ns = libregrtest._parse_args(['--timeout', '4.2'])
self.assertEqual(ns.timeout, 4.2)
self.checkError(['--timeout'], 'expected one argument')
self.checkError(['--timeout', 'foo'], 'invalid float value')
def test_wait(self):
- ns = regrtest._parse_args(['--wait'])
+ ns = libregrtest._parse_args(['--wait'])
self.assertTrue(ns.wait)
def test_slaveargs(self):
- ns = regrtest._parse_args(['--slaveargs', '[[], {}]'])
+ ns = libregrtest._parse_args(['--slaveargs', '[[], {}]'])
self.assertEqual(ns.slaveargs, '[[], {}]')
self.checkError(['--slaveargs'], 'expected one argument')
def test_start(self):
for opt in '-S', '--start':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt, 'foo'])
+ ns = libregrtest._parse_args([opt, 'foo'])
self.assertEqual(ns.start, 'foo')
self.checkError([opt], 'expected one argument')
def test_verbose(self):
- ns = regrtest._parse_args(['-v'])
+ ns = libregrtest._parse_args(['-v'])
self.assertEqual(ns.verbose, 1)
- ns = regrtest._parse_args(['-vvv'])
+ ns = libregrtest._parse_args(['-vvv'])
self.assertEqual(ns.verbose, 3)
- ns = regrtest._parse_args(['--verbose'])
+ ns = libregrtest._parse_args(['--verbose'])
self.assertEqual(ns.verbose, 1)
- ns = regrtest._parse_args(['--verbose'] * 3)
+ ns = libregrtest._parse_args(['--verbose'] * 3)
self.assertEqual(ns.verbose, 3)
- ns = regrtest._parse_args([])
+ ns = libregrtest._parse_args([])
self.assertEqual(ns.verbose, 0)
def test_verbose2(self):
for opt in '-w', '--verbose2':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
+ ns = libregrtest._parse_args([opt])
self.assertTrue(ns.verbose2)
def test_verbose3(self):
for opt in '-W', '--verbose3':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
+ ns = libregrtest._parse_args([opt])
self.assertTrue(ns.verbose3)
def test_quiet(self):
for opt in '-q', '--quiet':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
+ ns = libregrtest._parse_args([opt])
self.assertTrue(ns.quiet)
self.assertEqual(ns.verbose, 0)
def test_slow(self):
for opt in '-o', '--slow':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
+ ns = libregrtest._parse_args([opt])
self.assertTrue(ns.print_slow)
def test_header(self):
- ns = regrtest._parse_args(['--header'])
+ ns = libregrtest._parse_args(['--header'])
self.assertTrue(ns.header)
def test_randomize(self):
for opt in '-r', '--randomize':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
+ ns = libregrtest._parse_args([opt])
self.assertTrue(ns.randomize)
def test_randseed(self):
- ns = regrtest._parse_args(['--randseed', '12345'])
+ ns = libregrtest._parse_args(['--randseed', '12345'])
self.assertEqual(ns.random_seed, 12345)
self.assertTrue(ns.randomize)
self.checkError(['--randseed'], 'expected one argument')
@@ -107,7 +122,7 @@
def test_fromfile(self):
for opt in '-f', '--fromfile':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt, 'foo'])
+ ns = libregrtest._parse_args([opt, 'foo'])
self.assertEqual(ns.fromfile, 'foo')
self.checkError([opt], 'expected one argument')
self.checkError([opt, 'foo', '-s'], "don't go together")
@@ -115,42 +130,42 @@
def test_exclude(self):
for opt in '-x', '--exclude':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
+ ns = libregrtest._parse_args([opt])
self.assertTrue(ns.exclude)
def test_single(self):
for opt in '-s', '--single':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
+ ns = libregrtest._parse_args([opt])
self.assertTrue(ns.single)
self.checkError([opt, '-f', 'foo'], "don't go together")
def test_match(self):
for opt in '-m', '--match':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt, 'pattern'])
+ ns = libregrtest._parse_args([opt, 'pattern'])
self.assertEqual(ns.match_tests, 'pattern')
self.checkError([opt], 'expected one argument')
def test_failfast(self):
for opt in '-G', '--failfast':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt, '-v'])
+ ns = libregrtest._parse_args([opt, '-v'])
self.assertTrue(ns.failfast)
- ns = regrtest._parse_args([opt, '-W'])
+ ns = libregrtest._parse_args([opt, '-W'])
self.assertTrue(ns.failfast)
self.checkError([opt], '-G/--failfast needs either -v or -W')
def test_use(self):
for opt in '-u', '--use':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt, 'gui,network'])
+ ns = libregrtest._parse_args([opt, 'gui,network'])
self.assertEqual(ns.use_resources, ['gui', 'network'])
- ns = regrtest._parse_args([opt, 'gui,none,network'])
+ ns = libregrtest._parse_args([opt, 'gui,none,network'])
self.assertEqual(ns.use_resources, ['network'])
- expected = list(regrtest.RESOURCE_NAMES)
+ expected = list(libregrtest.RESOURCE_NAMES)
expected.remove('gui')
- ns = regrtest._parse_args([opt, 'all,-gui'])
+ ns = libregrtest._parse_args([opt, 'all,-gui'])
self.assertEqual(ns.use_resources, expected)
self.checkError([opt], 'expected one argument')
self.checkError([opt, 'foo'], 'invalid resource')
@@ -158,31 +173,31 @@
def test_memlimit(self):
for opt in '-M', '--memlimit':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt, '4G'])
+ ns = libregrtest._parse_args([opt, '4G'])
self.assertEqual(ns.memlimit, '4G')
self.checkError([opt], 'expected one argument')
def test_testdir(self):
- ns = regrtest._parse_args(['--testdir', 'foo'])
+ ns = libregrtest._parse_args(['--testdir', 'foo'])
self.assertEqual(ns.testdir, os.path.join(support.SAVEDCWD, 'foo'))
self.checkError(['--testdir'], 'expected one argument')
def test_runleaks(self):
for opt in '-L', '--runleaks':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
+ ns = libregrtest._parse_args([opt])
self.assertTrue(ns.runleaks)
def test_huntrleaks(self):
for opt in '-R', '--huntrleaks':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt, ':'])
+ ns = libregrtest._parse_args([opt, ':'])
self.assertEqual(ns.huntrleaks, (5, 4, 'reflog.txt'))
- ns = regrtest._parse_args([opt, '6:'])
+ ns = libregrtest._parse_args([opt, '6:'])
self.assertEqual(ns.huntrleaks, (6, 4, 'reflog.txt'))
- ns = regrtest._parse_args([opt, ':3'])
+ ns = libregrtest._parse_args([opt, ':3'])
self.assertEqual(ns.huntrleaks, (5, 3, 'reflog.txt'))
- ns = regrtest._parse_args([opt, '6:3:leaks.log'])
+ ns = libregrtest._parse_args([opt, '6:3:leaks.log'])
self.assertEqual(ns.huntrleaks, (6, 3, 'leaks.log'))
self.checkError([opt], 'expected one argument')
self.checkError([opt, '6'],
@@ -193,24 +208,23 @@
def test_multiprocess(self):
for opt in '-j', '--multiprocess':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt, '2'])
+ ns = libregrtest._parse_args([opt, '2'])
self.assertEqual(ns.use_mp, 2)
self.checkError([opt], 'expected one argument')
self.checkError([opt, 'foo'], 'invalid int value')
self.checkError([opt, '2', '-T'], "don't go together")
self.checkError([opt, '2', '-l'], "don't go together")
- self.checkError([opt, '2', '-M', '4G'], "don't go together")
def test_coverage(self):
for opt in '-T', '--coverage':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
+ ns = libregrtest._parse_args([opt])
self.assertTrue(ns.trace)
def test_coverdir(self):
for opt in '-D', '--coverdir':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt, 'foo'])
+ ns = libregrtest._parse_args([opt, 'foo'])
self.assertEqual(ns.coverdir,
os.path.join(support.SAVEDCWD, 'foo'))
self.checkError([opt], 'expected one argument')
@@ -218,13 +232,13 @@
def test_nocoverdir(self):
for opt in '-N', '--nocoverdir':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
+ ns = libregrtest._parse_args([opt])
self.assertIsNone(ns.coverdir)
def test_threshold(self):
for opt in '-t', '--threshold':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt, '1000'])
+ ns = libregrtest._parse_args([opt, '1000'])
self.assertEqual(ns.threshold, 1000)
self.checkError([opt], 'expected one argument')
self.checkError([opt, 'foo'], 'invalid int value')
@@ -232,13 +246,13 @@
def test_nowindows(self):
for opt in '-n', '--nowindows':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
+ ns = libregrtest._parse_args([opt])
self.assertTrue(ns.nowindows)
def test_forever(self):
for opt in '-F', '--forever':
with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
+ ns = libregrtest._parse_args([opt])
self.assertTrue(ns.forever)
@@ -246,30 +260,438 @@
self.checkError(['--xxx'], 'usage:')
def test_long_option__partial(self):
- ns = regrtest._parse_args(['--qui'])
+ ns = libregrtest._parse_args(['--qui'])
self.assertTrue(ns.quiet)
self.assertEqual(ns.verbose, 0)
def test_two_options(self):
- ns = regrtest._parse_args(['--quiet', '--exclude'])
+ ns = libregrtest._parse_args(['--quiet', '--exclude'])
self.assertTrue(ns.quiet)
self.assertEqual(ns.verbose, 0)
self.assertTrue(ns.exclude)
def test_option_with_empty_string_value(self):
- ns = regrtest._parse_args(['--start', ''])
+ ns = libregrtest._parse_args(['--start', ''])
self.assertEqual(ns.start, '')
def test_arg(self):
- ns = regrtest._parse_args(['foo'])
+ ns = libregrtest._parse_args(['foo'])
self.assertEqual(ns.args, ['foo'])
def test_option_and_arg(self):
- ns = regrtest._parse_args(['--quiet', 'foo'])
+ ns = libregrtest._parse_args(['--quiet', 'foo'])
self.assertTrue(ns.quiet)
self.assertEqual(ns.verbose, 0)
self.assertEqual(ns.args, ['foo'])
+class BaseTestCase(unittest.TestCase):
+ TEST_UNIQUE_ID = 1
+ TESTNAME_PREFIX = 'test_regrtest_'
+ TESTNAME_REGEX = r'test_[a-z0-9_]+'
+
+ def setUp(self):
+ self.testdir = os.path.join(ROOT_DIR, 'Lib', 'test')
+
+ # When test_regrtest is interrupted by CTRL+c, it can leave
+ # temporary test files
+ remove = [entry.path
+ for entry in os.scandir(self.testdir)
+ if (entry.name.startswith(self.TESTNAME_PREFIX)
+ and entry.name.endswith(".py"))]
+ for path in remove:
+ print("WARNING: test_regrtest: remove %s" % path)
+ support.unlink(path)
+
+ def create_test(self, name=None, code=''):
+ if not name:
+ name = 'noop%s' % BaseTestCase.TEST_UNIQUE_ID
+ BaseTestCase.TEST_UNIQUE_ID += 1
+
+ # test_regrtest cannot be run twice in parallel because
+ # of setUp() and create_test()
+ name = self.TESTNAME_PREFIX + "%s_%s" % (os.getpid(), name)
+ path = os.path.join(self.testdir, name + '.py')
+
+ self.addCleanup(support.unlink, path)
+ # Use 'x' mode to ensure that we do not override existing tests
+ with open(path, 'x', encoding='utf-8') as fp:
+ fp.write(code)
+ return name
+
+ def regex_search(self, regex, output):
+ match = re.search(regex, output, re.MULTILINE)
+ if not match:
+ self.fail("%r not found in %r" % (regex, output))
+ return match
+
+ def check_line(self, output, regex):
+ regex = re.compile(r'^' + regex, re.MULTILINE)
+ self.assertRegex(output, regex)
+
+ def parse_executed_tests(self, output):
+ regex = r'^\[ *[0-9]+(?:/ *[0-9]+)?\] (%s)$' % self.TESTNAME_REGEX
+ parser = re.finditer(regex, output, re.MULTILINE)
+ return list(match.group(1) for match in parser)
+
+ def check_executed_tests(self, output, tests, skipped=(), failed=(),
+ randomize=False):
+ if isinstance(tests, str):
+ tests = [tests]
+ if isinstance(skipped, str):
+ skipped = [skipped]
+ if isinstance(failed, str):
+ failed = [failed]
+ ntest = len(tests)
+ nskipped = len(skipped)
+ nfailed = len(failed)
+
+ executed = self.parse_executed_tests(output)
+ if randomize:
+ self.assertEqual(set(executed), set(tests), output)
+ else:
+ self.assertEqual(executed, tests, output)
+
+ def plural(count):
+ return 's' if count != 1 else ''
+
+ def list_regex(line_format, tests):
+ count = len(tests)
+ names = ' '.join(sorted(tests))
+ regex = line_format % (count, plural(count))
+ regex = r'%s:\n %s$' % (regex, names)
+ return regex
+
+ if skipped:
+ regex = list_regex('%s test%s skipped', skipped)
+ self.check_line(output, regex)
+
+ if failed:
+ regex = list_regex('%s test%s failed', failed)
+ self.check_line(output, regex)
+
+ good = ntest - nskipped - nfailed
+ if good:
+ regex = r'%s test%s OK\.$' % (good, plural(good))
+ if not skipped and not failed and good > 1:
+ regex = 'All %s' % regex
+ self.check_line(output, regex)
+
+ def parse_random_seed(self, output):
+ match = self.regex_search(r'Using random seed ([0-9]+)', output)
+ randseed = int(match.group(1))
+ self.assertTrue(0 <= randseed <= 10000000, randseed)
+ return randseed
+
+ def run_command(self, args, input=None, exitcode=0, **kw):
+ if not input:
+ input = ''
+ if 'stderr' not in kw:
+ kw['stderr'] = subprocess.PIPE
+ proc = subprocess.run(args,
+ universal_newlines=True,
+ input=input,
+ stdout=subprocess.PIPE,
+ **kw)
+ if proc.returncode != exitcode:
+ msg = ("Command %s failed with exit code %s\n"
+ "\n"
+ "stdout:\n"
+ "---\n"
+ "%s\n"
+ "---\n"
+ % (str(args), proc.returncode, proc.stdout))
+ if proc.stderr:
+ msg += ("\n"
+ "stderr:\n"
+ "---\n"
+ "%s"
+ "---\n"
+ % proc.stderr)
+ self.fail(msg)
+ return proc
+
+
+ def run_python(self, args, **kw):
+ args = [sys.executable, '-X', 'faulthandler', '-I', *args]
+ proc = self.run_command(args, **kw)
+ return proc.stdout
+
+
+class ProgramsTestCase(BaseTestCase):
+ """
+ Test various ways to run the Python test suite. Use options close
+ to options used on the buildbot.
+ """
+
+ NTEST = 4
+
+ def setUp(self):
+ super().setUp()
+
+ # Create NTEST tests doing nothing
+ self.tests = [self.create_test() for index in range(self.NTEST)]
+
+ self.python_args = ['-Wd', '-E', '-bb']
+ self.regrtest_args = ['-uall', '-rwW', '--timeout', '3600', '-j4']
+ if sys.platform == 'win32':
+ self.regrtest_args.append('-n')
+
+ def check_output(self, output):
+ self.parse_random_seed(output)
+ self.check_executed_tests(output, self.tests, randomize=True)
+
+ def run_tests(self, args):
+ output = self.run_python(args)
+ self.check_output(output)
+
+ def test_script_regrtest(self):
+ # Lib/test/regrtest.py
+ script = os.path.join(ROOT_DIR, 'Lib', 'test', 'regrtest.py')
+
+ args = [*self.python_args, script, *self.regrtest_args, *self.tests]
+ self.run_tests(args)
+
+ def test_module_test(self):
+ # -m test
+ args = [*self.python_args, '-m', 'test',
+ *self.regrtest_args, *self.tests]
+ self.run_tests(args)
+
+ def test_module_regrtest(self):
+ # -m test.regrtest
+ args = [*self.python_args, '-m', 'test.regrtest',
+ *self.regrtest_args, *self.tests]
+ self.run_tests(args)
+
+ def test_module_autotest(self):
+ # -m test.autotest
+ args = [*self.python_args, '-m', 'test.autotest',
+ *self.regrtest_args, *self.tests]
+ self.run_tests(args)
+
+ def test_module_from_test_autotest(self):
+ # from test import autotest
+ code = 'from test import autotest'
+ args = [*self.python_args, '-c', code,
+ *self.regrtest_args, *self.tests]
+ self.run_tests(args)
+
+ def test_script_autotest(self):
+ # Lib/test/autotest.py
+ script = os.path.join(ROOT_DIR, 'Lib', 'test', 'autotest.py')
+ args = [*self.python_args, script, *self.regrtest_args, *self.tests]
+ self.run_tests(args)
+
+ def test_tools_script_run_tests(self):
+ # Tools/scripts/run_tests.py
+ script = os.path.join(ROOT_DIR, 'Tools', 'scripts', 'run_tests.py')
+ self.run_tests([script, *self.tests])
+
+ def run_batch(self, *args):
+ proc = self.run_command(args)
+ self.check_output(proc.stdout)
+
+ @unittest.skipUnless(sys.platform == 'win32', 'Windows only')
+ def test_tools_buildbot_test(self):
+ # Tools\buildbot\test.bat
+ script = os.path.join(ROOT_DIR, 'Tools', 'buildbot', 'test.bat')
+ test_args = []
+ if platform.architecture()[0] == '64bit':
+ test_args.append('-x64') # 64-bit build
+ if not Py_DEBUG:
+ test_args.append('+d') # Release build, use python.exe
+ self.run_batch(script, *test_args, *self.tests)
+
+ @unittest.skipUnless(sys.platform == 'win32', 'Windows only')
+ def test_pcbuild_rt(self):
+ # PCbuild\rt.bat
+ script = os.path.join(ROOT_DIR, r'PCbuild\rt.bat')
+ rt_args = ["-q"] # Quick, don't run tests twice
+ if platform.architecture()[0] == '64bit':
+ rt_args.append('-x64') # 64-bit build
+ if Py_DEBUG:
+ rt_args.append('-d') # Debug build, use python_d.exe
+ self.run_batch(script, *rt_args, *self.regrtest_args, *self.tests)
+
+
+class ArgsTestCase(BaseTestCase):
+ """
+ Test arguments of the Python test suite.
+ """
+
+ def run_tests(self, *args, **kw):
+ return self.run_python(['-m', 'test', *args], **kw)
+
+ def test_failing_test(self):
+ # test a failing test
+ code = textwrap.dedent("""
+ import unittest
+
+ class FailingTest(unittest.TestCase):
+ def test_failing(self):
+ self.fail("bug")
+ """)
+ test_ok = self.create_test()
+ test_failing = self.create_test(code=code)
+ tests = [test_ok, test_failing]
+
+ output = self.run_tests(*tests, exitcode=1)
+ self.check_executed_tests(output, tests, failed=test_failing)
+
+ def test_resources(self):
+ # test -u command line option
+ tests = {}
+ for resource in ('audio', 'network'):
+ code = 'from test import support\nsupport.requires(%r)' % resource
+ tests[resource] = self.create_test(resource, code)
+ test_names = sorted(tests.values())
+
+ # -u all: 2 resources enabled
+ output = self.run_tests('-u', 'all', *test_names)
+ self.check_executed_tests(output, test_names)
+
+ # -u audio: 1 resource enabled
+ output = self.run_tests('-uaudio', *test_names)
+ self.check_executed_tests(output, test_names,
+ skipped=tests['network'])
+
+ # no option: 0 resources enabled
+ output = self.run_tests(*test_names)
+ self.check_executed_tests(output, test_names,
+ skipped=test_names)
+
+ def test_random(self):
+ # test -r and --randseed command line option
+ code = textwrap.dedent("""
+ import random
+ print("TESTRANDOM: %s" % random.randint(1, 1000))
+ """)
+ test = self.create_test('random', code)
+
+ # first run to get the output with the random seed
+ output = self.run_tests('-r', test)
+ randseed = self.parse_random_seed(output)
+ match = self.regex_search(r'TESTRANDOM: ([0-9]+)', output)
+ test_random = int(match.group(1))
+
+ # try to reproduce with the random seed
+ output = self.run_tests('-r', '--randseed=%s' % randseed, test)
+ randseed2 = self.parse_random_seed(output)
+ self.assertEqual(randseed2, randseed)
+
+ match = self.regex_search(r'TESTRANDOM: ([0-9]+)', output)
+ test_random2 = int(match.group(1))
+ self.assertEqual(test_random2, test_random)
+
+ def test_fromfile(self):
+ # test --fromfile
+ tests = [self.create_test() for index in range(5)]
+
+ # Write the list of files using a format similar to regrtest output:
+ # [1/2] test_1
+ # [2/2] test_2
+ filename = support.TESTFN
+ self.addCleanup(support.unlink, filename)
+ with open(filename, "w") as fp:
+ for index, name in enumerate(tests, 1):
+ print("[%s/%s] %s" % (index, len(tests), name), file=fp)
+
+ output = self.run_tests('--fromfile', filename)
+ self.check_executed_tests(output, tests)
+
+ def test_slow(self):
+ # test --slow
+ tests = [self.create_test() for index in range(3)]
+ output = self.run_tests("--slow", *tests)
+ self.check_executed_tests(output, tests)
+ regex = ('10 slowest tests:\n'
+ '(?:%s: [0-9]+\.[0-9]+s\n){%s}'
+ % (self.TESTNAME_REGEX, len(tests)))
+ self.check_line(output, regex)
+
+ def test_coverage(self):
+ # test --coverage
+ test = self.create_test()
+ output = self.run_tests("--coverage", test)
+ self.check_executed_tests(output, [test])
+ regex = ('lines +cov% +module +\(path\)\n'
+ '(?: *[0-9]+ *[0-9]{1,2}% *[^ ]+ +\([^)]+\)+)+')
+ self.check_line(output, regex)
+
+ def test_wait(self):
+ # test --wait
+ test = self.create_test()
+ output = self.run_tests("--wait", test, input='key')
+ self.check_line(output, 'Press any key to continue')
+
+ def test_forever(self):
+ # test --forever
+ code = textwrap.dedent("""
+ import unittest
+
+ class ForeverTester(unittest.TestCase):
+ RUN = 1
+
+ def test_run(self):
+ ForeverTester.RUN += 1
+ if ForeverTester.RUN > 3:
+ self.fail("fail at the 3rd runs")
+ """)
+ test = self.create_test(code=code)
+ output = self.run_tests('--forever', test, exitcode=1)
+ self.check_executed_tests(output, [test]*3, failed=test)
+
+ @unittest.skipUnless(Py_DEBUG, 'need a debug build')
+ def test_huntrleaks_fd_leak(self):
+ # test --huntrleaks for file descriptor leak
+ code = textwrap.dedent("""
+ import os
+ import unittest
+
+ # Issue #25306: Disable popups and logs to stderr on assertion
+ # failures in MSCRT
+ try:
+ import msvcrt
+ msvcrt.CrtSetReportMode
+ except (ImportError, AttributeError):
+ # no Windows, o release build
+ pass
+ else:
+ for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]:
+ msvcrt.CrtSetReportMode(m, 0)
+
+ class FDLeakTest(unittest.TestCase):
+ def test_leak(self):
+ fd = os.open(__file__, os.O_RDONLY)
+ # bug: never cloes the file descriptor
+ """)
+ test = self.create_test(code=code)
+
+ filename = 'reflog.txt'
+ self.addCleanup(support.unlink, filename)
+ output = self.run_tests('--huntrleaks', '3:3:', test,
+ exitcode=1,
+ stderr=subprocess.STDOUT)
+ self.check_executed_tests(output, [test], failed=test)
+
+ line = 'beginning 6 repetitions\n123456\n......\n'
+ self.check_line(output, re.escape(line))
+
+ line2 = '%s leaked [1, 1, 1] file descriptors, sum=3\n' % test
+ self.check_line(output, re.escape(line2))
+
+ with open(filename) as fp:
+ reflog = fp.read()
+ self.assertEqual(reflog, line2)
+
+ def test_list_tests(self):
+ # test --list-tests
+ tests = [self.create_test() for i in range(5)]
+ output = self.run_tests('--list-tests', *tests)
+ self.assertEqual(output.rstrip().splitlines(),
+ tests)
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/Lib/test/test_rlcompleter.py b/Lib/test/test_rlcompleter.py
index d37b620..2ff0788 100644
--- a/Lib/test/test_rlcompleter.py
+++ b/Lib/test/test_rlcompleter.py
@@ -5,6 +5,7 @@
class CompleteMe:
""" Trivial class used in testing rlcompleter.Completer. """
spam = 1
+ _ham = 2
class TestRlcompleter(unittest.TestCase):
@@ -51,11 +52,25 @@
['str.{}('.format(x) for x in dir(str)
if x.startswith('s')])
self.assertEqual(self.stdcompleter.attr_matches('tuple.foospamegg'), [])
+ expected = sorted({'None.%s%s' % (x, '(' if x != '__doc__' else '')
+ for x in dir(None)})
+ self.assertEqual(self.stdcompleter.attr_matches('None.'), expected)
+ self.assertEqual(self.stdcompleter.attr_matches('None._'), expected)
+ self.assertEqual(self.stdcompleter.attr_matches('None.__'), expected)
# test with a customized namespace
self.assertEqual(self.completer.attr_matches('CompleteMe.sp'),
['CompleteMe.spam'])
self.assertEqual(self.completer.attr_matches('Completeme.egg'), [])
+ self.assertEqual(self.completer.attr_matches('CompleteMe.'),
+ ['CompleteMe.mro(', 'CompleteMe.spam'])
+ self.assertEqual(self.completer.attr_matches('CompleteMe._'),
+ ['CompleteMe._ham'])
+ matches = self.completer.attr_matches('CompleteMe.__')
+ for x in matches:
+ self.assertTrue(x.startswith('CompleteMe.__'), x)
+ self.assertIn('CompleteMe.__name__', matches)
+ self.assertIn('CompleteMe.__new__(', matches)
CompleteMe.me = CompleteMe
self.assertEqual(self.completer.attr_matches('CompleteMe.me.me.sp'),
@@ -67,10 +82,15 @@
def test_complete(self):
completer = rlcompleter.Completer()
self.assertEqual(completer.complete('', 0), '\t')
- self.assertEqual(completer.complete('a', 0), 'and')
- self.assertEqual(completer.complete('a', 1), 'as')
- self.assertEqual(completer.complete('as', 2), 'assert')
- self.assertEqual(completer.complete('an', 0), 'and')
+ self.assertEqual(completer.complete('a', 0), 'and ')
+ self.assertEqual(completer.complete('a', 1), 'as ')
+ self.assertEqual(completer.complete('as', 2), 'assert ')
+ self.assertEqual(completer.complete('an', 0), 'and ')
+ self.assertEqual(completer.complete('pa', 0), 'pass')
+ self.assertEqual(completer.complete('Fa', 0), 'False')
+ self.assertEqual(completer.complete('el', 0), 'elif ')
+ self.assertEqual(completer.complete('el', 1), 'else')
+ self.assertEqual(completer.complete('tr', 0), 'try:')
if __name__ == '__main__':
unittest.main()
diff --git a/Lib/test/test_robotparser.py b/Lib/test/test_robotparser.py
index d01266f..90b3072 100644
--- a/Lib/test/test_robotparser.py
+++ b/Lib/test/test_robotparser.py
@@ -1,6 +1,7 @@
import io
import unittest
import urllib.robotparser
+from collections import namedtuple
from urllib.error import URLError, HTTPError
from urllib.request import urlopen
from test import support
@@ -12,7 +13,8 @@
class RobotTestCase(unittest.TestCase):
- def __init__(self, index=None, parser=None, url=None, good=None, agent=None):
+ def __init__(self, index=None, parser=None, url=None, good=None,
+ agent=None, request_rate=None, crawl_delay=None):
# workaround to make unittest discovery work (see #17066)
if not isinstance(index, int):
return
@@ -25,6 +27,8 @@
self.url = url
self.good = good
self.agent = agent
+ self.request_rate = request_rate
+ self.crawl_delay = crawl_delay
def runTest(self):
if isinstance(self.url, tuple):
@@ -34,6 +38,18 @@
agent = self.agent
if self.good:
self.assertTrue(self.parser.can_fetch(agent, url))
+ self.assertEqual(self.parser.crawl_delay(agent), self.crawl_delay)
+ # if we have actual values for request rate
+ if self.request_rate and self.parser.request_rate(agent):
+ self.assertEqual(
+ self.parser.request_rate(agent).requests,
+ self.request_rate.requests
+ )
+ self.assertEqual(
+ self.parser.request_rate(agent).seconds,
+ self.request_rate.seconds
+ )
+ self.assertEqual(self.parser.request_rate(agent), self.request_rate)
else:
self.assertFalse(self.parser.can_fetch(agent, url))
@@ -43,15 +59,17 @@
tests = unittest.TestSuite()
def RobotTest(index, robots_txt, good_urls, bad_urls,
- agent="test_robotparser"):
+ request_rate, crawl_delay, agent="test_robotparser"):
lines = io.StringIO(robots_txt).readlines()
parser = urllib.robotparser.RobotFileParser()
parser.parse(lines)
for url in good_urls:
- tests.addTest(RobotTestCase(index, parser, url, 1, agent))
+ tests.addTest(RobotTestCase(index, parser, url, 1, agent,
+ request_rate, crawl_delay))
for url in bad_urls:
- tests.addTest(RobotTestCase(index, parser, url, 0, agent))
+ tests.addTest(RobotTestCase(index, parser, url, 0, agent,
+ request_rate, crawl_delay))
# Examples from http://www.robotstxt.org/wc/norobots.html (fetched 2002)
@@ -65,14 +83,18 @@
good = ['/','/test.html']
bad = ['/cyberworld/map/index.html','/tmp/xxx','/foo.html']
+request_rate = None
+crawl_delay = None
-RobotTest(1, doc, good, bad)
+RobotTest(1, doc, good, bad, request_rate, crawl_delay)
# 2.
doc = """
# robots.txt for http://www.example.com/
User-agent: *
+Crawl-delay: 1
+Request-rate: 3/15
Disallow: /cyberworld/map/ # This is an infinite virtual URL space
# Cybermapper knows where to go.
@@ -83,8 +105,10 @@
good = ['/','/test.html',('cybermapper','/cyberworld/map/index.html')]
bad = ['/cyberworld/map/index.html']
+request_rate = None # The parameters should be equal to None since they
+crawl_delay = None # don't apply to the cybermapper user agent
-RobotTest(2, doc, good, bad)
+RobotTest(2, doc, good, bad, request_rate, crawl_delay)
# 3.
doc = """
@@ -95,14 +119,18 @@
good = []
bad = ['/cyberworld/map/index.html','/','/tmp/']
+request_rate = None
+crawl_delay = None
-RobotTest(3, doc, good, bad)
+RobotTest(3, doc, good, bad, request_rate, crawl_delay)
# Examples from http://www.robotstxt.org/wc/norobots-rfc.html (fetched 2002)
# 4.
doc = """
User-agent: figtree
+Crawl-delay: 3
+Request-rate: 9/30
Disallow: /tmp
Disallow: /a%3cd.html
Disallow: /a%2fb.html
@@ -115,8 +143,17 @@
'/~joe/index.html'
]
-RobotTest(4, doc, good, bad, 'figtree')
-RobotTest(5, doc, good, bad, 'FigTree Robot libwww-perl/5.04')
+request_rate = namedtuple('req_rate', 'requests seconds')
+request_rate.requests = 9
+request_rate.seconds = 30
+crawl_delay = 3
+request_rate_bad = None # not actually tested, but we still need to parse it
+crawl_delay_bad = None # in order to accommodate the input parameters
+
+
+RobotTest(4, doc, good, bad, request_rate, crawl_delay, 'figtree' )
+RobotTest(5, doc, good, bad, request_rate_bad, crawl_delay_bad,
+ 'FigTree Robot libwww-perl/5.04')
# 6.
doc = """
@@ -125,14 +162,18 @@
Disallow: /a%3Cd.html
Disallow: /a/b.html
Disallow: /%7ejoe/index.html
+Crawl-delay: 3
+Request-rate: 9/banana
"""
good = ['/tmp',] # XFAIL: '/a%2fb.html'
bad = ['/tmp/','/tmp/a.html',
'/a%3cd.html','/a%3Cd.html',"/a/b.html",
'/%7Ejoe/index.html']
+crawl_delay = 3
+request_rate = None # since request rate has invalid syntax, return None
-RobotTest(6, doc, good, bad)
+RobotTest(6, doc, good, bad, None, None)
# From bug report #523041
@@ -140,12 +181,16 @@
doc = """
User-Agent: *
Disallow: /.
+Crawl-delay: pears
"""
good = ['/foo.html']
-bad = [] # Bug report says "/" should be denied, but that is not in the RFC
+bad = [] # bug report says "/" should be denied, but that is not in the RFC
-RobotTest(7, doc, good, bad)
+crawl_delay = None # since crawl delay has invalid syntax, return None
+request_rate = None
+
+RobotTest(7, doc, good, bad, crawl_delay, request_rate)
# From Google: http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=40364
@@ -154,12 +199,15 @@
User-agent: Googlebot
Allow: /folder1/myfile.html
Disallow: /folder1/
+Request-rate: whale/banana
"""
good = ['/folder1/myfile.html']
bad = ['/folder1/anotherfile.html']
+crawl_delay = None
+request_rate = None # invalid syntax, return none
-RobotTest(8, doc, good, bad, agent="Googlebot")
+RobotTest(8, doc, good, bad, crawl_delay, request_rate, agent="Googlebot")
# 9. This file is incorrect because "Googlebot" is a substring of
# "Googlebot-Mobile", so test 10 works just like test 9.
@@ -174,12 +222,12 @@
good = []
bad = ['/something.jpg']
-RobotTest(9, doc, good, bad, agent="Googlebot")
+RobotTest(9, doc, good, bad, None, None, agent="Googlebot")
good = []
bad = ['/something.jpg']
-RobotTest(10, doc, good, bad, agent="Googlebot-Mobile")
+RobotTest(10, doc, good, bad, None, None, agent="Googlebot-Mobile")
# 11. Get the order correct.
doc = """
@@ -193,12 +241,12 @@
good = []
bad = ['/something.jpg']
-RobotTest(11, doc, good, bad, agent="Googlebot")
+RobotTest(11, doc, good, bad, None, None, agent="Googlebot")
good = ['/something.jpg']
bad = []
-RobotTest(12, doc, good, bad, agent="Googlebot-Mobile")
+RobotTest(12, doc, good, bad, None, None, agent="Googlebot-Mobile")
# 13. Google also got the order wrong in #8. You need to specify the
@@ -212,7 +260,7 @@
good = ['/folder1/myfile.html']
bad = ['/folder1/anotherfile.html']
-RobotTest(13, doc, good, bad, agent="googlebot")
+RobotTest(13, doc, good, bad, None, None, agent="googlebot")
# 14. For issue #6325 (query string support)
@@ -224,7 +272,7 @@
good = ['/some/path']
bad = ['/some/path?name=value']
-RobotTest(14, doc, good, bad)
+RobotTest(14, doc, good, bad, None, None)
# 15. For issue #4108 (obey first * entry)
doc = """
@@ -238,7 +286,7 @@
good = ['/another/path']
bad = ['/some/path']
-RobotTest(15, doc, good, bad)
+RobotTest(15, doc, good, bad, None, None)
# 16. Empty query (issue #17403). Normalizing the url first.
doc = """
@@ -250,7 +298,7 @@
good = ['/some/path?']
bad = ['/another/path?']
-RobotTest(16, doc, good, bad)
+RobotTest(16, doc, good, bad, None, None)
class RobotHandler(BaseHTTPRequestHandler):
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py
index 54de508..ade39fb 100644
--- a/Lib/test/test_set.py
+++ b/Lib/test/test_set.py
@@ -10,6 +10,8 @@
import warnings
import collections
import collections.abc
+import itertools
+import string
class PassThru(Exception):
pass
@@ -711,6 +713,28 @@
addhashvalue(hash(frozenset([e for e, m in elemmasks if m&i])))
self.assertEqual(len(hashvalues), 2**n)
+ def letter_range(n):
+ return string.ascii_letters[:n]
+
+ def zf_range(n):
+ # https://en.wikipedia.org/wiki/Set-theoretic_definition_of_natural_numbers
+ nums = [frozenset()]
+ for i in range(n-1):
+ num = frozenset(nums)
+ nums.append(num)
+ return nums[:n]
+
+ def powerset(s):
+ for i in range(len(s)+1):
+ yield from map(frozenset, itertools.combinations(s, i))
+
+ for n in range(18):
+ t = 2 ** n
+ mask = t - 1
+ for nums in (range, letter_range, zf_range):
+ u = len({h & mask for h in map(hash, powerset(nums(n)))})
+ self.assertGreater(4*u, t)
+
class FrozenSetSubclass(frozenset):
pass
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
index 346e2c6..6b26c8a 100644
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -152,8 +152,8 @@
"'%s' using '%s'; group 'a' = '%s', group 'b' = %s'" %
(found.string, found.re.pattern, found.group('a'),
found.group('b')))
- for directive in ('a','A','b','B','c','d','H','I','j','m','M','p','S',
- 'U','w','W','x','X','y','Y','Z','%'):
+ for directive in ('a','A','b','B','c','d','G','H','I','j','m','M','p',
+ 'S','u','U','V','w','W','x','X','y','Y','Z','%'):
compiled = self.time_re.compile("%" + directive)
found = compiled.match(time.strftime("%" + directive))
self.assertTrue(found, "Matching failed on '%s' using '%s' regex" %
@@ -218,6 +218,26 @@
else:
self.fail("'%s' did not raise ValueError" % bad_format)
+ # Ambiguous or incomplete cases using ISO year/week/weekday directives
+ # 1. ISO week (%V) is specified, but the year is specified with %Y
+ # instead of %G
+ with self.assertRaises(ValueError):
+ _strptime._strptime("1999 50", "%Y %V")
+ # 2. ISO year (%G) and ISO week (%V) are specified, but weekday is not
+ with self.assertRaises(ValueError):
+ _strptime._strptime("1999 51", "%G %V")
+ # 3. ISO year (%G) and weekday are specified, but ISO week (%V) is not
+ for w in ('A', 'a', 'w', 'u'):
+ with self.assertRaises(ValueError):
+ _strptime._strptime("1999 51","%G %{}".format(w))
+ # 4. ISO year is specified alone (e.g. time.strptime('2015', '%G'))
+ with self.assertRaises(ValueError):
+ _strptime._strptime("2015", "%G")
+ # 5. Julian/ordinal day (%j) is specified with %G, but not %Y
+ with self.assertRaises(ValueError):
+ _strptime._strptime("1999 256", "%G %j")
+
+
def test_strptime_exception_context(self):
# check that this doesn't chain exceptions needlessly (see #17572)
with self.assertRaises(ValueError) as e:
@@ -289,7 +309,7 @@
def test_weekday(self):
# Test weekday directives
- for directive in ('A', 'a', 'w'):
+ for directive in ('A', 'a', 'w', 'u'):
self.helper(directive,6)
def test_julian(self):
@@ -458,16 +478,20 @@
# Should be able to infer date if given year, week of year (%U or %W)
# and day of the week
def test_helper(ymd_tuple, test_reason):
- for directive in ('W', 'U'):
- format_string = "%%Y %%%s %%w" % directive
- dt_date = datetime_date(*ymd_tuple)
- strp_input = dt_date.strftime(format_string)
- strp_output = _strptime._strptime_time(strp_input, format_string)
- self.assertTrue(strp_output[:3] == ymd_tuple,
- "%s(%s) test failed w/ '%s': %s != %s (%s != %s)" %
- (test_reason, directive, strp_input,
- strp_output[:3], ymd_tuple,
- strp_output[7], dt_date.timetuple()[7]))
+ for year_week_format in ('%Y %W', '%Y %U', '%G %V'):
+ for weekday_format in ('%w', '%u', '%a', '%A'):
+ format_string = year_week_format + ' ' + weekday_format
+ with self.subTest(test_reason,
+ date=ymd_tuple,
+ format=format_string):
+ dt_date = datetime_date(*ymd_tuple)
+ strp_input = dt_date.strftime(format_string)
+ strp_output = _strptime._strptime_time(strp_input,
+ format_string)
+ msg = "%r: %s != %s" % (strp_input,
+ strp_output[7],
+ dt_date.timetuple()[7])
+ self.assertEqual(strp_output[:3], ymd_tuple, msg)
test_helper((1901, 1, 3), "week 0")
test_helper((1901, 1, 8), "common case")
test_helper((1901, 1, 13), "day on Sunday")
@@ -499,18 +523,25 @@
self.assertEqual(_strptime._strptime_time(value, format)[:-1], expected)
check('2015 0 0', '%Y %U %w', 2014, 12, 28, 0, 0, 0, 6, -3)
check('2015 0 0', '%Y %W %w', 2015, 1, 4, 0, 0, 0, 6, 4)
+ check('2015 1 1', '%G %V %u', 2014, 12, 29, 0, 0, 0, 0, 363)
check('2015 0 1', '%Y %U %w', 2014, 12, 29, 0, 0, 0, 0, -2)
check('2015 0 1', '%Y %W %w', 2014, 12, 29, 0, 0, 0, 0, -2)
+ check('2015 1 2', '%G %V %u', 2014, 12, 30, 0, 0, 0, 1, 364)
check('2015 0 2', '%Y %U %w', 2014, 12, 30, 0, 0, 0, 1, -1)
check('2015 0 2', '%Y %W %w', 2014, 12, 30, 0, 0, 0, 1, -1)
+ check('2015 1 3', '%G %V %u', 2014, 12, 31, 0, 0, 0, 2, 365)
check('2015 0 3', '%Y %U %w', 2014, 12, 31, 0, 0, 0, 2, 0)
check('2015 0 3', '%Y %W %w', 2014, 12, 31, 0, 0, 0, 2, 0)
+ check('2015 1 4', '%G %V %u', 2015, 1, 1, 0, 0, 0, 3, 1)
check('2015 0 4', '%Y %U %w', 2015, 1, 1, 0, 0, 0, 3, 1)
check('2015 0 4', '%Y %W %w', 2015, 1, 1, 0, 0, 0, 3, 1)
+ check('2015 1 5', '%G %V %u', 2015, 1, 2, 0, 0, 0, 4, 2)
check('2015 0 5', '%Y %U %w', 2015, 1, 2, 0, 0, 0, 4, 2)
check('2015 0 5', '%Y %W %w', 2015, 1, 2, 0, 0, 0, 4, 2)
+ check('2015 1 6', '%G %V %u', 2015, 1, 3, 0, 0, 0, 5, 3)
check('2015 0 6', '%Y %U %w', 2015, 1, 3, 0, 0, 0, 5, 3)
check('2015 0 6', '%Y %W %w', 2015, 1, 3, 0, 0, 0, 5, 3)
+ check('2015 1 7', '%G %V %u', 2015, 1, 4, 0, 0, 0, 6, 4)
class CacheTests(unittest.TestCase):
diff --git a/Lib/test/test_symbol.py b/Lib/test/test_symbol.py
new file mode 100644
index 0000000..2dcb9de
--- /dev/null
+++ b/Lib/test/test_symbol.py
@@ -0,0 +1,55 @@
+import unittest
+from test import support
+import filecmp
+import os
+import sys
+import subprocess
+
+
+SYMBOL_FILE = support.findfile('symbol.py')
+GRAMMAR_FILE = os.path.join(os.path.dirname(__file__),
+ '..', '..', 'Include', 'graminit.h')
+TEST_PY_FILE = 'symbol_test.py'
+
+
+class TestSymbolGeneration(unittest.TestCase):
+
+ def _copy_file_without_generated_symbols(self, source_file, dest_file):
+ with open(source_file) as fp:
+ lines = fp.readlines()
+ with open(dest_file, 'w') as fp:
+ fp.writelines(lines[:lines.index("#--start constants--\n") + 1])
+ fp.writelines(lines[lines.index("#--end constants--\n"):])
+
+ def _generate_symbols(self, grammar_file, target_symbol_py_file):
+ proc = subprocess.Popen([sys.executable,
+ SYMBOL_FILE,
+ grammar_file,
+ target_symbol_py_file], stderr=subprocess.PIPE)
+ stderr = proc.communicate()[1]
+ return proc.returncode, stderr
+
+ def compare_files(self, file1, file2):
+ with open(file1) as fp:
+ lines1 = fp.readlines()
+ with open(file2) as fp:
+ lines2 = fp.readlines()
+ self.assertEqual(lines1, lines2)
+
+ @unittest.skipIf(not os.path.exists(GRAMMAR_FILE),
+ 'test only works from source build directory')
+ def test_real_grammar_and_symbol_file(self):
+ output = support.TESTFN
+ self.addCleanup(support.unlink, output)
+
+ self._copy_file_without_generated_symbols(SYMBOL_FILE, output)
+
+ exitcode, stderr = self._generate_symbols(GRAMMAR_FILE, output)
+ self.assertEqual(b'', stderr)
+ self.assertEqual(0, exitcode)
+
+ self.compare_files(SYMBOL_FILE, output)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 8ec38c8..a610621 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -209,7 +209,10 @@
def f():
f()
try:
- for i in (50, 1000):
+ # FIXME: workaround crash for the issue #25274
+ # FIXME: until the crash is fixed
+ #for i in (50, 1000):
+ for i in (150, 1000):
# Issue #5392: stack overflow after hitting recursion limit twice
sys.setrecursionlimit(i)
self.assertRaises(RecursionError, f)
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 76b894e..f883c45 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -1,6 +1,8 @@
from test import support
+import decimal
import enum
import locale
+import math
import platform
import sys
import sysconfig
@@ -21,17 +23,27 @@
TIME_MAXYEAR = (1 << 8 * SIZEOF_INT - 1) - 1
TIME_MINYEAR = -TIME_MAXYEAR - 1
+SEC_TO_US = 10 ** 6
US_TO_NS = 10 ** 3
MS_TO_NS = 10 ** 6
SEC_TO_NS = 10 ** 9
+NS_TO_SEC = 10 ** 9
class _PyTime(enum.IntEnum):
# Round towards minus infinity (-inf)
ROUND_FLOOR = 0
# Round towards infinity (+inf)
ROUND_CEILING = 1
+ # Round to nearest with ties going to nearest even integer
+ ROUND_HALF_EVEN = 2
-ALL_ROUNDING_METHODS = (_PyTime.ROUND_FLOOR, _PyTime.ROUND_CEILING)
+# Rounding modes supported by PyTime
+ROUNDING_MODES = (
+ # (PyTime rounding method, decimal rounding method)
+ (_PyTime.ROUND_FLOOR, decimal.ROUND_FLOOR),
+ (_PyTime.ROUND_CEILING, decimal.ROUND_CEILING),
+ (_PyTime.ROUND_HALF_EVEN, decimal.ROUND_HALF_EVEN),
+)
class TimeTestCase(unittest.TestCase):
@@ -607,79 +619,6 @@
class TestPytime(unittest.TestCase):
- def setUp(self):
- self.invalid_values = (
- -(2 ** 100), 2 ** 100,
- -(2.0 ** 100.0), 2.0 ** 100.0,
- )
-
- @support.cpython_only
- def test_time_t(self):
- from _testcapi import pytime_object_to_time_t
- for obj, time_t, rnd in (
- # Round towards minus infinity (-inf)
- (0, 0, _PyTime.ROUND_FLOOR),
- (-1, -1, _PyTime.ROUND_FLOOR),
- (-1.0, -1, _PyTime.ROUND_FLOOR),
- (-1.9, -2, _PyTime.ROUND_FLOOR),
- (1.0, 1, _PyTime.ROUND_FLOOR),
- (1.9, 1, _PyTime.ROUND_FLOOR),
- # Round towards infinity (+inf)
- (0, 0, _PyTime.ROUND_CEILING),
- (-1, -1, _PyTime.ROUND_CEILING),
- (-1.0, -1, _PyTime.ROUND_CEILING),
- (-1.9, -1, _PyTime.ROUND_CEILING),
- (1.0, 1, _PyTime.ROUND_CEILING),
- (1.9, 2, _PyTime.ROUND_CEILING),
- ):
- self.assertEqual(pytime_object_to_time_t(obj, rnd), time_t)
-
- rnd = _PyTime.ROUND_FLOOR
- for invalid in self.invalid_values:
- self.assertRaises(OverflowError,
- pytime_object_to_time_t, invalid, rnd)
-
- @support.cpython_only
- def test_timespec(self):
- from _testcapi import pytime_object_to_timespec
- for obj, timespec, rnd in (
- # Round towards minus infinity (-inf)
- (0, (0, 0), _PyTime.ROUND_FLOOR),
- (-1, (-1, 0), _PyTime.ROUND_FLOOR),
- (-1.0, (-1, 0), _PyTime.ROUND_FLOOR),
- (1e-9, (0, 1), _PyTime.ROUND_FLOOR),
- (1e-10, (0, 0), _PyTime.ROUND_FLOOR),
- (-1e-9, (-1, 999999999), _PyTime.ROUND_FLOOR),
- (-1e-10, (-1, 999999999), _PyTime.ROUND_FLOOR),
- (-1.2, (-2, 800000000), _PyTime.ROUND_FLOOR),
- (0.9999999999, (0, 999999999), _PyTime.ROUND_FLOOR),
- (1.1234567890, (1, 123456789), _PyTime.ROUND_FLOOR),
- (1.1234567899, (1, 123456789), _PyTime.ROUND_FLOOR),
- (-1.1234567890, (-2, 876543211), _PyTime.ROUND_FLOOR),
- (-1.1234567891, (-2, 876543210), _PyTime.ROUND_FLOOR),
- # Round towards infinity (+inf)
- (0, (0, 0), _PyTime.ROUND_CEILING),
- (-1, (-1, 0), _PyTime.ROUND_CEILING),
- (-1.0, (-1, 0), _PyTime.ROUND_CEILING),
- (1e-9, (0, 1), _PyTime.ROUND_CEILING),
- (1e-10, (0, 1), _PyTime.ROUND_CEILING),
- (-1e-9, (-1, 999999999), _PyTime.ROUND_CEILING),
- (-1e-10, (0, 0), _PyTime.ROUND_CEILING),
- (-1.2, (-2, 800000000), _PyTime.ROUND_CEILING),
- (0.9999999999, (1, 0), _PyTime.ROUND_CEILING),
- (1.1234567890, (1, 123456790), _PyTime.ROUND_CEILING),
- (1.1234567899, (1, 123456790), _PyTime.ROUND_CEILING),
- (-1.1234567890, (-2, 876543211), _PyTime.ROUND_CEILING),
- (-1.1234567891, (-2, 876543211), _PyTime.ROUND_CEILING),
- ):
- with self.subTest(obj=obj, round=rnd, timespec=timespec):
- self.assertEqual(pytime_object_to_timespec(obj, rnd), timespec)
-
- rnd = _PyTime.ROUND_FLOOR
- for invalid in self.invalid_values:
- self.assertRaises(OverflowError,
- pytime_object_to_timespec, invalid, rnd)
-
@unittest.skipUnless(time._STRUCT_TM_ITEMS == 11, "needs tm_zone support")
def test_localtime_timezone(self):
@@ -734,266 +673,291 @@
self.assertIs(lt.tm_zone, None)
-@unittest.skipUnless(_testcapi is not None,
- 'need the _testcapi module')
-class TestPyTime_t(unittest.TestCase):
+@unittest.skipIf(_testcapi is None, 'need the _testcapi module')
+class CPyTimeTestCase:
+ """
+ Base class to test the C _PyTime_t API.
+ """
+ OVERFLOW_SECONDS = None
+
+ def setUp(self):
+ from _testcapi import SIZEOF_TIME_T
+ bits = SIZEOF_TIME_T * 8 - 1
+ self.time_t_min = -2 ** bits
+ self.time_t_max = 2 ** bits - 1
+
+ def time_t_filter(self, seconds):
+ return (self.time_t_min <= seconds <= self.time_t_max)
+
+ def _rounding_values(self, use_float):
+ "Build timestamps used to test rounding."
+
+ units = [1, US_TO_NS, MS_TO_NS, SEC_TO_NS]
+ if use_float:
+ # picoseconds are only tested to pytime_converter accepting floats
+ units.append(1e-3)
+
+ values = (
+ # small values
+ 1, 2, 5, 7, 123, 456, 1234,
+ # 10^k - 1
+ 9,
+ 99,
+ 999,
+ 9999,
+ 99999,
+ 999999,
+ # test half even rounding near 0.5, 1.5, 2.5, 3.5, 4.5
+ 499, 500, 501,
+ 1499, 1500, 1501,
+ 2500,
+ 3500,
+ 4500,
+ )
+
+ ns_timestamps = [0]
+ for unit in units:
+ for value in values:
+ ns = value * unit
+ ns_timestamps.extend((-ns, ns))
+ for pow2 in (0, 5, 10, 15, 22, 23, 24, 30, 33):
+ ns = (2 ** pow2) * SEC_TO_NS
+ ns_timestamps.extend((
+ -ns-1, -ns, -ns+1,
+ ns-1, ns, ns+1
+ ))
+ for seconds in (_testcapi.INT_MIN, _testcapi.INT_MAX):
+ ns_timestamps.append(seconds * SEC_TO_NS)
+ if use_float:
+ # numbers with an extract representation in IEEE 754 (base 2)
+ for pow2 in (3, 7, 10, 15):
+ ns = 2.0 ** (-pow2)
+ ns_timestamps.extend((-ns, ns))
+
+ # seconds close to _PyTime_t type limit
+ ns = (2 ** 63 // SEC_TO_NS) * SEC_TO_NS
+ ns_timestamps.extend((-ns, ns))
+
+ return ns_timestamps
+
+ def _check_rounding(self, pytime_converter, expected_func,
+ use_float, unit_to_sec, value_filter=None):
+
+ def convert_values(ns_timestamps):
+ if use_float:
+ unit_to_ns = SEC_TO_NS / float(unit_to_sec)
+ values = [ns / unit_to_ns for ns in ns_timestamps]
+ else:
+ unit_to_ns = SEC_TO_NS // unit_to_sec
+ values = [ns // unit_to_ns for ns in ns_timestamps]
+
+ if value_filter:
+ values = filter(value_filter, values)
+
+ # remove duplicates and sort
+ return sorted(set(values))
+
+ # test rounding
+ ns_timestamps = self._rounding_values(use_float)
+ valid_values = convert_values(ns_timestamps)
+ for time_rnd, decimal_rnd in ROUNDING_MODES :
+ context = decimal.getcontext()
+ context.rounding = decimal_rnd
+
+ for value in valid_values:
+ debug_info = {'value': value, 'rounding': decimal_rnd}
+ try:
+ result = pytime_converter(value, time_rnd)
+ expected = expected_func(value)
+ except Exception as exc:
+ self.fail("Error on timestamp conversion: %s" % debug_info)
+ self.assertEqual(result,
+ expected,
+ debug_info)
+
+ # test overflow
+ ns = self.OVERFLOW_SECONDS * SEC_TO_NS
+ ns_timestamps = (-ns, ns)
+ overflow_values = convert_values(ns_timestamps)
+ for time_rnd, _ in ROUNDING_MODES :
+ for value in overflow_values:
+ debug_info = {'value': value, 'rounding': time_rnd}
+ with self.assertRaises(OverflowError, msg=debug_info):
+ pytime_converter(value, time_rnd)
+
+ def check_int_rounding(self, pytime_converter, expected_func,
+ unit_to_sec=1, value_filter=None):
+ self._check_rounding(pytime_converter, expected_func,
+ False, unit_to_sec, value_filter)
+
+ def check_float_rounding(self, pytime_converter, expected_func,
+ unit_to_sec=1, value_filter=None):
+ self._check_rounding(pytime_converter, expected_func,
+ True, unit_to_sec, value_filter)
+
+ def decimal_round(self, x):
+ d = decimal.Decimal(x)
+ d = d.quantize(1)
+ return int(d)
+
+
+class TestCPyTime(CPyTimeTestCase, unittest.TestCase):
+ """
+ Test the C _PyTime_t API.
+ """
+ # _PyTime_t is a 64-bit signed integer
+ OVERFLOW_SECONDS = math.ceil((2**63 + 1) / SEC_TO_NS)
+
def test_FromSeconds(self):
from _testcapi import PyTime_FromSeconds
- for seconds in (0, 3, -456, _testcapi.INT_MAX, _testcapi.INT_MIN):
- with self.subTest(seconds=seconds):
- self.assertEqual(PyTime_FromSeconds(seconds),
- seconds * SEC_TO_NS)
+
+ # PyTime_FromSeconds() expects a C int, reject values out of range
+ def c_int_filter(secs):
+ return (_testcapi.INT_MIN <= secs <= _testcapi.INT_MAX)
+
+ self.check_int_rounding(lambda secs, rnd: PyTime_FromSeconds(secs),
+ lambda secs: secs * SEC_TO_NS,
+ value_filter=c_int_filter)
def test_FromSecondsObject(self):
from _testcapi import PyTime_FromSecondsObject
- # Conversion giving the same result for all rounding methods
- for rnd in ALL_ROUNDING_METHODS:
- for obj, ts in (
- # integers
- (0, 0),
- (1, SEC_TO_NS),
- (-3, -3 * SEC_TO_NS),
+ self.check_int_rounding(
+ PyTime_FromSecondsObject,
+ lambda secs: secs * SEC_TO_NS)
- # float: subseconds
- (0.0, 0),
- (1e-9, 1),
- (1e-6, 10 ** 3),
- (1e-3, 10 ** 6),
-
- # float: seconds
- (2.0, 2 * SEC_TO_NS),
- (123.0, 123 * SEC_TO_NS),
- (-7.0, -7 * SEC_TO_NS),
-
- # nanosecond are kept for value <= 2^23 seconds
- (2**22 - 1e-9, 4194303999999999),
- (2**22, 4194304000000000),
- (2**22 + 1e-9, 4194304000000001),
- (2**23 - 1e-9, 8388607999999999),
- (2**23, 8388608000000000),
-
- # start losing precision for value > 2^23 seconds
- (2**23 + 1e-9, 8388608000000002),
-
- # nanoseconds are lost for value > 2^23 seconds
- (2**24 - 1e-9, 16777215999999998),
- (2**24, 16777216000000000),
- (2**24 + 1e-9, 16777216000000000),
- (2**25 - 1e-9, 33554432000000000),
- (2**25 , 33554432000000000),
- (2**25 + 1e-9, 33554432000000000),
-
- # close to 2^63 nanoseconds (_PyTime_t limit)
- (9223372036, 9223372036 * SEC_TO_NS),
- (9223372036.0, 9223372036 * SEC_TO_NS),
- (-9223372036, -9223372036 * SEC_TO_NS),
- (-9223372036.0, -9223372036 * SEC_TO_NS),
- ):
- with self.subTest(obj=obj, round=rnd, timestamp=ts):
- self.assertEqual(PyTime_FromSecondsObject(obj, rnd), ts)
-
- with self.subTest(round=rnd):
- with self.assertRaises(OverflowError):
- PyTime_FromSecondsObject(9223372037, rnd)
- PyTime_FromSecondsObject(9223372037.0, rnd)
- PyTime_FromSecondsObject(-9223372037, rnd)
- PyTime_FromSecondsObject(-9223372037.0, rnd)
-
- # Conversion giving different results depending on the rounding method
- FLOOR = _PyTime.ROUND_FLOOR
- CEILING = _PyTime.ROUND_CEILING
- for obj, ts, rnd in (
- # close to zero
- ( 1e-10, 0, FLOOR),
- ( 1e-10, 1, CEILING),
- (-1e-10, -1, FLOOR),
- (-1e-10, 0, CEILING),
-
- # test rounding of the last nanosecond
- ( 1.1234567899, 1123456789, FLOOR),
- ( 1.1234567899, 1123456790, CEILING),
- (-1.1234567899, -1123456790, FLOOR),
- (-1.1234567899, -1123456789, CEILING),
-
- # close to 1 second
- ( 0.9999999999, 999999999, FLOOR),
- ( 0.9999999999, 1000000000, CEILING),
- (-0.9999999999, -1000000000, FLOOR),
- (-0.9999999999, -999999999, CEILING),
- ):
- with self.subTest(obj=obj, round=rnd, timestamp=ts):
- self.assertEqual(PyTime_FromSecondsObject(obj, rnd), ts)
+ self.check_float_rounding(
+ PyTime_FromSecondsObject,
+ lambda ns: self.decimal_round(ns * SEC_TO_NS))
def test_AsSecondsDouble(self):
from _testcapi import PyTime_AsSecondsDouble
- for nanoseconds, seconds in (
- # near 1 nanosecond
- ( 0, 0.0),
- ( 1, 1e-9),
- (-1, -1e-9),
+ def float_converter(ns):
+ if abs(ns) % SEC_TO_NS == 0:
+ return float(ns // SEC_TO_NS)
+ else:
+ return float(ns) / SEC_TO_NS
- # near 1 second
- (SEC_TO_NS + 1, 1.0 + 1e-9),
- (SEC_TO_NS, 1.0),
- (SEC_TO_NS - 1, 1.0 - 1e-9),
+ self.check_int_rounding(lambda ns, rnd: PyTime_AsSecondsDouble(ns),
+ float_converter,
+ NS_TO_SEC)
- # a few seconds
- (123 * SEC_TO_NS, 123.0),
- (-567 * SEC_TO_NS, -567.0),
+ def create_decimal_converter(self, denominator):
+ denom = decimal.Decimal(denominator)
- # nanosecond are kept for value <= 2^23 seconds
- (4194303999999999, 2**22 - 1e-9),
- (4194304000000000, 2**22),
- (4194304000000001, 2**22 + 1e-9),
+ def converter(value):
+ d = decimal.Decimal(value) / denom
+ return self.decimal_round(d)
- # start losing precision for value > 2^23 seconds
- (8388608000000002, 2**23 + 1e-9),
+ return converter
- # nanoseconds are lost for value > 2^23 seconds
- (16777215999999998, 2**24 - 1e-9),
- (16777215999999999, 2**24 - 1e-9),
- (16777216000000000, 2**24 ),
- (16777216000000001, 2**24 ),
- (16777216000000002, 2**24 + 2e-9),
-
- (33554432000000000, 2**25 ),
- (33554432000000002, 2**25 ),
- (33554432000000004, 2**25 + 4e-9),
-
- # close to 2^63 nanoseconds (_PyTime_t limit)
- (9223372036 * SEC_TO_NS, 9223372036.0),
- (-9223372036 * SEC_TO_NS, -9223372036.0),
- ):
- with self.subTest(nanoseconds=nanoseconds, seconds=seconds):
- self.assertEqual(PyTime_AsSecondsDouble(nanoseconds),
- seconds)
-
- def test_timeval(self):
+ def test_AsTimeval(self):
from _testcapi import PyTime_AsTimeval
- for rnd in ALL_ROUNDING_METHODS:
- for ns, tv in (
- # microseconds
- (0, (0, 0)),
- (1000, (0, 1)),
- (-1000, (-1, 999999)),
- # seconds
- (2 * SEC_TO_NS, (2, 0)),
- (-3 * SEC_TO_NS, (-3, 0)),
- ):
- with self.subTest(nanoseconds=ns, timeval=tv, round=rnd):
- self.assertEqual(PyTime_AsTimeval(ns, rnd), tv)
+ us_converter = self.create_decimal_converter(US_TO_NS)
- FLOOR = _PyTime.ROUND_FLOOR
- CEILING = _PyTime.ROUND_CEILING
- for ns, tv, rnd in (
- # nanoseconds
- (1, (0, 0), FLOOR),
- (1, (0, 1), CEILING),
- (-1, (-1, 999999), FLOOR),
- (-1, (0, 0), CEILING),
+ def timeval_converter(ns):
+ us = us_converter(ns)
+ return divmod(us, SEC_TO_US)
- # seconds + nanoseconds
- (1234567001, (1, 234567), FLOOR),
- (1234567001, (1, 234568), CEILING),
- (-1234567001, (-2, 765432), FLOOR),
- (-1234567001, (-2, 765433), CEILING),
- ):
- with self.subTest(nanoseconds=ns, timeval=tv, round=rnd):
- self.assertEqual(PyTime_AsTimeval(ns, rnd), tv)
+ if sys.platform == 'win32':
+ from _testcapi import LONG_MIN, LONG_MAX
+
+ # On Windows, timeval.tv_sec type is a C long
+ def seconds_filter(secs):
+ return LONG_MIN <= secs <= LONG_MAX
+ else:
+ seconds_filter = self.time_t_filter
+
+ self.check_int_rounding(PyTime_AsTimeval,
+ timeval_converter,
+ NS_TO_SEC,
+ value_filter=seconds_filter)
@unittest.skipUnless(hasattr(_testcapi, 'PyTime_AsTimespec'),
'need _testcapi.PyTime_AsTimespec')
- def test_timespec(self):
+ def test_AsTimespec(self):
from _testcapi import PyTime_AsTimespec
- for ns, ts in (
- # nanoseconds
- (0, (0, 0)),
- (1, (0, 1)),
- (-1, (-1, 999999999)),
- # seconds
- (2 * SEC_TO_NS, (2, 0)),
- (-3 * SEC_TO_NS, (-3, 0)),
+ def timespec_converter(ns):
+ return divmod(ns, SEC_TO_NS)
- # seconds + nanoseconds
- (1234567890, (1, 234567890)),
- (-1234567890, (-2, 765432110)),
- ):
- with self.subTest(nanoseconds=ns, timespec=ts):
- self.assertEqual(PyTime_AsTimespec(ns), ts)
+ self.check_int_rounding(lambda ns, rnd: PyTime_AsTimespec(ns),
+ timespec_converter,
+ NS_TO_SEC,
+ value_filter=self.time_t_filter)
- def test_milliseconds(self):
+ def test_AsMilliseconds(self):
from _testcapi import PyTime_AsMilliseconds
- for rnd in ALL_ROUNDING_METHODS:
- for ns, tv in (
- # milliseconds
- (1 * MS_TO_NS, 1),
- (-2 * MS_TO_NS, -2),
- # seconds
- (2 * SEC_TO_NS, 2000),
- (-3 * SEC_TO_NS, -3000),
- ):
- with self.subTest(nanoseconds=ns, timeval=tv, round=rnd):
- self.assertEqual(PyTime_AsMilliseconds(ns, rnd), tv)
+ self.check_int_rounding(PyTime_AsMilliseconds,
+ self.create_decimal_converter(MS_TO_NS),
+ NS_TO_SEC)
- FLOOR = _PyTime.ROUND_FLOOR
- CEILING = _PyTime.ROUND_CEILING
- for ns, ms, rnd in (
- # nanoseconds
- (1, 0, FLOOR),
- (1, 1, CEILING),
- (-1, -1, FLOOR),
- (-1, 0, CEILING),
-
- # seconds + nanoseconds
- (1234 * MS_TO_NS + 1, 1234, FLOOR),
- (1234 * MS_TO_NS + 1, 1235, CEILING),
- (-1234 * MS_TO_NS - 1, -1235, FLOOR),
- (-1234 * MS_TO_NS - 1, -1234, CEILING),
- ):
- with self.subTest(nanoseconds=ns, milliseconds=ms, round=rnd):
- self.assertEqual(PyTime_AsMilliseconds(ns, rnd), ms)
-
- def test_microseconds(self):
+ def test_AsMicroseconds(self):
from _testcapi import PyTime_AsMicroseconds
- for rnd in ALL_ROUNDING_METHODS:
- for ns, tv in (
- # microseconds
- (1 * US_TO_NS, 1),
- (-2 * US_TO_NS, -2),
- # milliseconds
- (1 * MS_TO_NS, 1000),
- (-2 * MS_TO_NS, -2000),
+ self.check_int_rounding(PyTime_AsMicroseconds,
+ self.create_decimal_converter(US_TO_NS),
+ NS_TO_SEC)
- # seconds
- (2 * SEC_TO_NS, 2000000),
- (-3 * SEC_TO_NS, -3000000),
- ):
- with self.subTest(nanoseconds=ns, timeval=tv, round=rnd):
- self.assertEqual(PyTime_AsMicroseconds(ns, rnd), tv)
- FLOOR = _PyTime.ROUND_FLOOR
- CEILING = _PyTime.ROUND_CEILING
- for ns, ms, rnd in (
- # nanoseconds
- (1, 0, FLOOR),
- (1, 1, CEILING),
- (-1, -1, FLOOR),
- (-1, 0, CEILING),
+class TestOldPyTime(CPyTimeTestCase, unittest.TestCase):
+ """
+ Test the old C _PyTime_t API: _PyTime_ObjectToXXX() functions.
+ """
- # seconds + nanoseconds
- (1234 * US_TO_NS + 1, 1234, FLOOR),
- (1234 * US_TO_NS + 1, 1235, CEILING),
- (-1234 * US_TO_NS - 1, -1235, FLOOR),
- (-1234 * US_TO_NS - 1, -1234, CEILING),
- ):
- with self.subTest(nanoseconds=ns, milliseconds=ms, round=rnd):
- self.assertEqual(PyTime_AsMicroseconds(ns, rnd), ms)
+ # time_t is a 32-bit or 64-bit signed integer
+ OVERFLOW_SECONDS = 2 ** 64
+
+ def test_object_to_time_t(self):
+ from _testcapi import pytime_object_to_time_t
+
+ self.check_int_rounding(pytime_object_to_time_t,
+ lambda secs: secs,
+ value_filter=self.time_t_filter)
+
+ self.check_float_rounding(pytime_object_to_time_t,
+ self.decimal_round,
+ value_filter=self.time_t_filter)
+
+ def create_converter(self, sec_to_unit):
+ def converter(secs):
+ floatpart, intpart = math.modf(secs)
+ intpart = int(intpart)
+ floatpart *= sec_to_unit
+ floatpart = self.decimal_round(floatpart)
+ if floatpart < 0:
+ floatpart += sec_to_unit
+ intpart -= 1
+ elif floatpart >= sec_to_unit:
+ floatpart -= sec_to_unit
+ intpart += 1
+ return (intpart, floatpart)
+ return converter
+
+ def test_object_to_timeval(self):
+ from _testcapi import pytime_object_to_timeval
+
+ self.check_int_rounding(pytime_object_to_timeval,
+ lambda secs: (secs, 0),
+ value_filter=self.time_t_filter)
+
+ self.check_float_rounding(pytime_object_to_timeval,
+ self.create_converter(SEC_TO_US),
+ value_filter=self.time_t_filter)
+
+ def test_object_to_timespec(self):
+ from _testcapi import pytime_object_to_timespec
+
+ self.check_int_rounding(pytime_object_to_timespec,
+ lambda secs: (secs, 0),
+ value_filter=self.time_t_filter)
+
+ self.check_float_rounding(pytime_object_to_timespec,
+ self.create_converter(SEC_TO_NS),
+ value_filter=self.time_t_filter)
if __name__ == "__main__":
diff --git a/Lib/test/test_tools/test_unparse.py b/Lib/test/test_tools/test_unparse.py
index 976a6c5..4b47916 100644
--- a/Lib/test/test_tools/test_unparse.py
+++ b/Lib/test/test_tools/test_unparse.py
@@ -134,6 +134,15 @@
class UnparseTestCase(ASTTestCase):
# Tests for specific bugs found in earlier versions of unparse
+ def test_fstrings(self):
+ # See issue 25180
+ self.check_roundtrip(r"""f'{f"{0}"*3}'""")
+ self.check_roundtrip(r"""f'{f"{y}"*3}'""")
+ self.check_roundtrip(r"""f'{f"{\'x\'}"*3}'""")
+
+ self.check_roundtrip(r'''f"{r'x' f'{\"s\"}'}"''')
+ self.check_roundtrip(r'''f"{r'x'rf'{\"s\"}'}"''')
+
def test_del_statement(self):
self.check_roundtrip("del x, y, z")
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py
index 0552f90..fcf5082 100644
--- a/Lib/test/test_urlparse.py
+++ b/Lib/test/test_urlparse.py
@@ -554,29 +554,27 @@
self.assertEqual(p.port, 80)
self.assertEqual(p.geturl(), url)
- # Verify an illegal port is returned as None
+ # Verify an illegal port raises ValueError
url = b"HTTP://WWW.PYTHON.ORG:65536/doc/#frag"
p = urllib.parse.urlsplit(url)
- self.assertEqual(p.port, None)
+ with self.assertRaisesRegex(ValueError, "out of range"):
+ p.port
def test_attributes_bad_port(self):
- """Check handling of non-integer ports."""
- p = urllib.parse.urlsplit("http://www.example.net:foo")
- self.assertEqual(p.netloc, "www.example.net:foo")
- self.assertRaises(ValueError, lambda: p.port)
-
- p = urllib.parse.urlparse("http://www.example.net:foo")
- self.assertEqual(p.netloc, "www.example.net:foo")
- self.assertRaises(ValueError, lambda: p.port)
-
- # Once again, repeat ourselves to test bytes
- p = urllib.parse.urlsplit(b"http://www.example.net:foo")
- self.assertEqual(p.netloc, b"www.example.net:foo")
- self.assertRaises(ValueError, lambda: p.port)
-
- p = urllib.parse.urlparse(b"http://www.example.net:foo")
- self.assertEqual(p.netloc, b"www.example.net:foo")
- self.assertRaises(ValueError, lambda: p.port)
+ """Check handling of invalid ports."""
+ for bytes in (False, True):
+ for parse in (urllib.parse.urlsplit, urllib.parse.urlparse):
+ for port in ("foo", "1.5", "-1", "0x10"):
+ with self.subTest(bytes=bytes, parse=parse, port=port):
+ netloc = "www.example.net:" + port
+ url = "http://" + netloc
+ if bytes:
+ netloc = netloc.encode("ascii")
+ url = url.encode("ascii")
+ p = parse(url)
+ self.assertEqual(p.netloc, netloc)
+ with self.assertRaises(ValueError):
+ p.port
def test_attributes_without_netloc(self):
# This example is straight from RFC 3261. It looks like it
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py
index 68a582c..6f71d2d 100644
--- a/Lib/test/test_userdict.py
+++ b/Lib/test/test_userdict.py
@@ -29,7 +29,7 @@
self.assertEqual(collections.UserDict(one=1, two=2), d2)
# item sequence constructor
self.assertEqual(collections.UserDict([('one',1), ('two',2)]), d2)
- with self.assertWarnsRegex(PendingDeprecationWarning, "'dict'"):
+ with self.assertWarnsRegex(DeprecationWarning, "'dict'"):
self.assertEqual(collections.UserDict(dict=[('one',1), ('two',2)]), d2)
# both together
self.assertEqual(collections.UserDict([('one',1), ('two',2)], two=3, three=5), d3)
@@ -148,7 +148,7 @@
[('dict', 42)])
self.assertEqual(list(collections.UserDict({}, dict=None).items()),
[('dict', None)])
- with self.assertWarnsRegex(PendingDeprecationWarning, "'dict'"):
+ with self.assertWarnsRegex(DeprecationWarning, "'dict'"):
self.assertEqual(list(collections.UserDict(dict={'a': 42}).items()),
[('a', 42)])
self.assertRaises(TypeError, collections.UserDict, 42)
diff --git a/Lib/test/test_warnings/data/import_warning.py b/Lib/test/test_warnings/data/import_warning.py
index d6ea2ce..32daec1 100644
--- a/Lib/test/test_warnings/data/import_warning.py
+++ b/Lib/test/test_warnings/data/import_warning.py
@@ -1,3 +1,3 @@
import warnings
-warnings.warn('module-level warning', DeprecationWarning, stacklevel=2)
\ No newline at end of file
+warnings.warn('module-level warning', DeprecationWarning, stacklevel=2)
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py
index a97a778..4f19535 100644
--- a/Lib/test/test_zipimport.py
+++ b/Lib/test/test_zipimport.py
@@ -214,7 +214,8 @@
packdir2 = packdir + TESTPACK2 + os.sep
files = {packdir + "__init__" + pyc_ext: (NOW, test_pyc),
packdir2 + "__init__" + pyc_ext: (NOW, test_pyc),
- packdir2 + TESTMOD + pyc_ext: (NOW, test_pyc)}
+ packdir2 + TESTMOD + pyc_ext: (NOW, test_pyc),
+ "spam" + pyc_ext: (NOW, test_pyc)}
z = ZipFile(TEMP_ZIP, "w")
try:
@@ -228,6 +229,14 @@
zi = zipimport.zipimporter(TEMP_ZIP)
self.assertEqual(zi.archive, TEMP_ZIP)
self.assertEqual(zi.is_package(TESTPACK), True)
+
+ find_mod = zi.find_module('spam')
+ self.assertIsNotNone(find_mod)
+ self.assertIsInstance(find_mod, zipimport.zipimporter)
+ self.assertFalse(find_mod.is_package('spam'))
+ load_mod = find_mod.load_module('spam')
+ self.assertEqual(find_mod.get_filename('spam'), load_mod.__file__)
+
mod = zi.load_module(TESTPACK)
self.assertEqual(zi.get_filename(TESTPACK), mod.__file__)
@@ -287,6 +296,16 @@
self.assertEqual(
zi.is_package(TESTPACK2 + os.sep + TESTMOD), False)
+ pkg_path = TEMP_ZIP + os.sep + packdir + TESTPACK2
+ zi2 = zipimport.zipimporter(pkg_path)
+ find_mod_dotted = zi2.find_module(TESTMOD)
+ self.assertIsNotNone(find_mod_dotted)
+ self.assertIsInstance(find_mod_dotted, zipimport.zipimporter)
+ self.assertFalse(zi2.is_package(TESTMOD))
+ load_mod = find_mod_dotted.load_module(TESTMOD)
+ self.assertEqual(
+ find_mod_dotted.get_filename(TESTMOD), load_mod.__file__)
+
mod_path = TESTPACK2 + os.sep + TESTMOD
mod_name = module_path_to_dotted_name(mod_path)
__import__(mod_name)
diff --git a/Lib/timeit.py b/Lib/timeit.py
old mode 100755
new mode 100644
index 2de88f7..98cb3eb
--- a/Lib/timeit.py
+++ b/Lib/timeit.py
@@ -317,20 +317,26 @@
print("%d loops," % number, end=' ')
usec = best * 1e6 / number
if time_unit is not None:
- print("best of %d: %.*g %s per loop" % (repeat, precision,
- usec/units[time_unit], time_unit))
+ scale = units[time_unit]
else:
- if usec < 1000:
- print("best of %d: %.*g usec per loop" % (repeat, precision, usec))
- else:
- msec = usec / 1000
- if msec < 1000:
- print("best of %d: %.*g msec per loop" % (repeat,
- precision, msec))
- else:
- sec = msec / 1000
- print("best of %d: %.*g sec per loop" % (repeat,
- precision, sec))
+ scales = [(scale, unit) for unit, scale in units.items()]
+ scales.sort(reverse=True)
+ for scale, time_unit in scales:
+ if usec >= scale:
+ break
+ print("best of %d: %.*g %s per loop" % (repeat, precision,
+ usec/scale, time_unit))
+ best = min(r)
+ usec = best * 1e6 / number
+ worst = max(r)
+ if worst >= best * 4:
+ usec = worst * 1e6 / number
+ import warnings
+ warnings.warn_explicit(
+ "The test results are likely unreliable. The worst\n"
+ "time (%.*g %s) was more than four times slower than the best time." %
+ (precision, usec/scale, time_unit),
+ UserWarning, '', 0)
return None
if __name__ == "__main__":
diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py
index b9c57ad..bad9596 100644
--- a/Lib/tkinter/ttk.py
+++ b/Lib/tkinter/ttk.py
@@ -381,7 +381,9 @@
a sequence identifying the value for that option."""
if query_opt is not None:
kw[query_opt] = None
- return _val_or_dict(self.tk, kw, self._name, "configure", style)
+ result = _val_or_dict(self.tk, kw, self._name, "configure", style)
+ if result or query_opt:
+ return result
def map(self, style, query_opt=None, **kw):
@@ -466,12 +468,14 @@
def element_names(self):
"""Returns the list of elements defined in the current theme."""
- return self.tk.splitlist(self.tk.call(self._name, "element", "names"))
+ return tuple(n.lstrip('-') for n in self.tk.splitlist(
+ self.tk.call(self._name, "element", "names")))
def element_options(self, elementname):
"""Return the list of elementname's options."""
- return self.tk.splitlist(self.tk.call(self._name, "element", "options", elementname))
+ return tuple(o.lstrip('-') for o in self.tk.splitlist(
+ self.tk.call(self._name, "element", "options", elementname)))
def theme_create(self, themename, parent=None, settings=None):
diff --git a/Lib/traceback.py b/Lib/traceback.py
index 9b69da0..1bac6eb 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -487,10 +487,9 @@
self._load_lines()
@classmethod
- def from_exception(self, exc, *args, **kwargs):
+ def from_exception(cls, exc, *args, **kwargs):
"""Create a TracebackException from an exception."""
- return TracebackException(
- type(exc), exc, exc.__traceback__, *args, **kwargs)
+ return cls(type(exc), exc, exc.__traceback__, *args, **kwargs)
def _load_lines(self):
"""Private API. force all lines in the stack to be loaded."""
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index 01c9e58..5e2155c 100644
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -156,9 +156,8 @@
port = self._hostinfo[1]
if port is not None:
port = int(port, 10)
- # Return None on an illegal port
if not ( 0 <= port <= 65535):
- return None
+ raise ValueError("Port out of range 0-65535")
return port
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index a7fd017..e6abf34 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -138,6 +138,71 @@
_opener = None
def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
*, cafile=None, capath=None, cadefault=False, context=None):
+ '''Open the URL url, which can be either a string or a Request object.
+
+ *data* must be a bytes object specifying additional data to be sent to the
+ server, or None if no such data is needed. data may also be an iterable
+ object and in that case Content-Length value must be specified in the
+ headers. Currently HTTP requests are the only ones that use data; the HTTP
+ request will be a POST instead of a GET when the data parameter is
+ provided.
+
+ *data* should be a buffer in the standard application/x-www-form-urlencoded
+ format. The urllib.parse.urlencode() function takes a mapping or sequence
+ of 2-tuples and returns a string in this format. It should be encoded to
+ bytes before being used as the data parameter. The charset parameter in
+ Content-Type header may be used to specify the encoding. If charset
+ parameter is not sent with the Content-Type header, the server following
+ the HTTP 1.1 recommendation may assume that the data is encoded in
+ ISO-8859-1 encoding. It is advisable to use charset parameter with encoding
+ used in Content-Type header with the Request.
+
+ urllib.request module uses HTTP/1.1 and includes a "Connection:close"
+ header in its HTTP requests.
+
+ The optional *timeout* parameter specifies a timeout in seconds for
+ blocking operations like the connection attempt (if not specified, the
+ global default timeout setting will be used). This only works for HTTP,
+ HTTPS and FTP connections.
+
+ If *context* is specified, it must be a ssl.SSLContext instance describing
+ the various SSL options. See HTTPSConnection for more details.
+
+ The optional *cafile* and *capath* parameters specify a set of trusted CA
+ certificates for HTTPS requests. cafile should point to a single file
+ containing a bundle of CA certificates, whereas capath should point to a
+ directory of hashed certificate files. More information can be found in
+ ssl.SSLContext.load_verify_locations().
+
+ The *cadefault* parameter is ignored.
+
+ For http and https urls, this function returns a http.client.HTTPResponse
+ object which has the following HTTPResponse Objects methods.
+
+ For ftp, file, and data urls and requests explicitly handled by legacy
+ URLopener and FancyURLopener classes, this function returns a
+ urllib.response.addinfourl object which can work as context manager and has
+ methods such as:
+
+ * geturl() — return the URL of the resource retrieved, commonly used to
+ determine if a redirect was followed
+
+ * info() — return the meta-information of the page, such as headers, in the
+ form of an email.message_from_string() instance (see Quick Reference to
+ HTTP Headers)
+
+ * getcode() – return the HTTP status code of the response. Raises URLError
+ on errors.
+
+ Note that *None& may be returned if no handler handles the request (though
+ the default installed global OpenerDirector uses UnknownHandler to ensure
+ this never happens).
+
+ In addition, if proxy settings are detected (for example, when a *_proxy
+ environment variable like http_proxy is set), ProxyHandler is default
+ installed and makes sure the requests are handled through the proxy.
+
+ '''
global _opener
if cafile or capath or cadefault:
if context is not None:
diff --git a/Lib/urllib/robotparser.py b/Lib/urllib/robotparser.py
index 4fbb0cb..4ac553a 100644
--- a/Lib/urllib/robotparser.py
+++ b/Lib/urllib/robotparser.py
@@ -10,7 +10,9 @@
http://www.robotstxt.org/norobots-rfc.txt
"""
-import urllib.parse, urllib.request
+import collections
+import urllib.parse
+import urllib.request
__all__ = ["RobotFileParser"]
@@ -120,10 +122,29 @@
if state != 0:
entry.rulelines.append(RuleLine(line[1], True))
state = 2
+ elif line[0] == "crawl-delay":
+ if state != 0:
+ # before trying to convert to int we need to make
+ # sure that robots.txt has valid syntax otherwise
+ # it will crash
+ if line[1].strip().isdigit():
+ entry.delay = int(line[1])
+ state = 2
+ elif line[0] == "request-rate":
+ if state != 0:
+ numbers = line[1].split('/')
+ # check if all values are sane
+ if (len(numbers) == 2 and numbers[0].strip().isdigit()
+ and numbers[1].strip().isdigit()):
+ req_rate = collections.namedtuple('req_rate',
+ 'requests seconds')
+ entry.req_rate = req_rate
+ entry.req_rate.requests = int(numbers[0])
+ entry.req_rate.seconds = int(numbers[1])
+ state = 2
if state == 2:
self._add_entry(entry)
-
def can_fetch(self, useragent, url):
"""using the parsed robots.txt decide if useragent can fetch url"""
if self.disallow_all:
@@ -153,6 +174,18 @@
# agent not found ==> access granted
return True
+ def crawl_delay(self, useragent):
+ for entry in self.entries:
+ if entry.applies_to(useragent):
+ return entry.delay
+ return None
+
+ def request_rate(self, useragent):
+ for entry in self.entries:
+ if entry.applies_to(useragent):
+ return entry.req_rate
+ return None
+
def __str__(self):
return ''.join([str(entry) + "\n" for entry in self.entries])
@@ -180,6 +213,8 @@
def __init__(self):
self.useragents = []
self.rulelines = []
+ self.delay = None
+ self.req_rate = None
def __str__(self):
ret = []
diff --git a/Misc/ACKS b/Misc/ACKS
index 120956e..aa80077 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -151,6 +151,7 @@
Paul Boddie
Matthew Boedicker
Robin Boerdijk
+Nikolay Bogoychev
David Bolen
Wouter Bolsterlee
Gawain Bolton
@@ -879,6 +880,7 @@
Lukas Lueg
Loren Luke
Fredrik Lundh
+Mike Lundy
Zhongyue Luo
Mark Lutz
Taras Lyapun
@@ -1415,6 +1417,7 @@
Christian Tanzer
Steven Taschuk
Amy Taylor
+Julian Taylor
Monty Taylor
Anatoly Techtonik
Gustavo Temple
diff --git a/Misc/NEWS b/Misc/NEWS
index 2602876..41bcd06 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1,12 +1,11 @@
-+++++++++++
++++++++++++
Python News
+++++++++++
+What's New in Python 3.6.0 alpha 1?
+===================================
-What's New in Python 3.5.1 release candidate 1?
-===============================================
-
-Release date: TBA
+Release date: XXXX-XX-XX
Core and Builtins
-----------------
@@ -14,28 +13,40 @@
- Issue #24402: Fix input() to prompt to the redirected stdout when
sys.stdout.fileno() fails.
+- Issue #25349: Optimize bytes % args using the new private _PyBytesWriter API.
+
- Issue #24806: Prevent builtin types that are not allowed to be subclassed from
being subclassed through multiple inheritance.
+* Issue #25301: The UTF-8 decoder is now up to 15 times as fast for error
+ handlers: ``ignore``, ``replace`` and ``surrogateescape``.
+
- Issue #24848: Fixed a number of bugs in UTF-7 decoding of misformed data.
+- Issue #25267: The UTF-8 encoder is now up to 75 times as fast for error
+ handlers: ``ignore``, ``replace``, ``surrogateescape``, ``surrogatepass``.
+ Patch co-written with Serhiy Storchaka.
+
- Issue #25280: Import trace messages emitted in verbose (-v) mode are no
longer formatted twice.
+- Issue #25227: Optimize ASCII and latin1 encoders with the ``surrogateescape``
+ error handler: the encoders are now up to 3 times as fast. Initial patch
+ written by Serhiy Storchaka.
+
- Issue #25003: On Solaris 11.3 or newer, os.urandom() now uses the
getrandom() function instead of the getentropy() function. The getentropy()
function is blocking to generate very good quality entropy, os.urandom()
doesn't need such high-quality entropy.
-- Issue #25182: The stdprinter (used as sys.stderr before the io module is
- imported at startup) now uses the backslashreplace error handler.
+- Issue #9232: Modify Python's grammar to allow trailing commas in the
+ argument list of a function declaration. For example, "def f(\*, a =
+ 3,): pass" is now legal. Patch from Mark Dickinson.
-- Issue #25131: Make the line number and column offset of set/dict literals and
- comprehensions correspond to the opening brace.
-
-- Issue #25150: Hide the private _Py_atomic_xxx symbols from the public
- Python.h header to fix a compilation error with OpenMP. PyThreadState_GET()
- becomes an alias to PyThreadState_Get() to avoid ABI incompatibilies.
+- Issue #24965: Implement PEP 498 "Literal String Interpolation". This
+ allows you to embed expressions inside f-strings, which are
+ converted to normal strings at run time. Given x=3, then
+ f'value={x}' == 'value=3'. Patch by Eric V. Smith.
Library
-------
@@ -43,6 +54,9 @@
- Issue #25328: smtpd's SMTPChannel now correctly raises a ValueError if both
decode_data and enable_SMTPUTF8 are set to true.
+- Issue #16099: RobotFileParser now supports Crawl-delay and Request-rate
+ extensions. Patch by Nikolay Bogoychev.
+
- Issue #25316: distutils raises OSError instead of DistutilsPlatformError
when MSVC is not installed.
@@ -62,6 +76,215 @@
- Issue #24657: Prevent CGIRequestHandler from collapsing slashes in the
query part of the URL as if it were a path. Patch from Xiang Zhang.
+- Issue #25287: Don't add crypt.METHOD_CRYPT to crypt.methods if it's not
+ supported. Check if it is supported, it may not be supported on OpenBSD for
+ example.
+
+- Issue #23600: Default implementation of tzinfo.fromutc() was returning
+ wrong results in some cases.
+
+- Issue #25203: Failed readline.set_completer_delims() no longer left the
+ module in inconsistent state.
+
+- Issue #25011: rlcomplete now omits private and special attribute names unless
+ the prefix starts with underscores.
+
+- Issue #25209: rlcomplete now can add a space or a colon after completed keyword.
+
+- Issue #22241: timezone.utc name is now plain 'UTC', not 'UTC-00:00'.
+
+- Issue #23517: fromtimestamp() and utcfromtimestamp() methods of
+ datetime.datetime now round microseconds to nearest with ties going to
+ nearest even integer (ROUND_HALF_EVEN), as round(float), instead of rounding
+ towards -Infinity (ROUND_FLOOR).
+
+- Issue #23552: Timeit now warns when there is substantial (4x) variance
+ between best and worst times. Patch from Serhiy Storchaka.
+
+- Issue #24633: site-packages/README -> README.txt.
+
+- Issue #24879: help() and pydoc can now list named tuple fields in the
+ order they were defined rather than alphabetically. The ordering is
+ determined by the _fields attribute if present.
+
+- Issue #24874: Improve speed of itertools.cycle() and make its
+ pickle more compact.
+
+- Fix crash in itertools.cycle.__setstate__() when the first argument wasn't
+ a list.
+
+- Issue #20059: urllib.parse raises ValueError on all invalid ports.
+ Patch by Martin Panter.
+
+- Issue #24360: Improve __repr__ of argparse.Namespace() for invalid
+ identifiers. Patch by Matthias Bussonnier.
+
+- Issue #23426: run_setup was broken in distutils.
+ Patch from Alexander Belopolsky.
+
+- Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond.
+
+- Issue #2091: open() accepted a 'U' mode string containing '+', but 'U' can
+ only be used with 'r'. Patch from Jeff Balogh and John O'Connor.
+
+- Issue #8585: improved tests for zipimporter2. Patch from Mark Lawrence.
+
+- Issue #18622: unittest.mock.mock_open().reset_mock would recurse infinitely.
+ Patch from Nicola Palumbo and Laurent De Buyst.
+
+- Issue #24426: Fast searching optimization in regular expressions now works
+ for patterns that starts with capturing groups. Fast searching optimization
+ now can't be disabled at compile time.
+
+- Issue #23661: unittest.mock side_effects can now be exceptions again. This
+ was a regression vs Python 3.4. Patch from Ignacio Rossi
+
+- Issue #13248: Remove deprecated inspect.getargspec and inspect.getmoduleinfo
+ functions.
+
+- Issue #25319: When threading.Event is reinitialized, the underlying condition
+ should use a regular lock rather than a recursive lock.
+
+IDLE
+----
+
+- Issue #24820: IDLE now has an 'IDLE Dark' built-in text color theme.
+ It is more or less IDLE Classic inverted, with a cobalt blue background.
+ Strings, comments, keywords, ... are still green, red, orange, ... .
+ Selecting it displays the following warning and solution.
+ "IDLE Dark is new in October, 2015. Trying to run earlier versions
+ of IDLE with it selected will disable colorizing, or worse.
+ If you might ever run an earlier release of IDLE, then before
+ exiting this version, either switch to another theme or hit the
+ 'Save as New Custom Theme' button. The latter requires a new name,
+ such as 'Custom Dark', but the custom theme will work with any IDLE
+ release, and can be modified."
+
+- Issue #25224: README.txt is now an idlelib index for IDLE developers and
+ curious users. The previous user content is now in the IDLE doc and is
+ redundant. IDLE now means 'Integrated Development and Learning Environment'.
+
+- Issue #24820: Users can now set breakpoint colors in
+ Settings -> Custom Highlighting. Original patch by Mark Roseman.
+
+- Issue #24972: Inactive selection background now matches active selection
+ background, as configured by user, on all systems. Found items are now
+ always highlighted on Windows. Initial patch by Mark Roseman.
+
+- Issue #24570: Idle: make calltip and completion boxes appear on Macs
+ affected by a tk regression. Initial patch by Mark Roseman.
+
+- Issue #24988: Idle ScrolledList context menus (used in debugger)
+ now work on Mac Aqua. Patch by Mark Roseman.
+
+- Issue #24801: Make right-click for context menu work on Mac Aqua.
+ Patch by Mark Roseman.
+
+- Issue #25173: Associate tkinter messageboxes with a specific widget.
+ For Mac OSX, make them a 'sheet'. Patch by Mark Roseman.
+
+- Issue #25198: Enhance the initial html viewer now used for Idle Help.
+ * Properly indent fixed-pitch text (patch by Mark Roseman).
+ * Give code snippet a very Sphinx-like light blueish-gray background.
+ * Re-use initial width and height set by users for shell and editor.
+ * When the Table of Contents (TOC) menu is used, put the section header
+ at the top of the screen.
+
+- Issue #25225: Condense and rewrite Idle doc section on text colors.
+
+- Issue #21995: Explain some differences between IDLE and console Python.
+
+- Issue #22820: Explain need for *print* when running file from Idle editor.
+
+- Issue #25224: Doc: augment Idle feature list and no-subprocess section.
+
+- Issue #25219: Update doc for Idle command line options.
+ Some were missing and notes were not correct.
+
+- Issue #24861: Most of idlelib is private and subject to change.
+ Use idleib.idle.* to start Idle. See idlelib.__init__.__doc__.
+
+- Issue #25199: Idle: add synchronization comments for future maintainers.
+
+- Issue #16893: Replace help.txt with help.html for Idle doc display.
+ The new idlelib/help.html is rstripped Doc/build/html/library/idle.html.
+ It looks better than help.txt and will better document Idle as released.
+ The tkinter html viewer that works for this file was written by Rose Roseman.
+ The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated.
+
+- Issue #24199: Deprecate unused idlelib.idlever with possible removal in 3.6.
+
+- Issue #24782: In Idle extension config dialog, replace tabs with sorted list.
+ Patch by Mark Roseman.
+
+- Issue #24790: Remove extraneous code (which also create 2 & 3 conflicts).
+
+Documentation
+-------------
+
+- Issue #24952: Clarify the default size argument of stack_size() in
+ the "threading" and "_thread" modules. Patch from Mattip.
+
+Tests
+-----
+
+- Issue #25188: Add -P/--pgo to test.regrtest to suppress error output when
+ running the test suite for the purposes of a PGO build. Initial patch by
+ Alecsandru Patrascu.
+
+- Issue #22806: Add ``python -m test --list-tests`` command to list tests.
+
+- Issue #18174: ``python -m test --huntrleaks ...`` now also checks for leak of
+ file descriptors. Patch written by Richard Oudkerk.
+
+- Issue #25260: Fix ``python -m test --coverage`` on Windows. Remove the
+ list of ignored directories.
+
+- PCbuild\rt.bat now accepts an unlimited number of arguments to pass along
+ to regrtest.py. Previously there was a limit of 9.
+
+Build
+-----
+
+- Issue #24986: It is now possible to build Python on Windows without errors
+ when external libraries are not available.
+
+Windows
+-------
+
+- Issue #25022: Removed very outdated PC/example_nt/ directory.
+
+
+What's New in Python 3.5.1 release candidate 1?
+===============================================
+
+Release date: TBA
+
+Core and Builtins
+-----------------
+
+- Issue #24402: Fix input() to prompt to the redirected stdout when
+ sys.stdout.fileno() fails.
+
+- Issue #25182: The stdprinter (used as sys.stderr before the io module is
+ imported at startup) now uses the backslashreplace error handler.
+
+- Issue #25131: Make the line number and column offset of set/dict literals and
+ comprehensions correspond to the opening brace.
+
+- Issue #25150: Hide the private _Py_atomic_xxx symbols from the public
+ Python.h header to fix a compilation error with OpenMP. PyThreadState_GET()
+ becomes an alias to PyThreadState_Get() to avoid ABI incompatibilies.
+
+Library
+-------
+
+- Issue #25232: Fix CGIRequestHandler to split the query from the URL at the
+ first question mark (?) rather than the last. Patch from Xiang Zhang.
+
+- Issue #24657: Prevent CGIRequestHandler from collapsing slashes in the
+ query part of the URL as if it were a path. Patch from Xiang Zhang.
+
- Issue #24483: C implementation of functools.lru_cache() now calculates key's
hash only once.
@@ -83,9 +306,6 @@
- Issue #25233: Rewrite the guts of asyncio.Queue and
asyncio.Semaphore to be more understandable and correct.
-- Issue #25203: Failed readline.set_completer_delims() no longer left the
- module in inconsistent state.
-
- Issue #23600: Default implementation of tzinfo.fromutc() was returning
wrong results in some cases.
@@ -159,9 +379,6 @@
- Issue #24881: Fixed setting binary mode in Python implementation of FileIO
on Windows and Cygwin. Patch from Akira Li.
-- Issue #25319: When threading.Event is reinitialized, the underlying condition
- should use a regular lock rather than a recursive lock.
-
- Issue #21112: Fix regression in unittest.expectedFailure on subclasses.
Patch from Berker Peksag.
@@ -183,81 +400,8 @@
- Issue #23572: Fixed functools.singledispatch on classes with falsy
metaclasses. Patch by Ethan Furman.
-- asyncio: ensure_future() now accepts awaitable objects.
-
-IDLE
-----
-
-- Issue #24820: IDLE now has an 'IDLE Dark' built-in text color theme.
- It is more or less IDLE Classic inverted, with a cobalt blue background.
- Strings, comments, keywords, ... are still green, red, orange, ... .
- Selecting it displays the following warning and solution.
- "IDLE Dark is new in October, 2015. Trying to run earlier versions
- of IDLE with it selected will disable colorizing, or worse.
- If you might ever run an earlier release of IDLE, then before
- exiting this version, either switch to another theme or hit the
- 'Save as New Custom Theme' button. The latter requires a new name,
- such as 'Custom Dark', but the custom theme will work with any IDLE
- release, and can be modified."
-
-- Issue #25224: README.txt is now an idlelib index for IDLE developers and
- curious users. The previous user content is now in the IDLE doc and is
- redundant. IDLE now means 'Integrated Development and Learning Environment'.
-
-- Issue #24820: Users can now set breakpoint colors in
- Settings -> Custom Highlighting. Original patch by Mark Roseman.
-
-- Issue #24972: Inactive selection background now matches active selection
- background, as configured by user, on all systems. Found items are now
- always highlighted on Windows. Initial patch by Mark Roseman.
-
-- Issue #24570: Idle: make calltip and completion boxes appear on Macs
- affected by a tk regression. Initial patch by Mark Roseman.
-
-- Issue #24988: Idle ScrolledList context menus (used in debugger)
- now work on Mac Aqua. Patch by Mark Roseman.
-
-- Issue #24801: Make right-click for context menu work on Mac Aqua.
- Patch by Mark Roseman.
-
-- Issue #25173: Associate tkinter messageboxes with a specific widget.
- For Mac OSX, make them a 'sheet'. Patch by Mark Roseman.
-
-- Issue #25198: Enhance the initial html viewer now used for Idle Help.
- * Properly indent fixed-pitch text (patch by Mark Roseman).
- * Give code snippet a very Sphinx-like light blueish-gray background.
- * Re-use initial width and height set by users for shell and editor.
- * When the Table of Contents (TOC) menu is used, put the section header
- at the top of the screen.
-
-- Issue #25225: Condense and rewrite Idle doc section on text colors.
-
-- Issue #21995: Explain some differences between IDLE and console Python.
-
-- Issue #22820: Explain need for *print* when running file from Idle editor.
-
-- Issue #25224: Doc: augment Idle feature list and no-subprocess section.
-
-- Issue #25219: Update doc for Idle command line options.
- Some were missing and notes were not correct.
-
-- Issue #24861: Most of idlelib is private and subject to change.
- Use idleib.idle.* to start Idle. See idlelib.__init__.__doc__.
-
-- Issue #25199: Idle: add synchronization comments for future maintainers.
-
-- Issue #16893: Replace help.txt with help.html for Idle doc display.
- The new idlelib/help.html is rstripped Doc/build/html/library/idle.html.
- It looks better than help.txt and will better document Idle as released.
- The tkinter html viewer that works for this file was written by Mark Roseman.
- The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated.
-
-- Issue #24199: Deprecate unused idlelib.idlever with possible removal in 3.6.
-
-- Issue #24782: In Idle extension config dialog, replace tabs with sorted list.
- Patch by Mark Roseman.
-
-- Issue #24790: Remove extraneous code (which also create 2 & 3 conflicts).
+- Issue #12006: Add ISO 8601 year, week, and day directives (%G, %V, %u) to
+ strptime.
Documentation
-------------
@@ -303,6 +447,7 @@
- Issue #24986: It is now possible to build Python on Windows without errors
when external libraries are not available.
+
Windows
-------
@@ -329,6 +474,7 @@
- Issue #25022: Removed very outdated PC/example_nt/ directory.
+
What's New in Python 3.5.0 final?
=================================
@@ -571,12 +717,6 @@
- Issue #24631: Fixed regression in the timeit module with multiline setup.
-- Issue #18622: unittest.mock.mock_open().reset_mock would recurse infinitely.
- Patch from Nicola Palumbo and Laurent De Buyst.
-
-- Issue #23661: unittest.mock side_effects can now be exceptions again. This
- was a regression vs Python 3.4. Patch from Ignacio Rossi
-
- Issue #24608: chunk.Chunk.read() now always returns bytes, not str.
- Issue #18684: Fixed reading out of the buffer in the re module.
@@ -587,6 +727,9 @@
- Issue #15014: SMTP.auth() and SMTP.login() now support RFC 4954's optional
initial-response argument to the SMTP AUTH command.
+- Issue #6549: Remove hyphen from ttk.Style().element options. Only return result
+ from ttk.Style().configure if a result was generated or a query submitted.
+
- Issue #24669: Fix inspect.getsource() for 'async def' functions.
Patch by Kai Groner.
@@ -598,7 +741,6 @@
- Issue #24603: Update Windows builds and OS X 10.5 installer to use OpenSSL
1.0.2d.
-
What's New in Python 3.5.0 beta 3?
==================================
@@ -759,6 +901,9 @@
- Issue #24268: PEP 489: Multi-phase extension module initialization.
Patch by Petr Viktorin.
+- Issue #23359: Optimize set object internals by specializing the
+ hash table search into a lookup function and an insert function.
+
- Issue #23955: Add pyvenv.cfg option to suppress registry/environment
lookup for generating sys.path on Windows.
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 66f5939..4ea9140 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -121,7 +121,7 @@
added at about the same rate as old blocks are being freed.
*/
-#define MAXFREEBLOCKS 10
+#define MAXFREEBLOCKS 16
static Py_ssize_t numfreeblocks = 0;
static block *freeblocks[MAXFREEBLOCKS];
@@ -209,7 +209,7 @@
Py_SIZE(deque)--;
deque->state++;
- if (deque->rightindex == -1) {
+ if (deque->rightindex < 0) {
if (Py_SIZE(deque)) {
prevblock = deque->rightblock->leftlink;
assert(deque->leftblock != deque->rightblock);
@@ -315,8 +315,8 @@
MARK_END(b->rightlink);
deque->rightindex = -1;
}
- Py_INCREF(item);
Py_SIZE(deque)++;
+ Py_INCREF(item);
deque->rightindex++;
deque->rightblock->data[deque->rightindex] = item;
deque_trim_left(deque);
@@ -340,8 +340,8 @@
MARK_END(b->leftlink);
deque->leftindex = BLOCKLEN;
}
- Py_INCREF(item);
Py_SIZE(deque)++;
+ Py_INCREF(item);
deque->leftindex--;
deque->leftblock->data[deque->leftindex] = item;
deque_trim_right(deque);
@@ -350,27 +350,42 @@
PyDoc_STRVAR(appendleft_doc, "Add an element to the left side of the deque.");
+static PyObject*
+finalize_iterator(PyObject *it)
+{
+ if (PyErr_Occurred()) {
+ if (PyErr_ExceptionMatches(PyExc_StopIteration))
+ PyErr_Clear();
+ else {
+ Py_DECREF(it);
+ return NULL;
+ }
+ }
+ Py_DECREF(it);
+ Py_RETURN_NONE;
+}
/* Run an iterator to exhaustion. Shortcut for
the extend/extendleft methods when maxlen == 0. */
static PyObject*
consume_iterator(PyObject *it)
{
+ PyObject *(*iternext)(PyObject *);
PyObject *item;
- while ((item = PyIter_Next(it)) != NULL) {
+ iternext = *Py_TYPE(it)->tp_iternext;
+ while ((item = iternext(it)) != NULL) {
Py_DECREF(item);
}
- Py_DECREF(it);
- if (PyErr_Occurred())
- return NULL;
- Py_RETURN_NONE;
+ return finalize_iterator(it);
}
static PyObject *
deque_extend(dequeobject *deque, PyObject *iterable)
{
PyObject *it, *item;
+ PyObject *(*iternext)(PyObject *);
+ int trim = (deque->maxlen != -1);
/* Handle case where id(deque) == id(iterable) */
if ((PyObject *)deque == iterable) {
@@ -398,7 +413,8 @@
if (deque->maxlen == 0)
return consume_iterator(it);
- while ((item = PyIter_Next(it)) != NULL) {
+ iternext = *Py_TYPE(it)->tp_iternext;
+ while ((item = iternext(it)) != NULL) {
deque->state++;
if (deque->rightindex == BLOCKLEN - 1) {
block *b = newblock(Py_SIZE(deque));
@@ -417,14 +433,10 @@
Py_SIZE(deque)++;
deque->rightindex++;
deque->rightblock->data[deque->rightindex] = item;
- deque_trim_left(deque);
+ if (trim)
+ deque_trim_left(deque);
}
- if (PyErr_Occurred()) {
- Py_DECREF(it);
- return NULL;
- }
- Py_DECREF(it);
- Py_RETURN_NONE;
+ return finalize_iterator(it);
}
PyDoc_STRVAR(extend_doc,
@@ -434,6 +446,8 @@
deque_extendleft(dequeobject *deque, PyObject *iterable)
{
PyObject *it, *item;
+ PyObject *(*iternext)(PyObject *);
+ int trim = (deque->maxlen != -1);
/* Handle case where id(deque) == id(iterable) */
if ((PyObject *)deque == iterable) {
@@ -461,7 +475,8 @@
if (deque->maxlen == 0)
return consume_iterator(it);
- while ((item = PyIter_Next(it)) != NULL) {
+ iternext = *Py_TYPE(it)->tp_iternext;
+ while ((item = iternext(it)) != NULL) {
deque->state++;
if (deque->leftindex == 0) {
block *b = newblock(Py_SIZE(deque));
@@ -480,14 +495,10 @@
Py_SIZE(deque)++;
deque->leftindex--;
deque->leftblock->data[deque->leftindex] = item;
- deque_trim_right(deque);
+ if (trim)
+ deque_trim_right(deque);
}
- if (PyErr_Occurred()) {
- Py_DECREF(it);
- return NULL;
- }
- Py_DECREF(it);
- Py_RETURN_NONE;
+ return finalize_iterator(it);
}
PyDoc_STRVAR(extendleft_doc,
@@ -506,7 +517,40 @@
return (PyObject *)deque;
}
-static PyObject *deque_copy(PyObject *deque);
+static PyObject *
+deque_copy(PyObject *deque)
+{
+ dequeobject *old_deque = (dequeobject *)deque;
+ if (Py_TYPE(deque) == &deque_type) {
+ dequeobject *new_deque;
+ PyObject *rv;
+
+ new_deque = (dequeobject *)deque_new(&deque_type, (PyObject *)NULL, (PyObject *)NULL);
+ if (new_deque == NULL)
+ return NULL;
+ new_deque->maxlen = old_deque->maxlen;
+ /* Fast path for the deque_repeat() common case where len(deque) == 1 */
+ if (Py_SIZE(deque) == 1) {
+ PyObject *item = old_deque->leftblock->data[old_deque->leftindex];
+ rv = deque_append(new_deque, item);
+ } else {
+ rv = deque_extend(new_deque, deque);
+ }
+ if (rv != NULL) {
+ Py_DECREF(rv);
+ return (PyObject *)new_deque;
+ }
+ Py_DECREF(new_deque);
+ return NULL;
+ }
+ if (old_deque->maxlen < 0)
+ return PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "O", deque, NULL);
+ else
+ return PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "Oi",
+ deque, old_deque->maxlen, NULL);
+}
+
+PyDoc_STRVAR(copy_doc, "Return a shallow copy of a deque.");
static PyObject *
deque_concat(dequeobject *deque, PyObject *other)
@@ -536,38 +580,93 @@
return new_deque;
}
-static void deque_clear(dequeobject *deque);
+static void
+deque_clear(dequeobject *deque)
+{
+ block *b;
+ block *prevblock;
+ block *leftblock;
+ Py_ssize_t leftindex;
+ Py_ssize_t n;
+ PyObject *item;
+
+ if (Py_SIZE(deque) == 0)
+ return;
+
+ /* During the process of clearing a deque, decrefs can cause the
+ deque to mutate. To avoid fatal confusion, we have to make the
+ deque empty before clearing the blocks and never refer to
+ anything via deque->ref while clearing. (This is the same
+ technique used for clearing lists, sets, and dicts.)
+
+ Making the deque empty requires allocating a new empty block. In
+ the unlikely event that memory is full, we fall back to an
+ alternate method that doesn't require a new block. Repeating
+ pops in a while-loop is slower, possibly re-entrant (and a clever
+ adversary could cause it to never terminate).
+ */
+
+ b = newblock(0);
+ if (b == NULL) {
+ PyErr_Clear();
+ goto alternate_method;
+ }
+
+ /* Remember the old size, leftblock, and leftindex */
+ leftblock = deque->leftblock;
+ leftindex = deque->leftindex;
+ n = Py_SIZE(deque);
+
+ /* Set the deque to be empty using the newly allocated block */
+ MARK_END(b->leftlink);
+ MARK_END(b->rightlink);
+ Py_SIZE(deque) = 0;
+ deque->leftblock = b;
+ deque->rightblock = b;
+ deque->leftindex = CENTER + 1;
+ deque->rightindex = CENTER;
+ deque->state++;
+
+ /* Now the old size, leftblock, and leftindex are disconnected from
+ the empty deque and we can use them to decref the pointers.
+ */
+ while (n--) {
+ item = leftblock->data[leftindex];
+ Py_DECREF(item);
+ leftindex++;
+ if (leftindex == BLOCKLEN && n) {
+ CHECK_NOT_END(leftblock->rightlink);
+ prevblock = leftblock;
+ leftblock = leftblock->rightlink;
+ leftindex = 0;
+ freeblock(prevblock);
+ }
+ }
+ CHECK_END(leftblock->rightlink);
+ freeblock(leftblock);
+ return;
+
+ alternate_method:
+ while (Py_SIZE(deque)) {
+ item = deque_pop(deque, NULL);
+ assert (item != NULL);
+ Py_DECREF(item);
+ }
+}
static PyObject *
-deque_repeat(dequeobject *deque, Py_ssize_t n)
+deque_clearmethod(dequeobject *deque)
{
- dequeobject *new_deque;
- PyObject *result;
-
- /* XXX add a special case for when maxlen is defined */
- if (n < 0)
- n = 0;
- else if (n > 0 && Py_SIZE(deque) > MAX_DEQUE_LEN / n)
- return PyErr_NoMemory();
-
- new_deque = (dequeobject *)deque_new(&deque_type, (PyObject *)NULL, (PyObject *)NULL);
- new_deque->maxlen = deque->maxlen;
-
- for ( ; n ; n--) {
- result = deque_extend(new_deque, (PyObject *)deque);
- if (result == NULL) {
- Py_DECREF(new_deque);
- return NULL;
- }
- Py_DECREF(result);
- }
- return (PyObject *)new_deque;
+ deque_clear(deque);
+ Py_RETURN_NONE;
}
+PyDoc_STRVAR(clear_doc, "Remove all elements from the deque.");
+
static PyObject *
deque_inplace_repeat(dequeobject *deque, Py_ssize_t n)
{
- Py_ssize_t i, size;
+ Py_ssize_t i, m, size;
PyObject *seq;
PyObject *rv;
@@ -583,10 +682,6 @@
return (PyObject *)deque;
}
- if (size > MAX_DEQUE_LEN / n) {
- return PyErr_NoMemory();
- }
-
if (size == 1) {
/* common case, repeating a single element */
PyObject *item = deque->leftblock->data[deque->leftindex];
@@ -594,16 +689,43 @@
if (deque->maxlen != -1 && n > deque->maxlen)
n = deque->maxlen;
- for (i = 0 ; i < n-1 ; i++) {
- rv = deque_append(deque, item);
- if (rv == NULL)
- return NULL;
- Py_DECREF(rv);
+ if (n > MAX_DEQUE_LEN)
+ return PyErr_NoMemory();
+
+ deque->state++;
+ for (i = 0 ; i < n-1 ; ) {
+ if (deque->rightindex == BLOCKLEN - 1) {
+ block *b = newblock(Py_SIZE(deque) + i);
+ if (b == NULL) {
+ Py_SIZE(deque) += i;
+ return NULL;
+ }
+ b->leftlink = deque->rightblock;
+ CHECK_END(deque->rightblock->rightlink);
+ deque->rightblock->rightlink = b;
+ deque->rightblock = b;
+ MARK_END(b->rightlink);
+ deque->rightindex = -1;
+ }
+ m = n - 1 - i;
+ if (m > BLOCKLEN - 1 - deque->rightindex)
+ m = BLOCKLEN - 1 - deque->rightindex;
+ i += m;
+ while (m--) {
+ deque->rightindex++;
+ Py_INCREF(item);
+ deque->rightblock->data[deque->rightindex] = item;
+ }
}
+ Py_SIZE(deque) += i;
Py_INCREF(deque);
return (PyObject *)deque;
}
+ if ((size_t)size > MAX_DEQUE_LEN / (size_t)n) {
+ return PyErr_NoMemory();
+ }
+
seq = PySequence_List((PyObject *)deque);
if (seq == NULL)
return seq;
@@ -621,6 +743,20 @@
return (PyObject *)deque;
}
+static PyObject *
+deque_repeat(dequeobject *deque, Py_ssize_t n)
+{
+ dequeobject *new_deque;
+ PyObject *rv;
+
+ new_deque = (dequeobject *)deque_copy((PyObject *) deque);
+ if (new_deque == NULL)
+ return NULL;
+ rv = deque_inplace_repeat(new_deque, n);
+ Py_DECREF(new_deque);
+ return rv;
+}
+
/* The rotate() method is part of the public API and is used internally
as a primitive for other methods.
@@ -704,7 +840,7 @@
*(dest++) = *(src++);
} while (--m);
}
- if (rightindex == -1) {
+ if (rightindex < 0) {
assert(leftblock != rightblock);
assert(b == NULL);
b = rightblock;
@@ -792,11 +928,10 @@
block *rightblock = deque->rightblock;
Py_ssize_t leftindex = deque->leftindex;
Py_ssize_t rightindex = deque->rightindex;
- Py_ssize_t n = Py_SIZE(deque) / 2;
- Py_ssize_t i;
+ Py_ssize_t n = Py_SIZE(deque) >> 1;
PyObject *tmp;
- for (i=0 ; i<n ; i++) {
+ while (n-- > 0) {
/* Validate that pointers haven't met in the middle */
assert(leftblock != rightblock || leftindex < rightindex);
CHECK_NOT_END(leftblock);
@@ -816,7 +951,7 @@
/* Step backwards with the right block/index pair */
rightindex--;
- if (rightindex == -1) {
+ if (rightindex < 0) {
rightblock = rightblock->leftlink;
rightindex = BLOCKLEN - 1;
}
@@ -833,20 +968,18 @@
block *b = deque->leftblock;
Py_ssize_t index = deque->leftindex;
Py_ssize_t n = Py_SIZE(deque);
- Py_ssize_t i;
Py_ssize_t count = 0;
size_t start_state = deque->state;
PyObject *item;
int cmp;
- for (i=0 ; i<n ; i++) {
+ while (n--) {
CHECK_NOT_END(b);
item = b->data[index];
cmp = PyObject_RichCompareBool(item, v, Py_EQ);
- if (cmp > 0)
- count++;
- else if (cmp < 0)
+ if (cmp < 0)
return NULL;
+ count += cmp;
if (start_state != deque->state) {
PyErr_SetString(PyExc_RuntimeError,
@@ -873,12 +1006,11 @@
block *b = deque->leftblock;
Py_ssize_t index = deque->leftindex;
Py_ssize_t n = Py_SIZE(deque);
- Py_ssize_t i;
size_t start_state = deque->state;
PyObject *item;
int cmp;
- for (i=0 ; i<n ; i++) {
+ while (n--) {
CHECK_NOT_END(b);
item = b->data[index];
cmp = PyObject_RichCompareBool(item, v, Py_EQ);
@@ -1035,84 +1167,10 @@
PyDoc_STRVAR(remove_doc,
"D.remove(value) -- remove first occurrence of value.");
-static void
-deque_clear(dequeobject *deque)
-{
- block *b;
- block *prevblock;
- block *leftblock;
- Py_ssize_t leftindex;
- Py_ssize_t n;
- PyObject *item;
-
- if (Py_SIZE(deque) == 0)
- return;
-
- /* During the process of clearing a deque, decrefs can cause the
- deque to mutate. To avoid fatal confusion, we have to make the
- deque empty before clearing the blocks and never refer to
- anything via deque->ref while clearing. (This is the same
- technique used for clearing lists, sets, and dicts.)
-
- Making the deque empty requires allocating a new empty block. In
- the unlikely event that memory is full, we fall back to an
- alternate method that doesn't require a new block. Repeating
- pops in a while-loop is slower, possibly re-entrant (and a clever
- adversary could cause it to never terminate).
- */
-
- b = newblock(0);
- if (b == NULL) {
- PyErr_Clear();
- goto alternate_method;
- }
-
- /* Remember the old size, leftblock, and leftindex */
- leftblock = deque->leftblock;
- leftindex = deque->leftindex;
- n = Py_SIZE(deque);
-
- /* Set the deque to be empty using the newly allocated block */
- MARK_END(b->leftlink);
- MARK_END(b->rightlink);
- Py_SIZE(deque) = 0;
- deque->leftblock = b;
- deque->rightblock = b;
- deque->leftindex = CENTER + 1;
- deque->rightindex = CENTER;
- deque->state++;
-
- /* Now the old size, leftblock, and leftindex are disconnected from
- the empty deque and we can use them to decref the pointers.
- */
- while (n--) {
- item = leftblock->data[leftindex];
- Py_DECREF(item);
- leftindex++;
- if (leftindex == BLOCKLEN && n) {
- CHECK_NOT_END(leftblock->rightlink);
- prevblock = leftblock;
- leftblock = leftblock->rightlink;
- leftindex = 0;
- freeblock(prevblock);
- }
- }
- CHECK_END(leftblock->rightlink);
- freeblock(leftblock);
- return;
-
- alternate_method:
- while (Py_SIZE(deque)) {
- item = deque_pop(deque, NULL);
- assert (item != NULL);
- Py_DECREF(item);
- }
-}
-
static int
valid_index(Py_ssize_t i, Py_ssize_t limit)
{
- /* The cast to size_t let us use just a single comparison
+ /* The cast to size_t lets us use just a single comparison
to check whether i is in the range: 0 <= i < limit */
return (size_t) i < (size_t) limit;
}
@@ -1209,15 +1267,6 @@
return 0;
}
-static PyObject *
-deque_clearmethod(dequeobject *deque)
-{
- deque_clear(deque);
- Py_RETURN_NONE;
-}
-
-PyDoc_STRVAR(clear_doc, "Remove all elements from the deque.");
-
static void
deque_dealloc(dequeobject *deque)
{
@@ -1257,18 +1306,6 @@
}
static PyObject *
-deque_copy(PyObject *deque)
-{
- if (((dequeobject *)deque)->maxlen == -1)
- return PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "O", deque, NULL);
- else
- return PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "Oi",
- deque, ((dequeobject *)deque)->maxlen, NULL);
-}
-
-PyDoc_STRVAR(copy_doc, "Return a shallow copy of a deque.");
-
-static PyObject *
deque_reduce(dequeobject *deque)
{
PyObject *dict, *result, *aslist;
@@ -1283,12 +1320,12 @@
return NULL;
}
if (dict == NULL) {
- if (deque->maxlen == -1)
+ if (deque->maxlen < 0)
result = Py_BuildValue("O(O)", Py_TYPE(deque), aslist);
else
result = Py_BuildValue("O(On)", Py_TYPE(deque), aslist, deque->maxlen);
} else {
- if (deque->maxlen == -1)
+ if (deque->maxlen < 0)
result = Py_BuildValue("O(OO)O", Py_TYPE(deque), aslist, Py_None, dict);
else
result = Py_BuildValue("O(On)O", Py_TYPE(deque), aslist, deque->maxlen, dict);
@@ -1379,7 +1416,7 @@
}
Py_DECREF(x);
Py_DECREF(y);
- if (b == -1)
+ if (b < 0)
goto done;
}
/* We reached the end of one deque or both */
@@ -1414,8 +1451,14 @@
Py_ssize_t maxlen = -1;
char *kwlist[] = {"iterable", "maxlen", 0};
- if (!PyArg_ParseTupleAndKeywords(args, kwdargs, "|OO:deque", kwlist, &iterable, &maxlenobj))
- return -1;
+ if (kwdargs == NULL) {
+ if (!PyArg_UnpackTuple(args, "deque()", 0, 2, &iterable, &maxlenobj))
+ return -1;
+ } else {
+ if (!PyArg_ParseTupleAndKeywords(args, kwdargs, "|OO:deque", kwlist,
+ &iterable, &maxlenobj))
+ return -1;
+ }
if (maxlenobj != NULL && maxlenobj != Py_None) {
maxlen = PyLong_AsSsize_t(maxlenobj);
if (maxlen == -1 && PyErr_Occurred())
@@ -1463,7 +1506,7 @@
static PyObject *
deque_get_maxlen(dequeobject *deque)
{
- if (deque->maxlen == -1)
+ if (deque->maxlen < 0)
Py_RETURN_NONE;
return PyLong_FromSsize_t(deque->maxlen);
}
@@ -1804,7 +1847,7 @@
item = it->b->data[it->index];
it->index--;
it->counter--;
- if (it->index == -1 && it->counter > 0) {
+ if (it->index < 0 && it->counter > 0) {
CHECK_NOT_END(it->b->leftlink);
it->b = it->b->leftlink;
it->index = BLOCKLEN - 1;
@@ -2233,13 +2276,13 @@
oldval = _PyDict_GetItem_KnownHash(mapping, key, hash);
if (oldval == NULL) {
- if (_PyDict_SetItem_KnownHash(mapping, key, one, hash) == -1)
+ if (_PyDict_SetItem_KnownHash(mapping, key, one, hash) < 0)
goto done;
} else {
newval = PyNumber_Add(oldval, one);
if (newval == NULL)
goto done;
- if (_PyDict_SetItem_KnownHash(mapping, key, newval, hash) == -1)
+ if (_PyDict_SetItem_KnownHash(mapping, key, newval, hash) < 0)
goto done;
Py_CLEAR(newval);
}
@@ -2265,7 +2308,7 @@
Py_DECREF(oldval);
if (newval == NULL)
break;
- if (PyObject_SetItem(mapping, key, newval) == -1)
+ if (PyObject_SetItem(mapping, key, newval) < 0)
break;
Py_CLEAR(newval);
Py_DECREF(key);
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index e3de537..94336cf 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -3287,6 +3287,11 @@
Py_INCREF(self->name);
return self->name;
}
+ if ((PyObject *)self == PyDateTime_TimeZone_UTC ||
+ (GET_TD_DAYS(self->offset) == 0 &&
+ GET_TD_SECONDS(self->offset) == 0 &&
+ GET_TD_MICROSECONDS(self->offset) == 0))
+ return PyUnicode_FromString("UTC");
/* Offset is normalized, so it is negative if days < 0 */
if (GET_TD_DAYS(self->offset) < 0) {
sign = '-';
@@ -4083,44 +4088,6 @@
tzinfo);
}
-static time_t
-_PyTime_DoubleToTimet(double x)
-{
- time_t result;
- double diff;
-
- result = (time_t)x;
- /* How much info did we lose? time_t may be an integral or
- * floating type, and we don't know which. If it's integral,
- * we don't know whether C truncates, rounds, returns the floor,
- * etc. If we lost a second or more, the C rounding is
- * unreasonable, or the input just doesn't fit in a time_t;
- * call it an error regardless. Note that the original cast to
- * time_t can cause a C error too, but nothing we can do to
- * worm around that.
- */
- diff = x - (double)result;
- if (diff <= -1.0 || diff >= 1.0) {
- PyErr_SetString(PyExc_OverflowError,
- "timestamp out of range for platform time_t");
- result = (time_t)-1;
- }
- return result;
-}
-
-/* Round a double to the nearest long. |x| must be small enough to fit
- * in a C long; this is not checked.
- */
-static double
-_PyTime_RoundHalfEven(double x)
-{
- double rounded = round(x);
- if (fabs(x-rounded) == 0.5)
- /* halfway case: round to even */
- rounded = 2.0*round(x/2.0);
- return rounded;
-}
-
/* Internal helper.
* Build datetime from a Python timestamp. Pass localtime or gmtime for f,
* to control the interpretation of the timestamp. Since a double doesn't
@@ -4129,32 +4096,17 @@
* to get that much precision (e.g., C time() isn't good enough).
*/
static PyObject *
-datetime_from_timestamp(PyObject *cls, TM_FUNC f, double timestamp,
+datetime_from_timestamp(PyObject *cls, TM_FUNC f, PyObject *timestamp,
PyObject *tzinfo)
{
time_t timet;
- double fraction;
- int us;
+ long us;
- timet = _PyTime_DoubleToTimet(timestamp);
- if (timet == (time_t)-1 && PyErr_Occurred())
+ if (_PyTime_ObjectToTimeval(timestamp,
+ &timet, &us, _PyTime_ROUND_HALF_EVEN) == -1)
return NULL;
- fraction = timestamp - (double)timet;
- us = (int)_PyTime_RoundHalfEven(fraction * 1e6);
- if (us < 0) {
- /* Truncation towards zero is not what we wanted
- for negative numbers (Python's mod semantics) */
- timet -= 1;
- us += 1000000;
- }
- /* If timestamp is less than one microsecond smaller than a
- * full second, round up. Otherwise, ValueErrors are raised
- * for some floats. */
- if (us == 1000000) {
- timet += 1;
- us = 0;
- }
- return datetime_from_timet_and_us(cls, f, timet, us, tzinfo);
+
+ return datetime_from_timet_and_us(cls, f, timet, (int)us, tzinfo);
}
/* Internal helper.
@@ -4227,11 +4179,11 @@
datetime_fromtimestamp(PyObject *cls, PyObject *args, PyObject *kw)
{
PyObject *self;
- double timestamp;
+ PyObject *timestamp;
PyObject *tzinfo = Py_None;
static char *keywords[] = {"timestamp", "tz", NULL};
- if (! PyArg_ParseTupleAndKeywords(args, kw, "d|O:fromtimestamp",
+ if (! PyArg_ParseTupleAndKeywords(args, kw, "O|O:fromtimestamp",
keywords, ×tamp, &tzinfo))
return NULL;
if (check_tzinfo_subclass(tzinfo) < 0)
@@ -4255,10 +4207,10 @@
static PyObject *
datetime_utcfromtimestamp(PyObject *cls, PyObject *args)
{
- double timestamp;
+ PyObject *timestamp;
PyObject *result = NULL;
- if (PyArg_ParseTuple(args, "d:utcfromtimestamp", ×tamp))
+ if (PyArg_ParseTuple(args, "O:utcfromtimestamp", ×tamp))
result = datetime_from_timestamp(cls, gmtime, timestamp,
Py_None);
return result;
@@ -4761,7 +4713,7 @@
if (seconds == NULL)
goto error;
Py_DECREF(delta);
- timestamp = PyLong_AsLong(seconds);
+ timestamp = _PyLong_AsTime_t(seconds);
Py_DECREF(seconds);
if (timestamp == -1 && PyErr_Occurred())
return NULL;
diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c
index c343862..28604af 100644
--- a/Modules/_heapqmodule.c
+++ b/Modules/_heapqmodule.c
@@ -66,7 +66,7 @@
/* Bubble up the smaller child until hitting a leaf. */
arr = _PyList_ITEMS(heap);
- limit = endpos / 2; /* smallest pos that has no child */
+ limit = endpos >> 1; /* smallest pos that has no child */
while (pos < limit) {
/* Set childpos to index of smaller child. */
childpos = 2*pos + 1; /* leftmost child position */
@@ -347,7 +347,7 @@
n is odd = 2*j+1, this is (2*j+1-1)/2 = j so j-1 is the largest,
and that's again n//2-1.
*/
- for (i = n/2 - 1 ; i >= 0 ; i--)
+ for (i = (n >> 1) - 1 ; i >= 0 ; i--)
if (siftup_func((PyListObject *)heap, i))
return NULL;
Py_RETURN_NONE;
@@ -420,7 +420,7 @@
/* Bubble up the smaller child until hitting a leaf. */
arr = _PyList_ITEMS(heap);
- limit = endpos / 2; /* smallest pos that has no child */
+ limit = endpos >> 1; /* smallest pos that has no child */
while (pos < limit) {
/* Set childpos to index of smaller child. */
childpos = 2*pos + 1; /* leftmost child position */
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index 528bcd4..7428aed 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -238,7 +238,8 @@
int text = 0, binary = 0, universal = 0;
char rawmode[6], *m;
- int line_buffering, isatty;
+ int line_buffering;
+ long isatty;
PyObject *raw, *modeobj = NULL, *buffer, *wrapper, *result = NULL;
@@ -248,8 +249,8 @@
_Py_IDENTIFIER(close);
if (!PyUnicode_Check(file) &&
- !PyBytes_Check(file) &&
- !PyNumber_Check(file)) {
+ !PyBytes_Check(file) &&
+ !PyNumber_Check(file)) {
PyErr_Format(PyExc_TypeError, "invalid file: %R", file);
return NULL;
}
@@ -307,9 +308,9 @@
/* Parameters validation */
if (universal) {
- if (writing || appending) {
+ if (creating || writing || appending || updating) {
PyErr_SetString(PyExc_ValueError,
- "can't use U and writing mode at once");
+ "mode U cannot be combined with x', 'w', 'a', or '+'");
return NULL;
}
if (PyErr_WarnEx(PyExc_DeprecationWarning,
@@ -437,10 +438,10 @@
/* wraps into a TextIOWrapper */
wrapper = PyObject_CallFunction((PyObject *)&PyTextIOWrapper_Type,
- "Osssi",
- buffer,
- encoding, errors, newline,
- line_buffering);
+ "Osssi",
+ buffer,
+ encoding, errors, newline,
+ line_buffering);
if (wrapper == NULL)
goto error;
result = wrapper;
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 957ccbc..6a3d811 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -62,9 +62,6 @@
/* -------------------------------------------------------------------- */
/* optional features */
-/* enables fast searching */
-#define USE_FAST_SEARCH
-
/* enables copy/deepcopy handling (work in progress) */
#undef USE_BUILTIN_COPY
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index ba0a24b..1f013c2 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -2646,7 +2646,9 @@
static int
check_time_rounding(int round)
{
- if (round != _PyTime_ROUND_FLOOR && round != _PyTime_ROUND_CEILING) {
+ if (round != _PyTime_ROUND_FLOOR
+ && round != _PyTime_ROUND_CEILING
+ && round != _PyTime_ROUND_HALF_EVEN) {
PyErr_SetString(PyExc_ValueError, "invalid rounding");
return -1;
}
@@ -4112,6 +4114,7 @@
PyModule_AddObject(m, "PY_SSIZE_T_MAX", PyLong_FromSsize_t(PY_SSIZE_T_MAX));
PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyLong_FromSsize_t(PY_SSIZE_T_MIN));
PyModule_AddObject(m, "SIZEOF_PYGC_HEAD", PyLong_FromSsize_t(sizeof(PyGC_Head)));
+ PyModule_AddObject(m, "SIZEOF_TIME_T", PyLong_FromSsize_t(sizeof(time_t)));
Py_INCREF(&PyInstanceMethod_Type);
PyModule_AddObject(m, "instancemethod", (PyObject *)&PyInstanceMethod_Type);
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index 9ef702a..a48de6a 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -2116,7 +2116,7 @@
"sched_getaffinity($module, pid, /)\n"
"--\n"
"\n"
-"Return the affinity of the process identified by pid.\n"
+"Return the affinity of the process identified by pid (or the current process if zero).\n"
"\n"
"The affinity is returned as a set of CPU identifiers.");
@@ -5178,7 +5178,11 @@
"cpu_count($module, /)\n"
"--\n"
"\n"
-"Return the number of CPUs in the system; return None if indeterminable.");
+"Return the number of CPUs in the system; return None if indeterminable.\n"
+"\n"
+"This number is not equivalent to the number of CPUs the current process can\n"
+"use. The number of usable CPUs can be obtained with\n"
+"``len(os.sched_getaffinity(0))``");
#define OS_CPU_COUNT_METHODDEF \
{"cpu_count", (PyCFunction)os_cpu_count, METH_NOARGS, os_cpu_count__doc__},
@@ -5788,4 +5792,4 @@
#ifndef OS_SET_HANDLE_INHERITABLE_METHODDEF
#define OS_SET_HANDLE_INHERITABLE_METHODDEF
#endif /* !defined(OS_SET_HANDLE_INHERITABLE_METHODDEF) */
-/*[clinic end generated code: output=95824c52fd034654 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a5c9bef9ad11a20b input=a9049054013a1b77]*/
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 16ac2fb..ff7867d 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -1,15 +1,16 @@
+#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
/* Itertools module written and maintained
by Raymond D. Hettinger <python@rcn.com>
- Copyright (c) 2003-2013 Python Software Foundation.
+ Copyright (c) 2003-2015 Python Software Foundation.
All rights reserved.
*/
-/* groupby object ***********************************************************/
+/* groupby object ************************************************************/
typedef struct {
PyObject_HEAD
@@ -87,8 +88,7 @@
else {
int rcmp;
- rcmp = PyObject_RichCompareBool(gbo->tgtkey,
- gbo->currkey, Py_EQ);
+ rcmp = PyObject_RichCompareBool(gbo->tgtkey, gbo->currkey, Py_EQ);
if (rcmp == -1)
return NULL;
else if (rcmp == 0)
@@ -103,8 +103,7 @@
newkey = newvalue;
Py_INCREF(newvalue);
} else {
- newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc,
- newvalue, NULL);
+ newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL);
if (newkey == NULL) {
Py_DECREF(newvalue);
return NULL;
@@ -178,7 +177,7 @@
reduce_doc},
{"__setstate__", (PyCFunction)groupby_setstate, METH_O,
setstate_doc},
- {NULL, NULL} /* sentinel */
+ {NULL, NULL} /* sentinel */
};
PyDoc_STRVAR(groupby_doc,
@@ -301,8 +300,7 @@
newkey = newvalue;
Py_INCREF(newvalue);
} else {
- newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc,
- newvalue, NULL);
+ newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL);
if (newkey == NULL) {
Py_DECREF(newvalue);
return NULL;
@@ -330,8 +328,7 @@
static PyObject *
_grouper_reduce(_grouperobject *lz)
{
- return Py_BuildValue("O(OO)", Py_TYPE(lz),
- lz->parent, lz->tgtkey);
+ return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->parent, lz->tgtkey);
}
static PyMethodDef _grouper_methods[] = {
@@ -364,7 +361,7 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
0, /* tp_doc */
- (traverseproc)_grouper_traverse,/* tp_traverse */
+ (traverseproc)_grouper_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
@@ -385,8 +382,7 @@
};
-
-/* tee object and with supporting function and objects ***************/
+/* tee object and with supporting function and objects ***********************/
/* The teedataobject pre-allocates space for LINKCELLS number of objects.
To help the object fit neatly inside cache lines (space for 16 to 32
@@ -401,7 +397,7 @@
typedef struct {
PyObject_HEAD
PyObject *it;
- int numread; /* 0 <= numread <= LINKCELLS */
+ int numread; /* 0 <= numread <= LINKCELLS */
PyObject *nextlink;
PyObject *(values[LINKCELLS]);
} teedataobject;
@@ -409,7 +405,7 @@
typedef struct {
PyObject_HEAD
teedataobject *dataobj;
- int index; /* 0 <= index <= LINKCELLS */
+ int index; /* 0 <= index <= LINKCELLS */
PyObject *weakreflist;
} teeobject;
@@ -466,6 +462,7 @@
teedataobject_traverse(teedataobject *tdo, visitproc visit, void * arg)
{
int i;
+
Py_VISIT(tdo->it);
for (i = 0; i < tdo->numread; i++)
Py_VISIT(tdo->values[i]);
@@ -515,6 +512,7 @@
int i;
/* create a temporary list of already iterated values */
PyObject *values = PyList_New(tdo->numread);
+
if (!values)
return NULL;
for (i=0 ; i<tdo->numread ; i++) {
@@ -582,7 +580,7 @@
PyDoc_STRVAR(teedataobject_doc, "Data container common to multiple tee objects.");
static PyTypeObject teedataobject_type = {
- PyVarObject_HEAD_INIT(0, 0) /* Must fill in type value later */
+ PyVarObject_HEAD_INIT(0, 0) /* Must fill in type value later */
"itertools._tee_dataobject", /* tp_name */
sizeof(teedataobject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -602,7 +600,7 @@
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
teedataobject_doc, /* tp_doc */
(traverseproc)teedataobject_traverse, /* tp_traverse */
(inquiry)teedataobject_clear, /* tp_clear */
@@ -759,9 +757,9 @@
"Iterator wrapped to make it copyable");
static PyMethodDef tee_methods[] = {
- {"__copy__", (PyCFunction)tee_copy, METH_NOARGS, teecopy_doc},
- {"__reduce__", (PyCFunction)tee_reduce, METH_NOARGS, reduce_doc},
- {"__setstate__", (PyCFunction)tee_setstate, METH_O, setstate_doc},
+ {"__copy__", (PyCFunction)tee_copy, METH_NOARGS, teecopy_doc},
+ {"__reduce__", (PyCFunction)tee_reduce, METH_NOARGS, reduce_doc},
+ {"__setstate__", (PyCFunction)tee_setstate, METH_O, setstate_doc},
{NULL, NULL} /* sentinel */
};
@@ -791,7 +789,7 @@
(traverseproc)tee_traverse, /* tp_traverse */
(inquiry)tee_clear, /* tp_clear */
0, /* tp_richcompare */
- offsetof(teeobject, weakreflist), /* tp_weaklistoffset */
+ offsetof(teeobject, weakreflist), /* tp_weaklistoffset */
PyObject_SelfIter, /* tp_iter */
(iternextfunc)tee_next, /* tp_iternext */
tee_methods, /* tp_methods */
@@ -857,12 +855,13 @@
"tee(iterable, n=2) --> tuple of n independent iterators.");
-/* cycle object **********************************************************/
+/* cycle object **************************************************************/
typedef struct {
PyObject_HEAD
PyObject *it;
PyObject *saved;
+ Py_ssize_t index;
int firstpass;
} cycleobject;
@@ -902,6 +901,7 @@
}
lz->it = it;
lz->saved = saved;
+ lz->index = 0;
lz->firstpass = 0;
return (PyObject *)lz;
@@ -911,15 +911,16 @@
cycle_dealloc(cycleobject *lz)
{
PyObject_GC_UnTrack(lz);
- Py_XDECREF(lz->saved);
Py_XDECREF(lz->it);
+ Py_XDECREF(lz->saved);
Py_TYPE(lz)->tp_free(lz);
}
static int
cycle_traverse(cycleobject *lz, visitproc visit, void *arg)
{
- Py_VISIT(lz->it);
+ if (lz->it)
+ Py_VISIT(lz->it);
Py_VISIT(lz->saved);
return 0;
}
@@ -928,57 +929,70 @@
cycle_next(cycleobject *lz)
{
PyObject *item;
- PyObject *it;
- PyObject *tmp;
- while (1) {
+ if (lz->it != NULL) {
item = PyIter_Next(lz->it);
if (item != NULL) {
- if (!lz->firstpass && PyList_Append(lz->saved, item)) {
+ if (lz->firstpass)
+ return item;
+ if (PyList_Append(lz->saved, item)) {
Py_DECREF(item);
return NULL;
}
return item;
}
- if (PyErr_Occurred()) {
- if (PyErr_ExceptionMatches(PyExc_StopIteration))
- PyErr_Clear();
- else
- return NULL;
- }
- if (PyList_Size(lz->saved) == 0)
+ /* Note: StopIteration is already cleared by PyIter_Next() */
+ if (PyErr_Occurred())
return NULL;
- it = PyObject_GetIter(lz->saved);
- if (it == NULL)
- return NULL;
- tmp = lz->it;
- lz->it = it;
- lz->firstpass = 1;
- Py_DECREF(tmp);
+ Py_CLEAR(lz->it);
}
+ if (Py_SIZE(lz->saved) == 0)
+ return NULL;
+ item = PyList_GET_ITEM(lz->saved, lz->index);
+ lz->index++;
+ if (lz->index >= Py_SIZE(lz->saved))
+ lz->index = 0;
+ Py_INCREF(item);
+ return item;
}
static PyObject *
cycle_reduce(cycleobject *lz)
{
- /* Create a new cycle with the iterator tuple, then set
- * the saved state on it.
- */
- return Py_BuildValue("O(O)(Oi)", Py_TYPE(lz),
- lz->it, lz->saved, lz->firstpass);
+ /* Create a new cycle with the iterator tuple, then set the saved state */
+ if (lz->it == NULL) {
+ PyObject *it = PyObject_GetIter(lz->saved);
+ if (it == NULL)
+ return NULL;
+ if (lz->index != 0) {
+ _Py_IDENTIFIER(__setstate__);
+ PyObject *res = _PyObject_CallMethodId(it, &PyId___setstate__,
+ "n", lz->index);
+ if (res == NULL) {
+ Py_DECREF(it);
+ return NULL;
+ }
+ Py_DECREF(res);
+ }
+ return Py_BuildValue("O(N)(Oi)", Py_TYPE(lz), it, lz->saved, 1);
}
+ return Py_BuildValue("O(O)(Oi)", Py_TYPE(lz), lz->it, lz->saved,
+ lz->firstpass);
+}
static PyObject *
cycle_setstate(cycleobject *lz, PyObject *state)
{
PyObject *saved=NULL;
int firstpass;
- if (!PyArg_ParseTuple(state, "Oi", &saved, &firstpass))
+
+ if (!PyArg_ParseTuple(state, "O!i", &PyList_Type, &saved, &firstpass))
return NULL;
+ Py_INCREF(saved);
Py_CLEAR(lz->saved);
lz->saved = saved;
- Py_XINCREF(lz->saved);
lz->firstpass = firstpass != 0;
+ lz->index = 0;
Py_RETURN_NONE;
}
@@ -1047,7 +1061,7 @@
PyObject_HEAD
PyObject *func;
PyObject *it;
- long start;
+ long start;
} dropwhileobject;
static PyTypeObject dropwhile_type;
@@ -1137,8 +1151,7 @@
static PyObject *
dropwhile_reduce(dropwhileobject *lz)
{
- return Py_BuildValue("O(OO)l", Py_TYPE(lz),
- lz->func, lz->it, lz->start);
+ return Py_BuildValue("O(OO)l", Py_TYPE(lz), lz->func, lz->it, lz->start);
}
static PyObject *
@@ -1189,13 +1202,13 @@
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_BASETYPE, /* tp_flags */
dropwhile_doc, /* tp_doc */
- (traverseproc)dropwhile_traverse, /* tp_traverse */
+ (traverseproc)dropwhile_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
PyObject_SelfIter, /* tp_iter */
(iternextfunc)dropwhile_next, /* tp_iternext */
- dropwhile_methods, /* tp_methods */
+ dropwhile_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
@@ -1216,7 +1229,7 @@
PyObject_HEAD
PyObject *func;
PyObject *it;
- long stop;
+ long stop;
} takewhileobject;
static PyTypeObject takewhile_type;
@@ -1291,7 +1304,7 @@
}
ok = PyObject_IsTrue(good);
Py_DECREF(good);
- if (ok == 1)
+ if (ok > 0)
return item;
Py_DECREF(item);
if (ok == 0)
@@ -1302,14 +1315,14 @@
static PyObject *
takewhile_reduce(takewhileobject *lz)
{
- return Py_BuildValue("O(OO)l", Py_TYPE(lz),
- lz->func, lz->it, lz->stop);
+ return Py_BuildValue("O(OO)l", Py_TYPE(lz), lz->func, lz->it, lz->stop);
}
static PyObject *
takewhile_reduce_setstate(takewhileobject *lz, PyObject *state)
{
int stop = PyObject_IsTrue(state);
+
if (stop < 0)
return NULL;
lz->stop = stop;
@@ -1353,7 +1366,7 @@
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_BASETYPE, /* tp_flags */
takewhile_doc, /* tp_doc */
- (traverseproc)takewhile_traverse, /* tp_traverse */
+ (traverseproc)takewhile_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
@@ -1374,7 +1387,7 @@
};
-/* islice object ************************************************************/
+/* islice object *************************************************************/
typedef struct {
PyObject_HEAD
@@ -1410,7 +1423,8 @@
if (PyErr_Occurred())
PyErr_Clear();
PyErr_SetString(PyExc_ValueError,
- "Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize.");
+ "Stop argument for islice() must be None or "
+ "an integer: 0 <= x <= sys.maxsize.");
return NULL;
}
}
@@ -1425,14 +1439,16 @@
if (PyErr_Occurred())
PyErr_Clear();
PyErr_SetString(PyExc_ValueError,
- "Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize.");
+ "Stop argument for islice() must be None or "
+ "an integer: 0 <= x <= sys.maxsize.");
return NULL;
}
}
}
if (start<0 || stop<-1) {
PyErr_SetString(PyExc_ValueError,
- "Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.");
+ "Indices for islice() must be None or "
+ "an integer: 0 <= x <= sys.maxsize.");
return NULL;
}
@@ -1529,6 +1545,7 @@
* then 'setstate' with the next and count
*/
PyObject *stop;
+
if (lz->it == NULL) {
PyObject *empty_list;
PyObject *empty_it;
@@ -1558,6 +1575,7 @@
islice_setstate(isliceobject *lz, PyObject *state)
{
Py_ssize_t cnt = PyLong_AsSsize_t(state);
+
if (cnt == -1 && PyErr_Occurred())
return NULL;
lz->cnt = cnt;
@@ -1772,7 +1790,7 @@
};
-/* chain object ************************************************************/
+/* chain object **************************************************************/
typedef struct {
PyObject_HEAD
@@ -1848,32 +1866,32 @@
PyObject *item;
if (lz->source == NULL)
- return NULL; /* already stopped */
+ return NULL; /* already stopped */
if (lz->active == NULL) {
PyObject *iterable = PyIter_Next(lz->source);
if (iterable == NULL) {
Py_CLEAR(lz->source);
- return NULL; /* no more input sources */
+ return NULL; /* no more input sources */
}
lz->active = PyObject_GetIter(iterable);
Py_DECREF(iterable);
if (lz->active == NULL) {
Py_CLEAR(lz->source);
- return NULL; /* input not iterable */
+ return NULL; /* input not iterable */
}
}
- item = PyIter_Next(lz->active);
+ item = (*Py_TYPE(lz->active)->tp_iternext)(lz->active);
if (item != NULL)
return item;
if (PyErr_Occurred()) {
if (PyErr_ExceptionMatches(PyExc_StopIteration))
PyErr_Clear();
else
- return NULL; /* input raised an exception */
+ return NULL; /* input raised an exception */
}
Py_CLEAR(lz->active);
- return chain_next(lz); /* recurse and use next active */
+ return chain_next(lz); /* recurse and use next active */
}
static PyObject *
@@ -1899,6 +1917,7 @@
chain_setstate(chainobject *lz, PyObject *state)
{
PyObject *source, *active=NULL;
+
if (! PyArg_ParseTuple(state, "O|O", &source, &active))
return NULL;
@@ -1925,13 +1944,13 @@
that evaluates lazily.");
static PyMethodDef chain_methods[] = {
- {"from_iterable", (PyCFunction) chain_new_from_iterable, METH_O | METH_CLASS,
- chain_from_iterable_doc},
+ {"from_iterable", (PyCFunction) chain_new_from_iterable, METH_O | METH_CLASS,
+ chain_from_iterable_doc},
{"__reduce__", (PyCFunction)chain_reduce, METH_NOARGS,
reduce_doc},
{"__setstate__", (PyCFunction)chain_setstate, METH_O,
setstate_doc},
- {NULL, NULL} /* sentinel */
+ {NULL, NULL} /* sentinel */
};
static PyTypeObject chain_type = {
@@ -1983,10 +2002,10 @@
typedef struct {
PyObject_HEAD
- PyObject *pools; /* tuple of pool tuples */
- Py_ssize_t *indices; /* one index per pool */
- PyObject *result; /* most recently returned result tuple */
- int stopped; /* set to 1 when the product iterator is exhausted */
+ PyObject *pools; /* tuple of pool tuples */
+ Py_ssize_t *indices; /* one index per pool */
+ PyObject *result; /* most recently returned result tuple */
+ int stopped; /* set to 1 when the iterator is exhausted */
} productobject;
static PyTypeObject product_type;
@@ -2005,7 +2024,8 @@
PyObject *tmpargs = PyTuple_New(0);
if (tmpargs == NULL)
return NULL;
- if (!PyArg_ParseTupleAndKeywords(tmpargs, kwds, "|n:product", kwlist, &repeat)) {
+ if (!PyArg_ParseTupleAndKeywords(tmpargs, kwds, "|n:product",
+ kwlist, &repeat)) {
Py_DECREF(tmpargs);
return NULL;
}
@@ -2295,7 +2315,7 @@
static PyTypeObject product_type = {
PyVarObject_HEAD_INIT(NULL, 0)
"itertools.product", /* tp_name */
- sizeof(productobject), /* tp_basicsize */
+ sizeof(productobject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor)product_dealloc, /* tp_dealloc */
@@ -2337,15 +2357,15 @@
};
-/* combinations object ************************************************************/
+/* combinations object *******************************************************/
typedef struct {
PyObject_HEAD
- PyObject *pool; /* input converted to a tuple */
- Py_ssize_t *indices; /* one index per result element */
- PyObject *result; /* most recently returned result tuple */
- Py_ssize_t r; /* size of result tuple */
- int stopped; /* set to 1 when the combinations iterator is exhausted */
+ PyObject *pool; /* input converted to a tuple */
+ Py_ssize_t *indices; /* one index per result element */
+ PyObject *result; /* most recently returned result tuple */
+ Py_ssize_t r; /* size of result tuple */
+ int stopped; /* set to 1 when the iterator is exhausted */
} combinationsobject;
static PyTypeObject combinations_type;
@@ -2555,17 +2575,16 @@
Py_ssize_t i;
Py_ssize_t n = PyTuple_GET_SIZE(lz->pool);
- if (!PyTuple_Check(state) || PyTuple_GET_SIZE(state) != lz->r)
- {
+ if (!PyTuple_Check(state) || PyTuple_GET_SIZE(state) != lz->r) {
PyErr_SetString(PyExc_ValueError, "invalid arguments");
return NULL;
}
- for (i=0; i<lz->r; i++)
- {
+ for (i=0; i<lz->r; i++) {
Py_ssize_t max;
PyObject* indexObject = PyTuple_GET_ITEM(state, i);
Py_ssize_t index = PyLong_AsSsize_t(indexObject);
+
if (index == -1 && PyErr_Occurred())
return NULL; /* not an integer */
max = i + n - lz->r;
@@ -2652,7 +2671,7 @@
};
-/* combinations with replacement object *******************************************/
+/* combinations with replacement object **************************************/
/* Equivalent to:
@@ -2682,11 +2701,11 @@
*/
typedef struct {
PyObject_HEAD
- PyObject *pool; /* input converted to a tuple */
+ PyObject *pool; /* input converted to a tuple */
Py_ssize_t *indices; /* one index per result element */
PyObject *result; /* most recently returned result tuple */
- Py_ssize_t r; /* size of result tuple */
- int stopped; /* set to 1 when the cwr iterator is exhausted */
+ Py_ssize_t r; /* size of result tuple */
+ int stopped; /* set to 1 when the cwr iterator is exhausted */
} cwrobject;
static PyTypeObject cwr_type;
@@ -2703,8 +2722,9 @@
Py_ssize_t i;
static char *kwargs[] = {"iterable", "r", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "On:combinations_with_replacement", kwargs,
- &iterable, &r))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds,
+ "On:combinations_with_replacement",
+ kwargs, &iterable, &r))
return NULL;
pool = PySequence_Tuple(iterable);
@@ -2869,8 +2889,7 @@
indices = PyTuple_New(lz->r);
if (!indices)
return NULL;
- for (i=0; i<lz->r; i++)
- {
+ for (i=0; i<lz->r; i++) {
PyObject* index = PyLong_FromSsize_t(lz->indices[i]);
if (!index) {
Py_DECREF(indices);
@@ -2896,10 +2915,10 @@
}
n = PyTuple_GET_SIZE(lz->pool);
- for (i=0; i<lz->r; i++)
- {
+ for (i=0; i<lz->r; i++) {
PyObject* indexObject = PyTuple_GET_ITEM(state, i);
Py_ssize_t index = PyLong_AsSsize_t(indexObject);
+
if (index < 0 && PyErr_Occurred())
return NULL; /* not an integer */
/* clamp the index */
@@ -2984,7 +3003,7 @@
};
-/* permutations object ************************************************************
+/* permutations object ********************************************************
def permutations(iterable, r=None):
'permutations(range(3), 2) --> (0,1) (0,2) (1,0) (1,2) (2,0) (2,1)'
@@ -3011,12 +3030,12 @@
typedef struct {
PyObject_HEAD
- PyObject *pool; /* input converted to a tuple */
- Py_ssize_t *indices; /* one index per element in the pool */
- Py_ssize_t *cycles; /* one rollover counter per element in the result */
- PyObject *result; /* most recently returned result tuple */
- Py_ssize_t r; /* size of result tuple */
- int stopped; /* set to 1 when the permutations iterator is exhausted */
+ PyObject *pool; /* input converted to a tuple */
+ Py_ssize_t *indices; /* one index per element in the pool */
+ Py_ssize_t *cycles; /* one rollover counter per element in the result */
+ PyObject *result; /* most recently returned result tuple */
+ Py_ssize_t r; /* size of result tuple */
+ int stopped; /* set to 1 when the iterator is exhausted */
} permutationsobject;
static PyTypeObject permutations_type;
@@ -3231,7 +3250,7 @@
indices = PyTuple_New(n);
if (indices == NULL)
goto err;
- for (i=0; i<n; i++){
+ for (i=0; i<n; i++) {
PyObject* index = PyLong_FromSsize_t(po->indices[i]);
if (!index)
goto err;
@@ -3241,8 +3260,7 @@
cycles = PyTuple_New(po->r);
if (cycles == NULL)
goto err;
- for (i=0; i<po->r; i++)
- {
+ for (i=0 ; i<po->r ; i++) {
PyObject* index = PyLong_FromSsize_t(po->cycles[i]);
if (!index)
goto err;
@@ -3270,15 +3288,12 @@
return NULL;
n = PyTuple_GET_SIZE(po->pool);
- if (PyTuple_GET_SIZE(indices) != n ||
- PyTuple_GET_SIZE(cycles) != po->r)
- {
+ if (PyTuple_GET_SIZE(indices) != n || PyTuple_GET_SIZE(cycles) != po->r) {
PyErr_SetString(PyExc_ValueError, "invalid arguments");
return NULL;
}
- for (i=0; i<n; i++)
- {
+ for (i=0; i<n; i++) {
PyObject* indexObject = PyTuple_GET_ITEM(indices, i);
Py_ssize_t index = PyLong_AsSsize_t(indexObject);
if (index < 0 && PyErr_Occurred())
@@ -3291,8 +3306,7 @@
po->indices[i] = index;
}
- for (i=0; i<po->r; i++)
- {
+ for (i=0; i<po->r; i++) {
PyObject* indexObject = PyTuple_GET_ITEM(cycles, i);
Py_ssize_t index = PyLong_AsSsize_t(indexObject);
if (index < 0 && PyErr_Occurred())
@@ -3334,11 +3348,11 @@
static PyTypeObject permutations_type = {
PyVarObject_HEAD_INIT(NULL, 0)
- "itertools.permutations", /* tp_name */
+ "itertools.permutations", /* tp_name */
sizeof(permutationsobject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
- (destructor)permutations_dealloc, /* tp_dealloc */
+ (destructor)permutations_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
@@ -3355,13 +3369,13 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_BASETYPE, /* tp_flags */
- permutations_doc, /* tp_doc */
- (traverseproc)permutations_traverse, /* tp_traverse */
+ permutations_doc, /* tp_doc */
+ (traverseproc)permutations_traverse,/* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
PyObject_SelfIter, /* tp_iter */
- (iternextfunc)permutations_next, /* tp_iternext */
+ (iternextfunc)permutations_next, /* tp_iternext */
permuations_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
@@ -3372,11 +3386,11 @@
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
- permutations_new, /* tp_new */
+ permutations_new, /* tp_new */
PyObject_GC_Del, /* tp_free */
};
-/* accumulate object ************************************************************/
+/* accumulate object ********************************************************/
typedef struct {
PyObject_HEAD
@@ -3445,7 +3459,7 @@
{
PyObject *val, *oldtotal, *newtotal;
- val = PyIter_Next(lz->it);
+ val = (*Py_TYPE(lz->it)->tp_iternext)(lz->it);
if (val == NULL)
return NULL;
@@ -3477,7 +3491,7 @@
return Py_BuildValue("O(OO)O", Py_TYPE(lz),
lz->it, lz->binop?lz->binop:Py_None,
lz->total?lz->total:Py_None);
- }
+}
static PyObject *
accumulate_setstate(accumulateobject *lz, PyObject *state)
@@ -3640,7 +3654,7 @@
ok = PyObject_IsTrue(selector);
Py_DECREF(selector);
- if (ok == 1)
+ if (ok > 0)
return datum;
Py_DECREF(datum);
if (ok < 0)
@@ -3653,7 +3667,7 @@
{
return Py_BuildValue("O(OO)", Py_TYPE(lz),
lz->data, lz->selectors);
- }
+}
static PyMethodDef compress_methods[] = {
{"__reduce__", (PyCFunction)compress_reduce, METH_NOARGS,
@@ -3672,44 +3686,44 @@
PyVarObject_HEAD_INIT(NULL, 0)
"itertools.compress", /* tp_name */
sizeof(compressobject), /* tp_basicsize */
- 0, /* tp_itemsize */
+ 0, /* tp_itemsize */
/* methods */
(destructor)compress_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- PyObject_GenericGetAttr, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ PyObject_GenericGetAttr, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
- Py_TPFLAGS_BASETYPE, /* tp_flags */
- compress_doc, /* tp_doc */
- (traverseproc)compress_traverse, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- PyObject_SelfIter, /* tp_iter */
+ Py_TPFLAGS_BASETYPE, /* tp_flags */
+ compress_doc, /* tp_doc */
+ (traverseproc)compress_traverse, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ PyObject_SelfIter, /* tp_iter */
(iternextfunc)compress_next, /* tp_iternext */
- compress_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- compress_new, /* tp_new */
- PyObject_GC_Del, /* tp_free */
+ compress_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ compress_new, /* tp_new */
+ PyObject_GC_Del, /* tp_free */
};
@@ -3790,8 +3804,7 @@
ok = PyObject_IsTrue(item);
} else {
PyObject *good;
- good = PyObject_CallFunctionObjArgs(lz->func,
- item, NULL);
+ good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
if (good == NULL) {
Py_DECREF(item);
return NULL;
@@ -3810,9 +3823,8 @@
static PyObject *
filterfalse_reduce(filterfalseobject *lz)
{
- return Py_BuildValue("O(OO)", Py_TYPE(lz),
- lz->func, lz->it);
- }
+ return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->func, lz->it);
+}
static PyMethodDef filterfalse_methods[] = {
{"__reduce__", (PyCFunction)filterfalse_reduce, METH_NOARGS,
@@ -3832,7 +3844,7 @@
sizeof(filterfalseobject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
- (destructor)filterfalse_dealloc, /* tp_dealloc */
+ (destructor)filterfalse_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
@@ -3850,7 +3862,7 @@
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_BASETYPE, /* tp_flags */
filterfalse_doc, /* tp_doc */
- (traverseproc)filterfalse_traverse, /* tp_traverse */
+ (traverseproc)filterfalse_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
@@ -4089,15 +4101,15 @@
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
- Py_TPFLAGS_BASETYPE, /* tp_flags */
+ Py_TPFLAGS_BASETYPE, /* tp_flags */
count_doc, /* tp_doc */
- (traverseproc)count_traverse, /* tp_traverse */
+ (traverseproc)count_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
PyObject_SelfIter, /* tp_iter */
(iternextfunc)count_next, /* tp_iternext */
- count_methods, /* tp_methods */
+ count_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
@@ -4263,9 +4275,7 @@
PyObject_GC_Del, /* tp_free */
};
-/* ziplongest object ************************************************************/
-
-#include "Python.h"
+/* ziplongest object *********************************************************/
typedef struct {
PyObject_HEAD
@@ -4304,7 +4314,7 @@
ittuple = PyTuple_New(tuplesize);
if (ittuple == NULL)
return NULL;
- for (i=0; i < tuplesize; ++i) {
+ for (i=0; i < tuplesize; i++) {
PyObject *item = PyTuple_GET_ITEM(args, i);
PyObject *it = PyObject_GetIter(item);
if (it == NULL) {
@@ -4445,6 +4455,7 @@
*/
int i;
PyObject *args = PyTuple_New(PyTuple_GET_SIZE(lz->ittuple));
+
if (args == NULL)
return NULL;
for (i=0; i<PyTuple_GET_SIZE(lz->ittuple); i++) {
@@ -4496,7 +4507,7 @@
sizeof(ziplongestobject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
- (destructor)zip_longest_dealloc, /* tp_dealloc */
+ (destructor)zip_longest_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
@@ -4513,8 +4524,8 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_BASETYPE, /* tp_flags */
- zip_longest_doc, /* tp_doc */
- (traverseproc)zip_longest_traverse, /* tp_traverse */
+ zip_longest_doc, /* tp_doc */
+ (traverseproc)zip_longest_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
@@ -4530,7 +4541,7 @@
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
- zip_longest_new, /* tp_new */
+ zip_longest_new, /* tp_new */
PyObject_GC_Del, /* tp_free */
};
diff --git a/Modules/nismodule.c b/Modules/nismodule.c
index 64eb5db..b6a855c 100644
--- a/Modules/nismodule.c
+++ b/Modules/nismodule.c
@@ -76,11 +76,7 @@
*pfix = 0;
for (i=0; aliases[i].alias != 0L; i++) {
- if (!strcmp (aliases[i].alias, map)) {
- *pfix = aliases[i].fix;
- return aliases[i].map;
- }
- if (!strcmp (aliases[i].map, map)) {
+ if (!strcmp (aliases[i].alias, map) || !strcmp (aliases[i].map, map)) {
*pfix = aliases[i].fix;
return aliases[i].map;
}
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 854a749..467ce2c 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -4605,11 +4605,11 @@
#define PATH_UTIME_HAVE_FD 0
#endif
+#if defined(HAVE_UTIMENSAT) || defined(HAVE_LUTIMES)
+# define UTIME_HAVE_NOFOLLOW_SYMLINKS
+#endif
-#define UTIME_HAVE_NOFOLLOW_SYMLINKS \
- (defined(HAVE_UTIMENSAT) || defined(HAVE_LUTIMES))
-
-#if UTIME_HAVE_NOFOLLOW_SYMLINKS
+#ifdef UTIME_HAVE_NOFOLLOW_SYMLINKS
static int
utime_nofollow_symlinks(utime_t *ut, char *path)
@@ -4771,7 +4771,7 @@
utime.now = 1;
}
-#if !UTIME_HAVE_NOFOLLOW_SYMLINKS
+#if !defined(UTIME_HAVE_NOFOLLOW_SYMLINKS)
if (follow_symlinks_specified("utime", follow_symlinks))
goto exit;
#endif
@@ -4825,7 +4825,7 @@
#else /* MS_WINDOWS */
Py_BEGIN_ALLOW_THREADS
-#if UTIME_HAVE_NOFOLLOW_SYMLINKS
+#ifdef UTIME_HAVE_NOFOLLOW_SYMLINKS
if ((!follow_symlinks) && (dir_fd == DEFAULT_DIR_FD))
result = utime_nofollow_symlinks(&utime, path->narrow);
else
@@ -5756,14 +5756,14 @@
pid: pid_t
/
-Return the affinity of the process identified by pid.
+Return the affinity of the process identified by pid (or the current process if zero).
The affinity is returned as a set of CPU identifiers.
[clinic start generated code]*/
static PyObject *
os_sched_getaffinity_impl(PyModuleDef *module, pid_t pid)
-/*[clinic end generated code: output=b431a8f310e369e7 input=eaf161936874b8a1]*/
+/*[clinic end generated code: output=b431a8f310e369e7 input=983ce7cb4a565980]*/
{
int cpu, ncpus, count;
size_t setsize;
@@ -9482,7 +9482,7 @@
*/
struct constdef {
char *name;
- long value;
+ int value;
};
static int
@@ -9490,7 +9490,10 @@
size_t tablesize)
{
if (PyLong_Check(arg)) {
- *valuep = PyLong_AS_LONG(arg);
+ int value = _PyLong_AsInt(arg);
+ if (value == -1 && PyErr_Occurred())
+ return 0;
+ *valuep = value;
return 1;
}
else {
@@ -11199,11 +11202,15 @@
os.cpu_count
Return the number of CPUs in the system; return None if indeterminable.
+
+This number is not equivalent to the number of CPUs the current process can
+use. The number of usable CPUs can be obtained with
+``len(os.sched_getaffinity(0))``
[clinic start generated code]*/
static PyObject *
os_cpu_count_impl(PyModuleDef *module)
-/*[clinic end generated code: output=c59ee7f6bce832b8 input=d55e2f8f3823a628]*/
+/*[clinic end generated code: output=c59ee7f6bce832b8 input=e7c8f4ba6dbbadd3]*/
{
int ncpu = 0;
#ifdef MS_WINDOWS
diff --git a/Modules/readline.c b/Modules/readline.c
index 675b722..451a6ed 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -841,7 +841,7 @@
if (r == Py_None)
result = 0;
else {
- result = PyLong_AsLong(r);
+ result = _PyLong_AsInt(r);
if (result == -1 && PyErr_Occurred())
goto error;
}
diff --git a/Modules/sre_lib.h b/Modules/sre_lib.h
index 128c71e..6ad2ab7 100644
--- a/Modules/sre_lib.h
+++ b/Modules/sre_lib.h
@@ -1256,7 +1256,32 @@
prefix, prefix_len, prefix_skip));
TRACE(("charset = %p\n", charset));
-#if defined(USE_FAST_SEARCH)
+ if (prefix_len == 1) {
+ /* pattern starts with a literal character */
+ SRE_CHAR c = (SRE_CHAR) prefix[0];
+#if SIZEOF_SRE_CHAR < 4
+ if ((SRE_CODE) c != prefix[0])
+ return 0; /* literal can't match: doesn't fit in char width */
+#endif
+ end = (SRE_CHAR *)state->end;
+ while (ptr < end) {
+ while (*ptr != c) {
+ if (++ptr >= end)
+ return 0;
+ }
+ TRACE(("|%p|%p|SEARCH LITERAL\n", pattern, ptr));
+ state->start = ptr;
+ state->ptr = ptr + prefix_skip;
+ if (flags & SRE_INFO_LITERAL)
+ return 1; /* we got all of it */
+ status = SRE(match)(state, pattern + 2*prefix_skip, 0);
+ if (status != 0)
+ return status;
+ ++ptr;
+ }
+ return 0;
+ }
+
if (prefix_len > 1) {
/* pattern starts with a known prefix. use the overlap
table to skip forward as fast as we possibly can */
@@ -1305,32 +1330,8 @@
}
return 0;
}
-#endif
- if (pattern[0] == SRE_OP_LITERAL) {
- /* pattern starts with a literal character. this is used
- for short prefixes, and if fast search is disabled */
- SRE_CHAR c = (SRE_CHAR) pattern[1];
-#if SIZEOF_SRE_CHAR < 4
- if ((SRE_CODE) c != pattern[1])
- return 0; /* literal can't match: doesn't fit in char width */
-#endif
- end = (SRE_CHAR *)state->end;
- while (ptr < end) {
- while (*ptr != c) {
- if (++ptr >= end)
- return 0;
- }
- TRACE(("|%p|%p|SEARCH LITERAL\n", pattern, ptr));
- state->start = ptr;
- state->ptr = ++ptr;
- if (flags & SRE_INFO_LITERAL)
- return 1; /* we got all of it */
- status = SRE(match)(state, pattern + 2, 0);
- if (status != 0)
- break;
- }
- } else if (charset) {
+ if (charset) {
/* pattern starts with a character from a known set */
end = (SRE_CHAR *)state->end;
for (;;) {
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 08275ad..a75c54d 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -409,12 +409,14 @@
/* Returns a new reference to a PyBytes object, or NULL on failure. */
-static PyObject *
-formatfloat(PyObject *v, int flags, int prec, int type)
+static char*
+formatfloat(PyObject *v, int flags, int prec, int type,
+ PyObject **p_result, _PyBytesWriter *writer, char *str)
{
char *p;
PyObject *result;
double x;
+ size_t len;
x = PyFloat_AsDouble(v);
if (x == -1.0 && PyErr_Occurred()) {
@@ -431,9 +433,21 @@
if (p == NULL)
return NULL;
- result = PyBytes_FromStringAndSize(p, strlen(p));
+
+ len = strlen(p);
+ if (writer != NULL) {
+ str = _PyBytesWriter_Prepare(writer, str, len);
+ if (str == NULL)
+ return NULL;
+ Py_MEMCPY(str, p, len);
+ str += len;
+ return str;
+ }
+
+ result = PyBytes_FromStringAndSize(p, len);
PyMem_Free(p);
- return result;
+ *p_result = result;
+ return str;
}
static PyObject *
@@ -557,36 +571,32 @@
return NULL;
}
-/* fmt%(v1,v2,...) is roughly equivalent to sprintf(fmt, v1, v2, ...)
-
- FORMATBUFLEN is the length of the buffer in which the ints &
- chars are formatted. XXX This is a magic number. Each formatting
- routine does bounds checking to ensure no overflow, but a better
- solution may be to malloc a buffer of appropriate size for each
- format. For now, the current solution is sufficient.
-*/
-#define FORMATBUFLEN (size_t)120
+/* fmt%(v1,v2,...) is roughly equivalent to sprintf(fmt, v1, v2, ...) */
PyObject *
_PyBytes_Format(PyObject *format, PyObject *args)
{
char *fmt, *res;
Py_ssize_t arglen, argidx;
- Py_ssize_t reslen, rescnt, fmtcnt;
+ Py_ssize_t fmtcnt;
int args_owned = 0;
- PyObject *result;
PyObject *dict = NULL;
+ _PyBytesWriter writer;
+
if (format == NULL || !PyBytes_Check(format) || args == NULL) {
PyErr_BadInternalCall();
return NULL;
}
fmt = PyBytes_AS_STRING(format);
fmtcnt = PyBytes_GET_SIZE(format);
- reslen = rescnt = fmtcnt + 100;
- result = PyBytes_FromStringAndSize((char *)NULL, reslen);
- if (result == NULL)
+
+ _PyBytesWriter_Init(&writer);
+
+ res = _PyBytesWriter_Alloc(&writer, fmtcnt);
+ if (res == NULL)
return NULL;
- res = PyBytes_AsString(result);
+ writer.overallocate = 1;
+
if (PyTuple_Check(args)) {
arglen = PyTuple_GET_SIZE(args);
argidx = 0;
@@ -600,18 +610,25 @@
!PyByteArray_Check(args)) {
dict = args;
}
+
while (--fmtcnt >= 0) {
if (*fmt != '%') {
- if (--rescnt < 0) {
- rescnt = fmtcnt + 100;
- reslen += rescnt;
- if (_PyBytes_Resize(&result, reslen))
- return NULL;
- res = PyBytes_AS_STRING(result)
- + reslen - rescnt;
- --rescnt;
+ Py_ssize_t len;
+ char *pos;
+
+ pos = strchr(fmt + 1, '%');
+ if (pos != NULL)
+ len = pos - fmt;
+ else {
+ len = PyBytes_GET_SIZE(format);
+ len -= (fmt - PyBytes_AS_STRING(format));
}
- *res++ = *fmt++;
+ assert(len != 0);
+
+ Py_MEMCPY(res, fmt, len);
+ res += len;
+ fmt += len;
+ fmtcnt -= (len - 1);
}
else {
/* Got a format specifier */
@@ -626,6 +643,10 @@
int sign;
Py_ssize_t len = 0;
char onechar; /* For byte_converter() */
+ Py_ssize_t alloc;
+#ifdef Py_DEBUG
+ char *before;
+#endif
fmt++;
if (*fmt == '(') {
@@ -673,6 +694,8 @@
arglen = -1;
argidx = -2;
}
+
+ /* Parse flags. Example: "%+i" => flags=F_SIGN. */
while (--fmtcnt >= 0) {
switch (c = *fmt++) {
case '-': flags |= F_LJUST; continue;
@@ -683,6 +706,8 @@
}
break;
}
+
+ /* Parse width. Example: "%10s" => width=10 */
if (c == '*') {
v = getnextarg(args, arglen, &argidx);
if (v == NULL)
@@ -717,6 +742,8 @@
width = width*10 + (c - '0');
}
}
+
+ /* Parse precision. Example: "%.3f" => prec=3 */
if (c == '.') {
prec = 0;
if (--fmtcnt >= 0)
@@ -771,13 +798,19 @@
if (v == NULL)
goto error;
}
+
+ if (fmtcnt < 0) {
+ /* last writer: disable writer overallocation */
+ writer.overallocate = 0;
+ }
+
sign = 0;
fill = ' ';
switch (c) {
case '%':
- pbuf = "%";
- len = 1;
- break;
+ *res++ = '%';
+ continue;
+
case 'r':
// %r is only for 2/3 code; 3 only code should use %a
case 'a':
@@ -790,6 +823,7 @@
if (prec >= 0 && len > prec)
len = prec;
break;
+
case 's':
// %s is only for 2/3 code; 3 only code should use %b
case 'b':
@@ -799,12 +833,49 @@
if (prec >= 0 && len > prec)
len = prec;
break;
+
case 'i':
case 'd':
case 'u':
case 'o':
case 'x':
case 'X':
+ if (PyLong_CheckExact(v)
+ && width == -1 && prec == -1
+ && !(flags & (F_SIGN | F_BLANK))
+ && c != 'X')
+ {
+ /* Fast path */
+ int alternate = flags & F_ALT;
+ int base;
+
+ switch(c)
+ {
+ default:
+ assert(0 && "'type' not in [diuoxX]");
+ case 'd':
+ case 'i':
+ case 'u':
+ base = 10;
+ break;
+ case 'o':
+ base = 8;
+ break;
+ case 'x':
+ case 'X':
+ base = 16;
+ break;
+ }
+
+ /* Fast path */
+ writer.min_size -= 2; /* size preallocated for "%d" */
+ res = _PyLong_FormatBytesWriter(&writer, res,
+ v, base, alternate);
+ if (res == NULL)
+ goto error;
+ continue;
+ }
+
temp = formatlong(v, flags, prec, c);
if (!temp)
goto error;
@@ -815,14 +886,25 @@
if (flags & F_ZERO)
fill = '0';
break;
+
case 'e':
case 'E':
case 'f':
case 'F':
case 'g':
case 'G':
- temp = formatfloat(v, flags, prec, c);
- if (temp == NULL)
+ if (width == -1 && prec == -1
+ && !(flags & (F_SIGN | F_BLANK)))
+ {
+ /* Fast path */
+ writer.min_size -= 2; /* size preallocated for "%f" */
+ res = formatfloat(v, flags, prec, c, NULL, &writer, res);
+ if (res == NULL)
+ goto error;
+ continue;
+ }
+
+ if (!formatfloat(v, flags, prec, c, &temp, NULL, res))
goto error;
pbuf = PyBytes_AS_STRING(temp);
len = PyBytes_GET_SIZE(temp);
@@ -830,12 +912,19 @@
if (flags & F_ZERO)
fill = '0';
break;
+
case 'c':
pbuf = &onechar;
len = byte_converter(v, &onechar);
if (!len)
goto error;
+ if (width == -1) {
+ /* Fast path */
+ *res++ = onechar;
+ continue;
+ }
break;
+
default:
PyErr_Format(PyExc_ValueError,
"unsupported format character '%c' (0x%x) "
@@ -845,6 +934,7 @@
PyBytes_AsString(format)));
goto error;
}
+
if (sign) {
if (*pbuf == '-' || *pbuf == '+') {
sign = *pbuf++;
@@ -859,29 +949,31 @@
}
if (width < len)
width = len;
- if (rescnt - (sign != 0) < width) {
- reslen -= rescnt;
- rescnt = width + fmtcnt + 100;
- reslen += rescnt;
- if (reslen < 0) {
- Py_DECREF(result);
- Py_XDECREF(temp);
- return PyErr_NoMemory();
- }
- if (_PyBytes_Resize(&result, reslen)) {
- Py_XDECREF(temp);
- return NULL;
- }
- res = PyBytes_AS_STRING(result)
- + reslen - rescnt;
+
+ alloc = width;
+ if (sign != 0 && len == width)
+ alloc++;
+ /* 2: size preallocated for %s */
+ if (alloc > 2) {
+ res = _PyBytesWriter_Prepare(&writer, res, alloc - 2);
+ if (res == NULL)
+ goto error;
}
+#ifdef Py_DEBUG
+ before = res;
+#endif
+
+ /* Write the sign if needed */
if (sign) {
if (fill != ' ')
*res++ = sign;
- rescnt--;
if (width > len)
width--;
}
+
+ /* Write the numeric prefix for "x", "X" and "o" formats
+ if the alternate form is used.
+ For example, write "0x" for the "%#x" format. */
if ((flags & F_ALT) && (c == 'x' || c == 'X')) {
assert(pbuf[0] == '0');
assert(pbuf[1] == c);
@@ -889,18 +981,21 @@
*res++ = *pbuf++;
*res++ = *pbuf++;
}
- rescnt -= 2;
width -= 2;
if (width < 0)
width = 0;
len -= 2;
}
+
+ /* Pad left with the fill character if needed */
if (width > len && !(flags & F_LJUST)) {
- do {
- --rescnt;
- *res++ = fill;
- } while (--width > len);
+ memset(res, fill, width - len);
+ res += (width - len);
+ width = len;
}
+
+ /* If padding with spaces: write sign if needed and/or numeric
+ prefix if the alternate form is used */
if (fill == ' ') {
if (sign)
*res++ = sign;
@@ -912,13 +1007,17 @@
*res++ = *pbuf++;
}
}
+
+ /* Copy bytes */
Py_MEMCPY(res, pbuf, len);
res += len;
- rescnt -= len;
- while (--width >= len) {
- --rescnt;
- *res++ = ' ';
+
+ /* Pad right with the fill character if needed */
+ if (width > len) {
+ memset(res, ' ', width - len);
+ res += (width - len);
}
+
if (dict && (argidx < arglen) && c != '%') {
PyErr_SetString(PyExc_TypeError,
"not all arguments converted during bytes formatting");
@@ -926,22 +1025,31 @@
goto error;
}
Py_XDECREF(temp);
+
+#ifdef Py_DEBUG
+ /* check that we computed the exact size for this write */
+ assert((res - before) == alloc);
+#endif
} /* '%' */
+
+ /* If overallocation was disabled, ensure that it was the last
+ write. Otherwise, we missed an optimization */
+ assert(writer.overallocate || fmtcnt < 0);
} /* until end */
+
if (argidx < arglen && !dict) {
PyErr_SetString(PyExc_TypeError,
"not all arguments converted during bytes formatting");
goto error;
}
+
if (args_owned) {
Py_DECREF(args);
}
- if (_PyBytes_Resize(&result, reslen - rescnt))
- return NULL;
- return result;
+ return _PyBytesWriter_Finish(&writer, res);
error:
- Py_DECREF(result);
+ _PyBytesWriter_Dealloc(&writer);
if (args_owned) {
Py_DECREF(args);
}
@@ -3735,3 +3843,210 @@
_PyObject_GC_TRACK(it);
return (PyObject *)it;
}
+
+
+/* _PyBytesWriter API */
+
+#ifdef MS_WINDOWS
+ /* On Windows, overallocate by 50% is the best factor */
+# define OVERALLOCATE_FACTOR 2
+#else
+ /* On Linux, overallocate by 25% is the best factor */
+# define OVERALLOCATE_FACTOR 4
+#endif
+
+void
+_PyBytesWriter_Init(_PyBytesWriter *writer)
+{
+ writer->buffer = NULL;
+ writer->allocated = 0;
+ writer->min_size = 0;
+ writer->overallocate = 0;
+ writer->use_small_buffer = 0;
+#ifdef Py_DEBUG
+ memset(writer->small_buffer, 0xCB, sizeof(writer->small_buffer));
+#endif
+}
+
+void
+_PyBytesWriter_Dealloc(_PyBytesWriter *writer)
+{
+ Py_CLEAR(writer->buffer);
+}
+
+Py_LOCAL_INLINE(char*)
+_PyBytesWriter_AsString(_PyBytesWriter *writer)
+{
+ if (!writer->use_small_buffer) {
+ assert(writer->buffer != NULL);
+ return PyBytes_AS_STRING(writer->buffer);
+ }
+ else {
+ assert(writer->buffer == NULL);
+ return writer->small_buffer;
+ }
+}
+
+Py_LOCAL_INLINE(Py_ssize_t)
+_PyBytesWriter_GetPos(_PyBytesWriter *writer, char *str)
+{
+ char *start = _PyBytesWriter_AsString(writer);
+ assert(str != NULL);
+ assert(str >= start);
+ assert(str - start <= writer->allocated);
+ return str - start;
+}
+
+Py_LOCAL_INLINE(void)
+_PyBytesWriter_CheckConsistency(_PyBytesWriter *writer, char *str)
+{
+#ifdef Py_DEBUG
+ char *start, *end;
+
+ if (!writer->use_small_buffer) {
+ assert(writer->buffer != NULL);
+ assert(PyBytes_CheckExact(writer->buffer));
+ assert(Py_REFCNT(writer->buffer) == 1);
+ }
+ else {
+ assert(writer->buffer == NULL);
+ }
+
+ start = _PyBytesWriter_AsString(writer);
+ assert(0 <= writer->min_size && writer->min_size <= writer->allocated);
+ /* the last byte must always be null */
+ assert(start[writer->allocated] == 0);
+
+ end = start + writer->allocated;
+ assert(str != NULL);
+ assert(start <= str && str <= end);
+#endif
+}
+
+char*
+_PyBytesWriter_Prepare(_PyBytesWriter *writer, char *str, Py_ssize_t size)
+{
+ Py_ssize_t allocated, pos;
+
+ _PyBytesWriter_CheckConsistency(writer, str);
+ assert(size >= 0);
+
+ if (size == 0) {
+ /* nothing to do */
+ return str;
+ }
+
+ if (writer->min_size > PY_SSIZE_T_MAX - size) {
+ PyErr_NoMemory();
+ _PyBytesWriter_Dealloc(writer);
+ return NULL;
+ }
+ writer->min_size += size;
+
+ allocated = writer->allocated;
+ if (writer->min_size <= allocated)
+ return str;
+
+ allocated = writer->min_size;
+ if (writer->overallocate
+ && allocated <= (PY_SSIZE_T_MAX - allocated / OVERALLOCATE_FACTOR)) {
+ /* overallocate to limit the number of realloc() */
+ allocated += allocated / OVERALLOCATE_FACTOR;
+ }
+
+ pos = _PyBytesWriter_GetPos(writer, str);
+ if (!writer->use_small_buffer) {
+ /* Note: Don't use a bytearray object because the conversion from
+ byterray to bytes requires to copy all bytes. */
+ if (_PyBytes_Resize(&writer->buffer, allocated)) {
+ assert(writer->buffer == NULL);
+ return NULL;
+ }
+ }
+ else {
+ /* convert from stack buffer to bytes object buffer */
+ assert(writer->buffer == NULL);
+
+ writer->buffer = PyBytes_FromStringAndSize(NULL, allocated);
+ if (writer->buffer == NULL)
+ return NULL;
+
+ if (pos != 0) {
+ Py_MEMCPY(PyBytes_AS_STRING(writer->buffer),
+ writer->small_buffer,
+ pos);
+ }
+
+ writer->use_small_buffer = 0;
+#ifdef Py_DEBUG
+ memset(writer->small_buffer, 0xDB, sizeof(writer->small_buffer));
+#endif
+ }
+ writer->allocated = allocated;
+
+ str = _PyBytesWriter_AsString(writer) + pos;
+ _PyBytesWriter_CheckConsistency(writer, str);
+ return str;
+}
+
+/* Allocate the buffer to write size bytes.
+ Return the pointer to the beginning of buffer data.
+ Raise an exception and return NULL on error. */
+char*
+_PyBytesWriter_Alloc(_PyBytesWriter *writer, Py_ssize_t size)
+{
+ /* ensure that _PyBytesWriter_Alloc() is only called once */
+ assert(writer->min_size == 0 && writer->buffer == NULL);
+ assert(size >= 0);
+
+ writer->use_small_buffer = 1;
+#ifdef Py_DEBUG
+ /* the last byte is reserved, it must be '\0' */
+ writer->allocated = sizeof(writer->small_buffer) - 1;
+ writer->small_buffer[writer->allocated] = 0;
+#else
+ writer->allocated = sizeof(writer->small_buffer);
+#endif
+ return _PyBytesWriter_Prepare(writer, writer->small_buffer, size);
+}
+
+PyObject *
+_PyBytesWriter_Finish(_PyBytesWriter *writer, char *str)
+{
+ Py_ssize_t pos;
+ PyObject *result;
+
+ _PyBytesWriter_CheckConsistency(writer, str);
+
+ pos = _PyBytesWriter_GetPos(writer, str);
+ if (!writer->use_small_buffer) {
+ if (pos != writer->allocated) {
+ if (_PyBytes_Resize(&writer->buffer, pos)) {
+ assert(writer->buffer == NULL);
+ return NULL;
+ }
+ }
+
+ result = writer->buffer;
+ writer->buffer = NULL;
+ }
+ else {
+ result = PyBytes_FromStringAndSize(writer->small_buffer, pos);
+ }
+
+ return result;
+}
+
+char*
+_PyBytesWriter_WriteBytes(_PyBytesWriter *writer, char *str,
+ char *bytes, Py_ssize_t size)
+{
+ str = _PyBytesWriter_Prepare(writer, str, size);
+ if (str == NULL)
+ return NULL;
+
+ Py_MEMCPY(str, bytes, size);
+ str += size;
+
+ return str;
+}
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 5f22455..00f5d95 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -1582,7 +1582,9 @@
static int
long_to_decimal_string_internal(PyObject *aa,
PyObject **p_output,
- _PyUnicodeWriter *writer)
+ _PyUnicodeWriter *writer,
+ _PyBytesWriter *bytes_writer,
+ char **bytes_str)
{
PyLongObject *scratch, *a;
PyObject *str;
@@ -1664,6 +1666,13 @@
kind = writer->kind;
str = NULL;
}
+ else if (bytes_writer) {
+ *bytes_str = _PyBytesWriter_Prepare(bytes_writer, *bytes_str, strlen);
+ if (*bytes_str == NULL) {
+ Py_DECREF(scratch);
+ return -1;
+ }
+ }
else {
str = PyUnicode_New(strlen, '9');
if (str == NULL) {
@@ -1673,13 +1682,8 @@
kind = PyUnicode_KIND(str);
}
-#define WRITE_DIGITS(TYPE) \
+#define WRITE_DIGITS(p) \
do { \
- if (writer) \
- p = (TYPE*)PyUnicode_DATA(writer->buffer) + writer->pos + strlen; \
- else \
- p = (TYPE*)PyUnicode_DATA(str) + strlen; \
- \
/* pout[0] through pout[size-2] contribute exactly \
_PyLong_DECIMAL_SHIFT digits each */ \
for (i=0; i < size - 1; i++) { \
@@ -1699,6 +1703,16 @@
/* and sign */ \
if (negative) \
*--p = '-'; \
+ } while (0)
+
+#define WRITE_UNICODE_DIGITS(TYPE) \
+ do { \
+ if (writer) \
+ p = (TYPE*)PyUnicode_DATA(writer->buffer) + writer->pos + strlen; \
+ else \
+ p = (TYPE*)PyUnicode_DATA(str) + strlen; \
+ \
+ WRITE_DIGITS(p); \
\
/* check we've counted correctly */ \
if (writer) \
@@ -1708,25 +1722,34 @@
} while (0)
/* fill the string right-to-left */
- if (kind == PyUnicode_1BYTE_KIND) {
+ if (bytes_writer) {
+ char *p = *bytes_str + strlen;
+ WRITE_DIGITS(p);
+ assert(p == *bytes_str);
+ }
+ else if (kind == PyUnicode_1BYTE_KIND) {
Py_UCS1 *p;
- WRITE_DIGITS(Py_UCS1);
+ WRITE_UNICODE_DIGITS(Py_UCS1);
}
else if (kind == PyUnicode_2BYTE_KIND) {
Py_UCS2 *p;
- WRITE_DIGITS(Py_UCS2);
+ WRITE_UNICODE_DIGITS(Py_UCS2);
}
else {
Py_UCS4 *p;
assert (kind == PyUnicode_4BYTE_KIND);
- WRITE_DIGITS(Py_UCS4);
+ WRITE_UNICODE_DIGITS(Py_UCS4);
}
#undef WRITE_DIGITS
+#undef WRITE_UNICODE_DIGITS
Py_DECREF(scratch);
if (writer) {
writer->pos += strlen;
}
+ else if (bytes_writer) {
+ (*bytes_str) += strlen;
+ }
else {
assert(_PyUnicode_CheckConsistency(str, 1));
*p_output = (PyObject *)str;
@@ -1738,7 +1761,7 @@
long_to_decimal_string(PyObject *aa)
{
PyObject *v;
- if (long_to_decimal_string_internal(aa, &v, NULL) == -1)
+ if (long_to_decimal_string_internal(aa, &v, NULL, NULL, NULL) == -1)
return NULL;
return v;
}
@@ -1750,7 +1773,8 @@
static int
long_format_binary(PyObject *aa, int base, int alternate,
- PyObject **p_output, _PyUnicodeWriter *writer)
+ PyObject **p_output, _PyUnicodeWriter *writer,
+ _PyBytesWriter *bytes_writer, char **bytes_str)
{
PyLongObject *a = (PyLongObject *)aa;
PyObject *v;
@@ -1812,6 +1836,11 @@
kind = writer->kind;
v = NULL;
}
+ else if (writer) {
+ *bytes_str = _PyBytesWriter_Prepare(bytes_writer, *bytes_str, sz);
+ if (*bytes_str == NULL)
+ return -1;
+ }
else {
v = PyUnicode_New(sz, 'x');
if (v == NULL)
@@ -1819,13 +1848,8 @@
kind = PyUnicode_KIND(v);
}
-#define WRITE_DIGITS(TYPE) \
+#define WRITE_DIGITS(p) \
do { \
- if (writer) \
- p = (TYPE*)PyUnicode_DATA(writer->buffer) + writer->pos + sz; \
- else \
- p = (TYPE*)PyUnicode_DATA(v) + sz; \
- \
if (size_a == 0) { \
*--p = '0'; \
} \
@@ -1860,30 +1884,50 @@
} \
if (negative) \
*--p = '-'; \
+ } while (0)
+
+#define WRITE_UNICODE_DIGITS(TYPE) \
+ do { \
+ if (writer) \
+ p = (TYPE*)PyUnicode_DATA(writer->buffer) + writer->pos + sz; \
+ else \
+ p = (TYPE*)PyUnicode_DATA(v) + sz; \
+ \
+ WRITE_DIGITS(p); \
+ \
if (writer) \
assert(p == ((TYPE*)PyUnicode_DATA(writer->buffer) + writer->pos)); \
else \
assert(p == (TYPE*)PyUnicode_DATA(v)); \
} while (0)
- if (kind == PyUnicode_1BYTE_KIND) {
+ if (bytes_writer) {
+ char *p = *bytes_str + sz;
+ WRITE_DIGITS(p);
+ assert(p == *bytes_str);
+ }
+ else if (kind == PyUnicode_1BYTE_KIND) {
Py_UCS1 *p;
- WRITE_DIGITS(Py_UCS1);
+ WRITE_UNICODE_DIGITS(Py_UCS1);
}
else if (kind == PyUnicode_2BYTE_KIND) {
Py_UCS2 *p;
- WRITE_DIGITS(Py_UCS2);
+ WRITE_UNICODE_DIGITS(Py_UCS2);
}
else {
Py_UCS4 *p;
assert (kind == PyUnicode_4BYTE_KIND);
- WRITE_DIGITS(Py_UCS4);
+ WRITE_UNICODE_DIGITS(Py_UCS4);
}
#undef WRITE_DIGITS
+#undef WRITE_UNICODE_DIGITS
if (writer) {
writer->pos += sz;
}
+ else if (bytes_writer) {
+ (*bytes_str) += sz;
+ }
else {
assert(_PyUnicode_CheckConsistency(v, 1));
*p_output = v;
@@ -1897,9 +1941,9 @@
PyObject *str;
int err;
if (base == 10)
- err = long_to_decimal_string_internal(obj, &str, NULL);
+ err = long_to_decimal_string_internal(obj, &str, NULL, NULL, NULL);
else
- err = long_format_binary(obj, base, 1, &str, NULL);
+ err = long_format_binary(obj, base, 1, &str, NULL, NULL, NULL);
if (err == -1)
return NULL;
return str;
@@ -1911,9 +1955,31 @@
int base, int alternate)
{
if (base == 10)
- return long_to_decimal_string_internal(obj, NULL, writer);
+ return long_to_decimal_string_internal(obj, NULL, writer,
+ NULL, NULL);
else
- return long_format_binary(obj, base, alternate, NULL, writer);
+ return long_format_binary(obj, base, alternate, NULL, writer,
+ NULL, NULL);
+}
+
+char*
+_PyLong_FormatBytesWriter(_PyBytesWriter *writer, char *str,
+ PyObject *obj,
+ int base, int alternate)
+{
+ char *str2;
+ int res;
+ str2 = str;
+ if (base == 10)
+ res = long_to_decimal_string_internal(obj, NULL, NULL,
+ writer, &str2);
+ else
+ res = long_format_binary(obj, base, alternate, NULL, NULL,
+ writer, &str2);
+ if (res < 0)
+ return NULL;
+ assert(str2 != NULL);
+ return str2;
}
/* Table of digit values for 8-bit string -> integer conversion.
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 704d7e2..03bb230 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -29,7 +29,6 @@
#include "Python.h"
#include "structmember.h"
-#include "stringlib/eq.h"
/* Object used as dummy key to fill deleted entries */
static PyObject _dummy_struct;
@@ -51,19 +50,20 @@
static setentry *
set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
{
- setentry *table = so->table;
- setentry *freeslot = NULL;
+ setentry *table;
setentry *entry;
- size_t perturb = hash;
+ size_t perturb;
size_t mask = so->mask;
size_t i = (size_t)hash & mask; /* Unsigned for defined overflow behavior */
size_t j;
int cmp;
- entry = &table[i];
+ entry = &so->table[i];
if (entry->key == NULL)
return entry;
+ perturb = hash;
+
while (1) {
if (entry->hash == hash) {
PyObject *startkey = entry->key;
@@ -73,8 +73,9 @@
return entry;
if (PyUnicode_CheckExact(startkey)
&& PyUnicode_CheckExact(key)
- && unicode_eq(startkey, key))
+ && _PyUnicode_EQ(startkey, key))
return entry;
+ table = so->table;
Py_INCREF(startkey);
cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
Py_DECREF(startkey);
@@ -86,14 +87,12 @@
return entry;
mask = so->mask; /* help avoid a register spill */
}
- if (entry->hash == -1 && freeslot == NULL)
- freeslot = entry;
if (i + LINEAR_PROBES <= mask) {
for (j = 0 ; j < LINEAR_PROBES ; j++) {
entry++;
- if (entry->key == NULL)
- goto found_null;
+ if (entry->hash == 0 && entry->key == NULL)
+ return entry;
if (entry->hash == hash) {
PyObject *startkey = entry->key;
assert(startkey != dummy);
@@ -101,8 +100,9 @@
return entry;
if (PyUnicode_CheckExact(startkey)
&& PyUnicode_CheckExact(key)
- && unicode_eq(startkey, key))
+ && _PyUnicode_EQ(startkey, key))
return entry;
+ table = so->table;
Py_INCREF(startkey);
cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
Py_DECREF(startkey);
@@ -114,7 +114,104 @@
return entry;
mask = so->mask;
}
- if (entry->hash == -1 && freeslot == NULL)
+ }
+ }
+
+ perturb >>= PERTURB_SHIFT;
+ i = (i * 5 + 1 + perturb) & mask;
+
+ entry = &so->table[i];
+ if (entry->key == NULL)
+ return entry;
+ }
+}
+
+static int set_table_resize(PySetObject *, Py_ssize_t);
+
+static int
+set_add_entry(PySetObject *so, PyObject *key, Py_hash_t hash)
+{
+ setentry *table;
+ setentry *freeslot;
+ setentry *entry;
+ size_t perturb;
+ size_t mask;
+ size_t i; /* Unsigned for defined overflow behavior */
+ size_t j;
+ int cmp;
+
+ /* Pre-increment is necessary to prevent arbitrary code in the rich
+ comparison from deallocating the key just before the insertion. */
+ Py_INCREF(key);
+
+ restart:
+
+ mask = so->mask;
+ i = (size_t)hash & mask;
+
+ entry = &so->table[i];
+ if (entry->key == NULL)
+ goto found_unused;
+
+ freeslot = NULL;
+ perturb = hash;
+
+ while (1) {
+ if (entry->hash == hash) {
+ PyObject *startkey = entry->key;
+ /* startkey cannot be a dummy because the dummy hash field is -1 */
+ assert(startkey != dummy);
+ if (startkey == key)
+ goto found_active;
+ if (PyUnicode_CheckExact(startkey)
+ && PyUnicode_CheckExact(key)
+ && _PyUnicode_EQ(startkey, key))
+ goto found_active;
+ table = so->table;
+ Py_INCREF(startkey);
+ cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
+ Py_DECREF(startkey);
+ if (cmp > 0) /* likely */
+ goto found_active;
+ if (cmp < 0)
+ goto comparison_error;
+ /* Continuing the search from the current entry only makes
+ sense if the table and entry are unchanged; otherwise,
+ we have to restart from the beginning */
+ if (table != so->table || entry->key != startkey)
+ goto restart;
+ mask = so->mask; /* help avoid a register spill */
+ }
+ else if (entry->hash == -1 && freeslot == NULL)
+ freeslot = entry;
+
+ if (i + LINEAR_PROBES <= mask) {
+ for (j = 0 ; j < LINEAR_PROBES ; j++) {
+ entry++;
+ if (entry->hash == 0 && entry->key == NULL)
+ goto found_unused_or_dummy;
+ if (entry->hash == hash) {
+ PyObject *startkey = entry->key;
+ assert(startkey != dummy);
+ if (startkey == key)
+ goto found_active;
+ if (PyUnicode_CheckExact(startkey)
+ && PyUnicode_CheckExact(key)
+ && _PyUnicode_EQ(startkey, key))
+ goto found_active;
+ table = so->table;
+ Py_INCREF(startkey);
+ cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
+ Py_DECREF(startkey);
+ if (cmp > 0)
+ goto found_active;
+ if (cmp < 0)
+ goto comparison_error;
+ if (table != so->table || entry->key != startkey)
+ goto restart;
+ mask = so->mask;
+ }
+ else if (entry->hash == -1 && freeslot == NULL)
freeslot = entry;
}
}
@@ -122,12 +219,35 @@
perturb >>= PERTURB_SHIFT;
i = (i * 5 + 1 + perturb) & mask;
- entry = &table[i];
+ entry = &so->table[i];
if (entry->key == NULL)
- goto found_null;
+ goto found_unused_or_dummy;
}
- found_null:
- return freeslot == NULL ? entry : freeslot;
+
+ found_unused_or_dummy:
+ if (freeslot == NULL)
+ goto found_unused;
+ so->used++;
+ freeslot->key = key;
+ freeslot->hash = hash;
+ return 0;
+
+ found_unused:
+ so->fill++;
+ so->used++;
+ entry->key = key;
+ entry->hash = hash;
+ if ((size_t)so->fill*3 < mask*2)
+ return 0;
+ return set_table_resize(so, so->used);
+
+ found_active:
+ Py_DECREF(key);
+ return 0;
+
+ comparison_error:
+ Py_DECREF(key);
+ return -1;
}
/*
@@ -172,38 +292,6 @@
/* ======== End logic for probing the hash table ========================== */
/* ======================================================================== */
-
-/*
-Internal routine to insert a new key into the table.
-Used by the public insert routine.
-Eats a reference to key.
-*/
-static int
-set_insert_key(PySetObject *so, PyObject *key, Py_hash_t hash)
-{
- setentry *entry;
-
- entry = set_lookkey(so, key, hash);
- if (entry == NULL)
- return -1;
- if (entry->key == NULL) {
- /* UNUSED */
- entry->key = key;
- entry->hash = hash;
- so->fill++;
- so->used++;
- } else if (entry->key == dummy) {
- /* DUMMY */
- entry->key = key;
- entry->hash = hash;
- so->used++;
- } else {
- /* ACTIVE */
- Py_DECREF(key);
- }
- return 0;
-}
-
/*
Restructure the table by allocating a new table and reinserting all
keys again. When entries have been deleted, the new table may
@@ -220,6 +308,7 @@
setentry small_copy[PySet_MINSIZE];
assert(minused >= 0);
+ minused = (minused > 50000) ? minused * 2 : minused * 4;
/* Find the smallest table size > minused. */
/* XXX speed-up with intrinsics */
@@ -295,57 +384,30 @@
return 0;
}
-/* CAUTION: set_add_key/entry() must guarantee it won't resize the table */
-
static int
-set_add_entry(PySetObject *so, setentry *entry)
+set_contains_entry(PySetObject *so, PyObject *key, Py_hash_t hash)
{
- Py_ssize_t n_used;
- PyObject *key = entry->key;
- Py_hash_t hash = entry->hash;
+ setentry *entry;
- assert(so->fill <= so->mask); /* at least one empty slot */
- n_used = so->used;
- Py_INCREF(key);
- if (set_insert_key(so, key, hash)) {
- Py_DECREF(key);
- return -1;
- }
- if (!(so->used > n_used && so->fill*3 >= (so->mask+1)*2))
- return 0;
- return set_table_resize(so, so->used>50000 ? so->used*2 : so->used*4);
-}
-
-static int
-set_add_key(PySetObject *so, PyObject *key)
-{
- setentry entry;
- Py_hash_t hash;
-
- if (!PyUnicode_CheckExact(key) ||
- (hash = ((PyASCIIObject *) key)->hash) == -1) {
- hash = PyObject_Hash(key);
- if (hash == -1)
- return -1;
- }
- entry.key = key;
- entry.hash = hash;
- return set_add_entry(so, &entry);
+ entry = set_lookkey(so, key, hash);
+ if (entry != NULL)
+ return entry->key != NULL;
+ return -1;
}
#define DISCARD_NOTFOUND 0
#define DISCARD_FOUND 1
static int
-set_discard_entry(PySetObject *so, setentry *oldentry)
+set_discard_entry(PySetObject *so, PyObject *key, Py_hash_t hash)
{
setentry *entry;
PyObject *old_key;
- entry = set_lookkey(so, oldentry->key, oldentry->hash);
+ entry = set_lookkey(so, key, hash);
if (entry == NULL)
return -1;
- if (entry->key == NULL || entry->key == dummy)
+ if (entry->key == NULL)
return DISCARD_NOTFOUND;
old_key = entry->key;
entry->key = dummy;
@@ -356,22 +418,45 @@
}
static int
-set_discard_key(PySetObject *so, PyObject *key)
+set_add_key(PySetObject *so, PyObject *key)
{
- setentry entry;
Py_hash_t hash;
- assert (PyAnySet_Check(so));
-
if (!PyUnicode_CheckExact(key) ||
(hash = ((PyASCIIObject *) key)->hash) == -1) {
hash = PyObject_Hash(key);
if (hash == -1)
return -1;
}
- entry.key = key;
- entry.hash = hash;
- return set_discard_entry(so, &entry);
+ return set_add_entry(so, key, hash);
+}
+
+static int
+set_contains_key(PySetObject *so, PyObject *key)
+{
+ Py_hash_t hash;
+
+ if (!PyUnicode_CheckExact(key) ||
+ (hash = ((PyASCIIObject *) key)->hash) == -1) {
+ hash = PyObject_Hash(key);
+ if (hash == -1)
+ return -1;
+ }
+ return set_contains_entry(so, key, hash);
+}
+
+static int
+set_discard_key(PySetObject *so, PyObject *key)
+{
+ Py_hash_t hash;
+
+ if (!PyUnicode_CheckExact(key) ||
+ (hash = ((PyASCIIObject *) key)->hash) == -1) {
+ hash = PyObject_Hash(key);
+ if (hash == -1)
+ return -1;
+ }
+ return set_discard_entry(so, key, hash);
}
static void
@@ -452,20 +537,22 @@
{
Py_ssize_t i;
Py_ssize_t mask;
- setentry *table;
+ setentry *entry;
assert (PyAnySet_Check(so));
i = *pos_ptr;
assert(i >= 0);
- table = so->table;
mask = so->mask;
- while (i <= mask && (table[i].key == NULL || table[i].key == dummy))
+ entry = &so->table[i];
+ while (i <= mask && (entry->key == NULL || entry->key == dummy)) {
i++;
+ entry++;
+ }
*pos_ptr = i+1;
if (i > mask)
return 0;
- assert(table[i].key != NULL);
- *entry_ptr = &table[i];
+ assert(entry != NULL);
+ *entry_ptr = entry;
return 1;
}
@@ -563,8 +650,8 @@
* incrementally resizing as we insert new keys. Expect
* that there will be no (or few) overlapping keys.
*/
- if ((so->fill + other->used)*3 >= (so->mask+1)*2) {
- if (set_table_resize(so, (so->used + other->used)*2) != 0)
+ if ((so->fill + other->used)*3 >= so->mask*2) {
+ if (set_table_resize(so, so->used + other->used) != 0)
return -1;
}
so_entry = so->table;
@@ -604,46 +691,13 @@
other_entry = &other->table[i];
key = other_entry->key;
if (key != NULL && key != dummy) {
- Py_INCREF(key);
- if (set_insert_key(so, key, other_entry->hash)) {
- Py_DECREF(key);
+ if (set_add_entry(so, key, other_entry->hash))
return -1;
- }
}
}
return 0;
}
-static int
-set_contains_entry(PySetObject *so, setentry *entry)
-{
- PyObject *key;
- setentry *lu_entry;
-
- lu_entry = set_lookkey(so, entry->key, entry->hash);
- if (lu_entry == NULL)
- return -1;
- key = lu_entry->key;
- return key != NULL && key != dummy;
-}
-
-static int
-set_contains_key(PySetObject *so, PyObject *key)
-{
- setentry entry;
- Py_hash_t hash;
-
- if (!PyUnicode_CheckExact(key) ||
- (hash = ((PyASCIIObject *) key)->hash) == -1) {
- hash = PyObject_Hash(key);
- if (hash == -1)
- return -1;
- }
- entry.key = key;
- entry.hash = hash;
- return set_contains_entry(so, &entry);
-}
-
static PyObject *
set_pop(PySetObject *so)
{
@@ -685,43 +739,64 @@
return 0;
}
+/* Work to increase the bit dispersion for closely spaced hash values.
+ This is important because some use cases have many combinations of a
+ small number of elements with nearby hashes so that many distinct
+ combinations collapse to only a handful of distinct hash values. */
+
+static Py_uhash_t
+_shuffle_bits(Py_uhash_t h)
+{
+ return ((h ^ 89869747UL) ^ (h << 16)) * 3644798167UL;
+}
+
+/* Most of the constants in this hash algorithm are randomly chosen
+ large primes with "interesting bit patterns" and that passed tests
+ for good collision statistics on a variety of problematic datasets
+ including powersets and graph structures (such as David Eppstein's
+ graph recipes in Lib/test/test_set.py) */
+
static Py_hash_t
frozenset_hash(PyObject *self)
{
- /* Most of the constants in this hash algorithm are randomly choosen
- large primes with "interesting bit patterns" and that passed
- tests for good collision statistics on a variety of problematic
- datasets such as:
-
- ps = []
- for r in range(21):
- ps += itertools.combinations(range(20), r)
- num_distinct_hashes = len({hash(frozenset(s)) for s in ps})
-
- */
PySetObject *so = (PySetObject *)self;
- Py_uhash_t h, hash = 1927868237UL;
+ Py_uhash_t hash = 0;
setentry *entry;
- Py_ssize_t pos = 0;
if (so->hash != -1)
return so->hash;
- hash *= (Py_uhash_t)PySet_GET_SIZE(self) + 1;
- while (set_next(so, &pos, &entry)) {
- /* Work to increase the bit dispersion for closely spaced hash
- values. This is important because some use cases have many
- combinations of a small number of elements with nearby
- hashes so that many distinct combinations collapse to only
- a handful of distinct hash values. */
- h = entry->hash;
- hash ^= ((h ^ 89869747UL) ^ (h << 16)) * 3644798167UL;
- }
- /* Make the final result spread-out in a different pattern
- than the algorithm for tuples or other python objects. */
+ /* Xor-in shuffled bits from every entry's hash field because xor is
+ commutative and a frozenset hash should be independent of order.
+
+ For speed, include null entries and dummy entries and then
+ subtract out their effect afterwards so that the final hash
+ depends only on active entries. This allows the code to be
+ vectorized by the compiler and it saves the unpredictable
+ branches that would arise when trying to exclude null and dummy
+ entries on every iteration. */
+
+ for (entry = so->table; entry <= &so->table[so->mask]; entry++)
+ hash ^= _shuffle_bits(entry->hash);
+
+ /* Remove the effect of an odd number of NULL entries */
+ if ((so->mask + 1 - so->fill) & 1)
+ hash ^= _shuffle_bits(0);
+
+ /* Remove the effect of an odd number of dummy entries */
+ if ((so->fill - so->used) & 1)
+ hash ^= _shuffle_bits(-1);
+
+ /* Factor in the number of active entries */
+ hash ^= ((Py_uhash_t)PySet_GET_SIZE(self) + 1) * 1927868237UL;
+
+ /* Disperse patterns arising in nested frozensets */
hash = hash * 69069U + 907133923UL;
+
+ /* -1 is reserved as an error code */
if (hash == (Py_uhash_t)-1)
hash = 590923713UL;
+
so->hash = hash;
return hash;
}
@@ -868,7 +943,7 @@
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */
0, /* tp_doc */
(traverseproc)setiter_traverse, /* tp_traverse */
0, /* tp_clear */
@@ -913,18 +988,14 @@
* incrementally resizing as we insert new keys. Expect
* that there will be no (or few) overlapping keys.
*/
- if (dictsize == -1)
+ if (dictsize < 0)
return -1;
- if ((so->fill + dictsize)*3 >= (so->mask+1)*2) {
- if (set_table_resize(so, (so->used + dictsize)*2) != 0)
+ if ((so->fill + dictsize)*3 >= so->mask*2) {
+ if (set_table_resize(so, so->used + dictsize) != 0)
return -1;
}
while (_PyDict_Next(other, &pos, &key, &value, &hash)) {
- setentry an_entry;
-
- an_entry.hash = hash;
- an_entry.key = key;
- if (set_add_entry(so, &an_entry))
+ if (set_add_entry(so, key, hash))
return -1;
}
return 0;
@@ -1204,6 +1275,8 @@
{
PySetObject *result;
PyObject *key, *it, *tmp;
+ Py_hash_t hash;
+ int rv;
if ((PyObject *)so == other)
return set_copy(so);
@@ -1223,13 +1296,15 @@
}
while (set_next((PySetObject *)other, &pos, &entry)) {
- int rv = set_contains_entry(so, entry);
- if (rv == -1) {
+ key = entry->key;
+ hash = entry->hash;
+ rv = set_contains_entry(so, key, hash);
+ if (rv < 0) {
Py_DECREF(result);
return NULL;
}
if (rv) {
- if (set_add_entry(result, entry)) {
+ if (set_add_entry(result, key, hash)) {
Py_DECREF(result);
return NULL;
}
@@ -1245,32 +1320,15 @@
}
while ((key = PyIter_Next(it)) != NULL) {
- int rv;
- setentry entry;
- Py_hash_t hash = PyObject_Hash(key);
-
- if (hash == -1) {
- Py_DECREF(it);
- Py_DECREF(result);
- Py_DECREF(key);
- return NULL;
- }
- entry.hash = hash;
- entry.key = key;
- rv = set_contains_entry(so, &entry);
- if (rv == -1) {
- Py_DECREF(it);
- Py_DECREF(result);
- Py_DECREF(key);
- return NULL;
- }
+ hash = PyObject_Hash(key);
+ if (hash == -1)
+ goto error;
+ rv = set_contains_entry(so, key, hash);
+ if (rv < 0)
+ goto error;
if (rv) {
- if (set_add_entry(result, &entry)) {
- Py_DECREF(it);
- Py_DECREF(result);
- Py_DECREF(key);
- return NULL;
- }
+ if (set_add_entry(result, key, hash))
+ goto error;
}
Py_DECREF(key);
}
@@ -1280,6 +1338,11 @@
return NULL;
}
return (PyObject *)result;
+ error:
+ Py_DECREF(it);
+ Py_DECREF(result);
+ Py_DECREF(key);
+ return NULL;
}
static PyObject *
@@ -1366,6 +1429,7 @@
set_isdisjoint(PySetObject *so, PyObject *other)
{
PyObject *key, *it, *tmp;
+ int rv;
if ((PyObject *)so == other) {
if (PySet_GET_SIZE(so) == 0)
@@ -1384,8 +1448,8 @@
other = tmp;
}
while (set_next((PySetObject *)other, &pos, &entry)) {
- int rv = set_contains_entry(so, entry);
- if (rv == -1)
+ rv = set_contains_entry(so, entry->key, entry->hash);
+ if (rv < 0)
return NULL;
if (rv)
Py_RETURN_FALSE;
@@ -1398,8 +1462,6 @@
return NULL;
while ((key = PyIter_Next(it)) != NULL) {
- int rv;
- setentry entry;
Py_hash_t hash = PyObject_Hash(key);
if (hash == -1) {
@@ -1407,11 +1469,9 @@
Py_DECREF(it);
return NULL;
}
- entry.hash = hash;
- entry.key = key;
- rv = set_contains_entry(so, &entry);
+ rv = set_contains_entry(so, key, hash);
Py_DECREF(key);
- if (rv == -1) {
+ if (rv < 0) {
Py_DECREF(it);
return NULL;
}
@@ -1440,7 +1500,7 @@
Py_ssize_t pos = 0;
while (set_next((PySetObject *)other, &pos, &entry))
- if (set_discard_entry(so, entry) == -1)
+ if (set_discard_entry(so, entry->key, entry->hash) < 0)
return -1;
} else {
PyObject *key, *it;
@@ -1449,7 +1509,7 @@
return -1;
while ((key = PyIter_Next(it)) != NULL) {
- if (set_discard_key(so, key) == -1) {
+ if (set_discard_key(so, key) < 0) {
Py_DECREF(it);
Py_DECREF(key);
return -1;
@@ -1460,10 +1520,10 @@
if (PyErr_Occurred())
return -1;
}
- /* If more than 1/5 are dummies, then resize them away. */
- if ((so->fill - so->used) * 5 < so->mask)
+ /* If more than 1/4th are dummies, then resize them away. */
+ if ((size_t)(so->fill - so->used) <= (size_t)so->mask / 4)
return 0;
- return set_table_resize(so, so->used>50000 ? so->used*2 : so->used*4);
+ return set_table_resize(so, so->used);
}
static PyObject *
@@ -1490,7 +1550,7 @@
result = set_copy(so);
if (result == NULL)
return NULL;
- if (set_difference_update_internal((PySetObject *) result, other) != -1)
+ if (set_difference_update_internal((PySetObject *) result, other) == 0)
return result;
Py_DECREF(result);
return NULL;
@@ -1500,8 +1560,11 @@
set_difference(PySetObject *so, PyObject *other)
{
PyObject *result;
+ PyObject *key;
+ Py_hash_t hash;
setentry *entry;
Py_ssize_t pos = 0;
+ int rv;
if (!PyAnySet_Check(other) && !PyDict_CheckExact(other)) {
return set_copy_and_difference(so, other);
@@ -1519,17 +1582,15 @@
if (PyDict_CheckExact(other)) {
while (set_next(so, &pos, &entry)) {
- setentry entrycopy;
- int rv;
- entrycopy.hash = entry->hash;
- entrycopy.key = entry->key;
- rv = _PyDict_Contains(other, entry->key, entry->hash);
+ key = entry->key;
+ hash = entry->hash;
+ rv = _PyDict_Contains(other, key, hash);
if (rv < 0) {
Py_DECREF(result);
return NULL;
}
if (!rv) {
- if (set_add_entry((PySetObject *)result, &entrycopy)) {
+ if (set_add_entry((PySetObject *)result, key, hash)) {
Py_DECREF(result);
return NULL;
}
@@ -1540,13 +1601,15 @@
/* Iterate over so, checking for common elements in other. */
while (set_next(so, &pos, &entry)) {
- int rv = set_contains_entry((PySetObject *)other, entry);
- if (rv == -1) {
+ key = entry->key;
+ hash = entry->hash;
+ rv = set_contains_entry((PySetObject *)other, key, hash);
+ if (rv < 0) {
Py_DECREF(result);
return NULL;
}
if (!rv) {
- if (set_add_entry((PySetObject *)result, entry)) {
+ if (set_add_entry((PySetObject *)result, key, hash)) {
Py_DECREF(result);
return NULL;
}
@@ -1608,29 +1671,24 @@
PySetObject *otherset;
PyObject *key;
Py_ssize_t pos = 0;
+ Py_hash_t hash;
setentry *entry;
+ int rv;
if ((PyObject *)so == other)
return set_clear(so);
if (PyDict_CheckExact(other)) {
PyObject *value;
- int rv;
- Py_hash_t hash;
while (_PyDict_Next(other, &pos, &key, &value, &hash)) {
- setentry an_entry;
-
Py_INCREF(key);
- an_entry.hash = hash;
- an_entry.key = key;
-
- rv = set_discard_entry(so, &an_entry);
- if (rv == -1) {
+ rv = set_discard_entry(so, key, hash);
+ if (rv < 0) {
Py_DECREF(key);
return NULL;
}
if (rv == DISCARD_NOTFOUND) {
- if (set_add_entry(so, &an_entry)) {
+ if (set_add_entry(so, key, hash)) {
Py_DECREF(key);
return NULL;
}
@@ -1650,13 +1708,15 @@
}
while (set_next(otherset, &pos, &entry)) {
- int rv = set_discard_entry(so, entry);
- if (rv == -1) {
+ key = entry->key;
+ hash = entry->hash;
+ rv = set_discard_entry(so, key, hash);
+ if (rv < 0) {
Py_DECREF(otherset);
return NULL;
}
if (rv == DISCARD_NOTFOUND) {
- if (set_add_entry(so, entry)) {
+ if (set_add_entry(so, key, hash)) {
Py_DECREF(otherset);
return NULL;
}
@@ -1718,6 +1778,7 @@
{
setentry *entry;
Py_ssize_t pos = 0;
+ int rv;
if (!PyAnySet_Check(other)) {
PyObject *tmp, *result;
@@ -1732,8 +1793,8 @@
Py_RETURN_FALSE;
while (set_next(so, &pos, &entry)) {
- int rv = set_contains_entry((PySetObject *)other, entry);
- if (rv == -1)
+ rv = set_contains_entry((PySetObject *)other, entry->key, entry->hash);
+ if (rv < 0)
return NULL;
if (!rv)
Py_RETURN_FALSE;
@@ -1824,7 +1885,7 @@
int rv;
rv = set_contains_key(so, key);
- if (rv == -1) {
+ if (rv < 0) {
if (!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError))
return -1;
PyErr_Clear();
@@ -1843,7 +1904,7 @@
long result;
result = set_contains(so, key);
- if (result == -1)
+ if (result < 0)
return NULL;
return PyBool_FromLong(result);
}
@@ -1857,7 +1918,7 @@
int rv;
rv = set_discard_key(so, key);
- if (rv == -1) {
+ if (rv < 0) {
if (!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError))
return NULL;
PyErr_Clear();
@@ -1866,7 +1927,7 @@
return NULL;
rv = set_discard_key(so, tmpkey);
Py_DECREF(tmpkey);
- if (rv == -1)
+ if (rv < 0)
return NULL;
}
@@ -1889,7 +1950,7 @@
int rv;
rv = set_discard_key(so, key);
- if (rv == -1) {
+ if (rv < 0) {
if (!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError))
return NULL;
PyErr_Clear();
@@ -1898,7 +1959,7 @@
return NULL;
rv = set_discard_key(so, tmpkey);
Py_DECREF(tmpkey);
- if (rv == -1)
+ if (rv < 0)
return NULL;
}
Py_RETURN_NONE;
@@ -2125,7 +2186,7 @@
copy_doc},
{"difference", (PyCFunction)set_difference_multi, METH_VARARGS,
difference_doc},
- {"intersection",(PyCFunction)set_intersection_multi, METH_VARARGS,
+ {"intersection", (PyCFunction)set_intersection_multi, METH_VARARGS,
intersection_doc},
{"isdisjoint", (PyCFunction)set_isdisjoint, METH_O,
isdisjoint_doc},
@@ -2196,7 +2257,7 @@
(traverseproc)set_traverse, /* tp_traverse */
(inquiry)set_clear_internal, /* tp_clear */
(richcmpfunc)set_richcompare, /* tp_richcompare */
- offsetof(PySetObject, weakreflist), /* tp_weaklistoffset */
+ offsetof(PySetObject, weakreflist), /* tp_weaklistoffset */
(getiterfunc)set_iter, /* tp_iter */
0, /* tp_iternext */
frozenset_methods, /* tp_methods */
diff --git a/Objects/stringlib/codecs.h b/Objects/stringlib/codecs.h
index 0fc6b58..2beb604 100644
--- a/Objects/stringlib/codecs.h
+++ b/Objects/stringlib/codecs.h
@@ -263,49 +263,33 @@
#define MAX_SHORT_UNICHARS 300 /* largest size we'll do on the stack */
Py_ssize_t i; /* index into s of next input byte */
- PyObject *result; /* result string object */
char *p; /* next free byte in output buffer */
- Py_ssize_t nallocated; /* number of result bytes allocated */
- Py_ssize_t nneeded; /* number of result bytes needed */
#if STRINGLIB_SIZEOF_CHAR > 1
- PyObject *errorHandler = NULL;
+ PyObject *error_handler_obj = NULL;
PyObject *exc = NULL;
PyObject *rep = NULL;
+ _Py_error_handler error_handler = _Py_ERROR_UNKNOWN;
#endif
#if STRINGLIB_SIZEOF_CHAR == 1
const Py_ssize_t max_char_size = 2;
- char stackbuf[MAX_SHORT_UNICHARS * 2];
#elif STRINGLIB_SIZEOF_CHAR == 2
const Py_ssize_t max_char_size = 3;
- char stackbuf[MAX_SHORT_UNICHARS * 3];
#else /* STRINGLIB_SIZEOF_CHAR == 4 */
const Py_ssize_t max_char_size = 4;
- char stackbuf[MAX_SHORT_UNICHARS * 4];
#endif
+ _PyBytesWriter writer;
assert(size >= 0);
+ _PyBytesWriter_Init(&writer);
- if (size <= MAX_SHORT_UNICHARS) {
- /* Write into the stack buffer; nallocated can't overflow.
- * At the end, we'll allocate exactly as much heap space as it
- * turns out we need.
- */
- nallocated = Py_SAFE_DOWNCAST(sizeof(stackbuf), size_t, int);
- result = NULL; /* will allocate after we're done */
- p = stackbuf;
+ if (size > PY_SSIZE_T_MAX / max_char_size) {
+ /* integer overflow */
+ return PyErr_NoMemory();
}
- else {
- if (size > PY_SSIZE_T_MAX / max_char_size) {
- /* integer overflow */
- return PyErr_NoMemory();
- }
- /* Overallocate on the heap, and give the excess back at the end. */
- nallocated = size * max_char_size;
- result = PyBytes_FromStringAndSize(NULL, nallocated);
- if (result == NULL)
- return NULL;
- p = PyBytes_AS_STRING(result);
- }
+
+ p = _PyBytesWriter_Alloc(&writer, size * max_char_size);
+ if (p == NULL)
+ return NULL;
for (i = 0; i < size;) {
Py_UCS4 ch = data[i++];
@@ -326,72 +310,118 @@
}
#if STRINGLIB_SIZEOF_CHAR > 1
else if (Py_UNICODE_IS_SURROGATE(ch)) {
- Py_ssize_t newpos;
- Py_ssize_t repsize, k, startpos;
+ Py_ssize_t startpos, endpos, newpos;
+ Py_ssize_t k;
+ if (error_handler == _Py_ERROR_UNKNOWN)
+ error_handler = get_error_handler(errors);
+
startpos = i-1;
- rep = unicode_encode_call_errorhandler(
- errors, &errorHandler, "utf-8", "surrogates not allowed",
- unicode, &exc, startpos, startpos+1, &newpos);
- if (!rep)
- goto error;
+ endpos = startpos+1;
- if (PyBytes_Check(rep))
- repsize = PyBytes_GET_SIZE(rep);
- else
- repsize = PyUnicode_GET_LENGTH(rep);
+ while ((endpos < size) && Py_UNICODE_IS_SURROGATE(data[endpos]))
+ endpos++;
- if (repsize > max_char_size) {
- Py_ssize_t offset;
+ /* Only overallocate the buffer if it's not the last write */
+ writer.overallocate = (endpos < size);
- if (result == NULL)
- offset = p - stackbuf;
- else
- offset = p - PyBytes_AS_STRING(result);
+ switch (error_handler)
+ {
+ case _Py_ERROR_REPLACE:
+ memset(p, '?', endpos - startpos);
+ p += (endpos - startpos);
+ /* fall through the ignore handler */
+ case _Py_ERROR_IGNORE:
+ i += (endpos - startpos - 1);
+ break;
- if (nallocated > PY_SSIZE_T_MAX - repsize + max_char_size) {
- /* integer overflow */
- PyErr_NoMemory();
- goto error;
+ case _Py_ERROR_SURROGATEPASS:
+ for (k=startpos; k<endpos; k++) {
+ ch = data[k];
+ *p++ = (char)(0xe0 | (ch >> 12));
+ *p++ = (char)(0x80 | ((ch >> 6) & 0x3f));
+ *p++ = (char)(0x80 | (ch & 0x3f));
}
- nallocated += repsize - max_char_size;
- if (result != NULL) {
- if (_PyBytes_Resize(&result, nallocated) < 0)
- goto error;
- } else {
- result = PyBytes_FromStringAndSize(NULL, nallocated);
- if (result == NULL)
- goto error;
- Py_MEMCPY(PyBytes_AS_STRING(result), stackbuf, offset);
- }
- p = PyBytes_AS_STRING(result) + offset;
- }
+ i += (endpos - startpos - 1);
+ break;
- if (PyBytes_Check(rep)) {
- char *prep = PyBytes_AS_STRING(rep);
- for(k = repsize; k > 0; k--)
- *p++ = *prep++;
- } else /* rep is unicode */ {
- enum PyUnicode_Kind repkind;
- void *repdata;
-
- if (PyUnicode_READY(rep) < 0)
+ case _Py_ERROR_BACKSLASHREPLACE:
+ /* substract preallocated bytes */
+ writer.min_size -= max_char_size * (endpos - startpos);
+ p = backslashreplace(&writer, p,
+ unicode, startpos, endpos);
+ if (p == NULL)
goto error;
- repkind = PyUnicode_KIND(rep);
- repdata = PyUnicode_DATA(rep);
+ i += (endpos - startpos - 1);
+ break;
- for(k=0; k<repsize; k++) {
- Py_UCS4 c = PyUnicode_READ(repkind, repdata, k);
- if (0x80 <= c) {
+ case _Py_ERROR_XMLCHARREFREPLACE:
+ /* substract preallocated bytes */
+ writer.min_size -= max_char_size * (endpos - startpos);
+ p = xmlcharrefreplace(&writer, p,
+ unicode, startpos, endpos);
+ if (p == NULL)
+ goto error;
+ i += (endpos - startpos - 1);
+ break;
+
+ case _Py_ERROR_SURROGATEESCAPE:
+ for (k=startpos; k<endpos; k++) {
+ ch = data[k];
+ if (!(0xDC80 <= ch && ch <= 0xDCFF))
+ break;
+ *p++ = (char)(ch & 0xff);
+ }
+ if (k >= endpos) {
+ i += (endpos - startpos - 1);
+ break;
+ }
+ startpos = k;
+ assert(startpos < endpos);
+ /* fall through the default handler */
+ default:
+ rep = unicode_encode_call_errorhandler(
+ errors, &error_handler_obj, "utf-8", "surrogates not allowed",
+ unicode, &exc, startpos, endpos, &newpos);
+ if (!rep)
+ goto error;
+
+ /* substract preallocated bytes */
+ writer.min_size -= max_char_size;
+
+ if (PyBytes_Check(rep)) {
+ p = _PyBytesWriter_WriteBytes(&writer, p,
+ PyBytes_AS_STRING(rep),
+ PyBytes_GET_SIZE(rep));
+ }
+ else {
+ /* rep is unicode */
+ if (PyUnicode_READY(rep) < 0)
+ goto error;
+
+ if (!PyUnicode_IS_ASCII(rep)) {
raise_encode_exception(&exc, "utf-8",
unicode,
i-1, i,
"surrogates not allowed");
goto error;
}
- *p++ = (char)c;
+
+ assert(PyUnicode_KIND(rep) == PyUnicode_1BYTE_KIND);
+ p = _PyBytesWriter_WriteBytes(&writer, p,
+ PyUnicode_DATA(rep),
+ PyUnicode_GET_LENGTH(rep));
}
+
+ if (p == NULL)
+ goto error;
+ Py_CLEAR(rep);
+
+ i = newpos;
}
- Py_CLEAR(rep);
+
+ /* If overallocation was disabled, ensure that it was the last
+ write. Otherwise, we missed an optimization */
+ assert(writer.overallocate || i == size);
}
else
#if STRINGLIB_SIZEOF_CHAR > 2
@@ -416,31 +446,18 @@
#endif /* STRINGLIB_SIZEOF_CHAR > 1 */
}
- if (result == NULL) {
- /* This was stack allocated. */
- nneeded = p - stackbuf;
- assert(nneeded <= nallocated);
- result = PyBytes_FromStringAndSize(stackbuf, nneeded);
- }
- else {
- /* Cut back to size actually needed. */
- nneeded = p - PyBytes_AS_STRING(result);
- assert(nneeded <= nallocated);
- _PyBytes_Resize(&result, nneeded);
- }
-
#if STRINGLIB_SIZEOF_CHAR > 1
- Py_XDECREF(errorHandler);
+ Py_XDECREF(error_handler_obj);
Py_XDECREF(exc);
#endif
- return result;
+ return _PyBytesWriter_Finish(&writer, p);
#if STRINGLIB_SIZEOF_CHAR > 1
error:
Py_XDECREF(rep);
- Py_XDECREF(errorHandler);
+ Py_XDECREF(error_handler_obj);
Py_XDECREF(exc);
- Py_XDECREF(result);
+ _PyBytesWriter_Dealloc(&writer);
return NULL;
#endif
diff --git a/Objects/stringlib/unicode_format.h b/Objects/stringlib/unicode_format.h
index aec221a..d72e47d 100644
--- a/Objects/stringlib/unicode_format.h
+++ b/Objects/stringlib/unicode_format.h
@@ -67,7 +67,7 @@
return PyUnicode_Substring(str->str, str->start, str->end);
}
-/* return a new string. if str->str is NULL, return None */
+/* return a new string. if str->str is NULL, return a new empty string */
Py_LOCAL_INLINE(PyObject *)
SubString_new_object_or_empty(SubString *str)
{
diff --git a/Objects/structseq.c b/Objects/structseq.c
index 664344b..7209738 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -16,14 +16,14 @@
_Py_IDENTIFIER(n_unnamed_fields);
#define VISIBLE_SIZE(op) Py_SIZE(op)
-#define VISIBLE_SIZE_TP(tp) PyLong_AsLong( \
+#define VISIBLE_SIZE_TP(tp) PyLong_AsSsize_t( \
_PyDict_GetItemId((tp)->tp_dict, &PyId_n_sequence_fields))
-#define REAL_SIZE_TP(tp) PyLong_AsLong( \
+#define REAL_SIZE_TP(tp) PyLong_AsSsize_t( \
_PyDict_GetItemId((tp)->tp_dict, &PyId_n_fields))
#define REAL_SIZE(op) REAL_SIZE_TP(Py_TYPE(op))
-#define UNNAMED_FIELDS_TP(tp) PyLong_AsLong( \
+#define UNNAMED_FIELDS_TP(tp) PyLong_AsSsize_t( \
_PyDict_GetItemId((tp)->tp_dict, &PyId_n_unnamed_fields))
#define UNNAMED_FIELDS(op) UNNAMED_FIELDS_TP(Py_TYPE(op))
@@ -164,7 +164,8 @@
#define TYPE_MAXSIZE 100
PyTypeObject *typ = Py_TYPE(obj);
- int i, removelast = 0;
+ Py_ssize_t i;
+ int removelast = 0;
Py_ssize_t len;
char buf[REPR_BUFFER_SIZE];
char *endofbuf, *pbuf = buf;
@@ -236,8 +237,7 @@
PyObject* tup = NULL;
PyObject* dict = NULL;
PyObject* result;
- Py_ssize_t n_fields, n_visible_fields, n_unnamed_fields;
- int i;
+ Py_ssize_t n_fields, n_visible_fields, n_unnamed_fields, i;
n_fields = REAL_SIZE(self);
n_visible_fields = VISIBLE_SIZE(self);
@@ -325,7 +325,7 @@
{
PyObject *dict;
PyMemberDef* members;
- int n_members, n_unnamed_members, i, k;
+ Py_ssize_t n_members, n_unnamed_members, i, k;
PyObject *v;
#ifdef Py_TRACE_REFS
@@ -373,9 +373,9 @@
Py_INCREF(type);
dict = type->tp_dict;
-#define SET_DICT_FROM_INT(key, value) \
+#define SET_DICT_FROM_SIZE(key, value) \
do { \
- v = PyLong_FromLong((long) value); \
+ v = PyLong_FromSsize_t(value); \
if (v == NULL) \
return -1; \
if (PyDict_SetItemString(dict, key, v) < 0) { \
@@ -385,9 +385,9 @@
Py_DECREF(v); \
} while (0)
- SET_DICT_FROM_INT(visible_length_key, desc->n_in_sequence);
- SET_DICT_FROM_INT(real_length_key, n_members);
- SET_DICT_FROM_INT(unnamed_fields_key, n_unnamed_members);
+ SET_DICT_FROM_SIZE(visible_length_key, desc->n_in_sequence);
+ SET_DICT_FROM_SIZE(real_length_key, n_members);
+ SET_DICT_FROM_SIZE(unnamed_fields_key, n_unnamed_members);
return 0;
}
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 782c51b..4b091f5 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -906,25 +906,33 @@
#endif
obj = type->tp_new(type, args, kwds);
- if (obj != NULL) {
- /* Ugly exception: when the call was type(something),
- don't call tp_init on the result. */
- if (type == &PyType_Type &&
- PyTuple_Check(args) && PyTuple_GET_SIZE(args) == 1 &&
- (kwds == NULL ||
- (PyDict_Check(kwds) && PyDict_Size(kwds) == 0)))
- return obj;
- /* If the returned object is not an instance of type,
- it won't be initialized. */
- if (!PyType_IsSubtype(Py_TYPE(obj), type))
- return obj;
- type = Py_TYPE(obj);
- if (type->tp_init != NULL) {
- int res = type->tp_init(obj, args, kwds);
- if (res < 0) {
- Py_DECREF(obj);
- obj = NULL;
- }
+ obj = _Py_CheckFunctionResult((PyObject*)type, obj, NULL);
+ if (obj == NULL)
+ return NULL;
+
+ /* Ugly exception: when the call was type(something),
+ don't call tp_init on the result. */
+ if (type == &PyType_Type &&
+ PyTuple_Check(args) && PyTuple_GET_SIZE(args) == 1 &&
+ (kwds == NULL ||
+ (PyDict_Check(kwds) && PyDict_Size(kwds) == 0)))
+ return obj;
+
+ /* If the returned object is not an instance of type,
+ it won't be initialized. */
+ if (!PyType_IsSubtype(Py_TYPE(obj), type))
+ return obj;
+
+ type = Py_TYPE(obj);
+ if (type->tp_init != NULL) {
+ int res = type->tp_init(obj, args, kwds);
+ if (res < 0) {
+ assert(PyErr_Occurred());
+ Py_DECREF(obj);
+ obj = NULL;
+ }
+ else {
+ assert(!PyErr_Occurred());
}
}
return obj;
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 168f9f9..35df747 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -42,6 +42,7 @@
#include "Python.h"
#include "ucnhash.h"
#include "bytes_methods.h"
+#include "stringlib/eq.h"
#ifdef MS_WINDOWS
#include <windows.h>
@@ -162,6 +163,14 @@
*_to++ = (to_type) *_iter++; \
} while (0)
+#ifdef MS_WINDOWS
+ /* On Windows, overallocate by 50% is the best factor */
+# define OVERALLOCATE_FACTOR 2
+#else
+ /* On Linux, overallocate by 25% is the best factor */
+# define OVERALLOCATE_FACTOR 4
+#endif
+
/* This dictionary holds all interned unicode strings. Note that references
to strings in this dictionary are *not* counted in the string's ob_refcnt.
When the interned string reaches a refcnt of 0 the string deallocation
@@ -292,6 +301,38 @@
#include "clinic/unicodeobject.c.h"
+typedef enum {
+ _Py_ERROR_UNKNOWN=0,
+ _Py_ERROR_STRICT,
+ _Py_ERROR_SURROGATEESCAPE,
+ _Py_ERROR_REPLACE,
+ _Py_ERROR_IGNORE,
+ _Py_ERROR_BACKSLASHREPLACE,
+ _Py_ERROR_SURROGATEPASS,
+ _Py_ERROR_XMLCHARREFREPLACE,
+ _Py_ERROR_OTHER
+} _Py_error_handler;
+
+static _Py_error_handler
+get_error_handler(const char *errors)
+{
+ if (errors == NULL || strcmp(errors, "strict") == 0)
+ return _Py_ERROR_STRICT;
+ if (strcmp(errors, "surrogateescape") == 0)
+ return _Py_ERROR_SURROGATEESCAPE;
+ if (strcmp(errors, "replace") == 0)
+ return _Py_ERROR_REPLACE;
+ if (strcmp(errors, "ignore") == 0)
+ return _Py_ERROR_IGNORE;
+ if (strcmp(errors, "backslashreplace") == 0)
+ return _Py_ERROR_BACKSLASHREPLACE;
+ if (strcmp(errors, "surrogatepass") == 0)
+ return _Py_ERROR_SURROGATEPASS;
+ if (strcmp(errors, "xmlcharrefreplace") == 0)
+ return _Py_ERROR_XMLCHARREFREPLACE;
+ return _Py_ERROR_OTHER;
+}
+
/* The max unicode value is always 0x10FFFF while using the PEP-393 API.
This function is kept for backward compatibility with the old API. */
Py_UNICODE
@@ -521,6 +562,129 @@
return _PyUnicode_Copy(unicode);
}
+/* Implementation of the "backslashreplace" error handler for 8-bit encodings:
+ ASCII, Latin1, UTF-8, etc. */
+static char*
+backslashreplace(_PyBytesWriter *writer, char *str,
+ PyObject *unicode, Py_ssize_t collstart, Py_ssize_t collend)
+{
+ Py_ssize_t size, i;
+ Py_UCS4 ch;
+ enum PyUnicode_Kind kind;
+ void *data;
+
+ assert(PyUnicode_IS_READY(unicode));
+ kind = PyUnicode_KIND(unicode);
+ data = PyUnicode_DATA(unicode);
+
+ size = 0;
+ /* determine replacement size */
+ for (i = collstart; i < collend; ++i) {
+ Py_ssize_t incr;
+
+ ch = PyUnicode_READ(kind, data, i);
+ if (ch < 0x100)
+ incr = 2+2;
+ else if (ch < 0x10000)
+ incr = 2+4;
+ else {
+ assert(ch <= MAX_UNICODE);
+ incr = 2+8;
+ }
+ if (size > PY_SSIZE_T_MAX - incr) {
+ PyErr_SetString(PyExc_OverflowError,
+ "encoded result is too long for a Python string");
+ return NULL;
+ }
+ size += incr;
+ }
+
+ str = _PyBytesWriter_Prepare(writer, str, size);
+ if (str == NULL)
+ return NULL;
+
+ /* generate replacement */
+ for (i = collstart; i < collend; ++i) {
+ ch = PyUnicode_READ(kind, data, i);
+ *str++ = '\\';
+ if (ch >= 0x00010000) {
+ *str++ = 'U';
+ *str++ = Py_hexdigits[(ch>>28)&0xf];
+ *str++ = Py_hexdigits[(ch>>24)&0xf];
+ *str++ = Py_hexdigits[(ch>>20)&0xf];
+ *str++ = Py_hexdigits[(ch>>16)&0xf];
+ *str++ = Py_hexdigits[(ch>>12)&0xf];
+ *str++ = Py_hexdigits[(ch>>8)&0xf];
+ }
+ else if (ch >= 0x100) {
+ *str++ = 'u';
+ *str++ = Py_hexdigits[(ch>>12)&0xf];
+ *str++ = Py_hexdigits[(ch>>8)&0xf];
+ }
+ else
+ *str++ = 'x';
+ *str++ = Py_hexdigits[(ch>>4)&0xf];
+ *str++ = Py_hexdigits[ch&0xf];
+ }
+ return str;
+}
+
+/* Implementation of the "xmlcharrefreplace" error handler for 8-bit encodings:
+ ASCII, Latin1, UTF-8, etc. */
+static char*
+xmlcharrefreplace(_PyBytesWriter *writer, char *str,
+ PyObject *unicode, Py_ssize_t collstart, Py_ssize_t collend)
+{
+ Py_ssize_t size, i;
+ Py_UCS4 ch;
+ enum PyUnicode_Kind kind;
+ void *data;
+
+ assert(PyUnicode_IS_READY(unicode));
+ kind = PyUnicode_KIND(unicode);
+ data = PyUnicode_DATA(unicode);
+
+ size = 0;
+ /* determine replacement size */
+ for (i = collstart; i < collend; ++i) {
+ Py_ssize_t incr;
+
+ ch = PyUnicode_READ(kind, data, i);
+ if (ch < 10)
+ incr = 2+1+1;
+ else if (ch < 100)
+ incr = 2+2+1;
+ else if (ch < 1000)
+ incr = 2+3+1;
+ else if (ch < 10000)
+ incr = 2+4+1;
+ else if (ch < 100000)
+ incr = 2+5+1;
+ else if (ch < 1000000)
+ incr = 2+6+1;
+ else {
+ assert(ch <= MAX_UNICODE);
+ incr = 2+7+1;
+ }
+ if (size > PY_SSIZE_T_MAX - incr) {
+ PyErr_SetString(PyExc_OverflowError,
+ "encoded result is too long for a Python string");
+ return NULL;
+ }
+ size += incr;
+ }
+
+ str = _PyBytesWriter_Prepare(writer, str, size);
+ if (str == NULL)
+ return NULL;
+
+ /* generate replacement */
+ for (i = collstart; i < collend; ++i) {
+ str += sprintf(str, "&#%d;", PyUnicode_READ(kind, data, i));
+ }
+ return str;
+}
+
/* --- Bloom Filters ----------------------------------------------------- */
/* stuff to implement simple "bloom filters" for Unicode characters.
@@ -3162,24 +3326,22 @@
static int
locale_error_handler(const char *errors, int *surrogateescape)
{
- if (errors == NULL) {
+ _Py_error_handler error_handler = get_error_handler(errors);
+ switch (error_handler)
+ {
+ case _Py_ERROR_STRICT:
*surrogateescape = 0;
return 0;
- }
-
- if (strcmp(errors, "strict") == 0) {
- *surrogateescape = 0;
- return 0;
- }
- if (strcmp(errors, "surrogateescape") == 0) {
+ case _Py_ERROR_SURROGATEESCAPE:
*surrogateescape = 1;
return 0;
+ default:
+ PyErr_Format(PyExc_ValueError,
+ "only 'strict' and 'surrogateescape' error handlers "
+ "are supported, not '%s'",
+ errors);
+ return -1;
}
- PyErr_Format(PyExc_ValueError,
- "only 'strict' and 'surrogateescape' error handlers "
- "are supported, not '%s'",
- errors);
- return -1;
}
PyObject *
@@ -4684,8 +4846,9 @@
Py_ssize_t startinpos;
Py_ssize_t endinpos;
const char *errmsg = "";
- PyObject *errorHandler = NULL;
+ PyObject *error_handler_obj = NULL;
PyObject *exc = NULL;
+ _Py_error_handler error_handler = _Py_ERROR_UNKNOWN;
if (size == 0) {
if (consumed)
@@ -4710,6 +4873,7 @@
while (s < end) {
Py_UCS4 ch;
int kind = writer.kind;
+
if (kind == PyUnicode_1BYTE_KIND) {
if (PyUnicode_IS_ASCII(writer.buffer))
ch = asciilib_utf8_decode(&s, end, writer.data, &writer.pos);
@@ -4748,24 +4912,56 @@
continue;
}
- if (unicode_decode_call_errorhandler_writer(
- errors, &errorHandler,
- "utf-8", errmsg,
- &starts, &end, &startinpos, &endinpos, &exc, &s,
- &writer))
- goto onError;
+ if (error_handler == _Py_ERROR_UNKNOWN)
+ error_handler = get_error_handler(errors);
+
+ switch (error_handler) {
+ case _Py_ERROR_IGNORE:
+ s += (endinpos - startinpos);
+ break;
+
+ case _Py_ERROR_REPLACE:
+ if (_PyUnicodeWriter_WriteCharInline(&writer, 0xfffd) < 0)
+ goto onError;
+ s += (endinpos - startinpos);
+ break;
+
+ case _Py_ERROR_SURROGATEESCAPE:
+ {
+ Py_ssize_t i;
+
+ if (_PyUnicodeWriter_PrepareKind(&writer, PyUnicode_2BYTE_KIND) < 0)
+ goto onError;
+ for (i=startinpos; i<endinpos; i++) {
+ ch = (Py_UCS4)(unsigned char)(starts[i]);
+ PyUnicode_WRITE(writer.kind, writer.data, writer.pos,
+ ch + 0xdc00);
+ writer.pos++;
+ }
+ s += (endinpos - startinpos);
+ break;
+ }
+
+ default:
+ if (unicode_decode_call_errorhandler_writer(
+ errors, &error_handler_obj,
+ "utf-8", errmsg,
+ &starts, &end, &startinpos, &endinpos, &exc, &s,
+ &writer))
+ goto onError;
+ }
}
End:
if (consumed)
*consumed = s - starts;
- Py_XDECREF(errorHandler);
+ Py_XDECREF(error_handler_obj);
Py_XDECREF(exc);
return _PyUnicodeWriter_Finish(&writer);
onError:
- Py_XDECREF(errorHandler);
+ Py_XDECREF(error_handler_obj);
Py_XDECREF(exc);
_PyUnicodeWriter_Dealloc(&writer);
return NULL;
@@ -6390,25 +6586,22 @@
static PyObject *
unicode_encode_ucs1(PyObject *unicode,
const char *errors,
- unsigned int limit)
+ const Py_UCS4 limit)
{
/* input state */
Py_ssize_t pos=0, size;
int kind;
void *data;
- /* output object */
- PyObject *res;
/* pointer into the output */
char *str;
- /* current output position */
- Py_ssize_t ressize;
const char *encoding = (limit == 256) ? "latin-1" : "ascii";
const char *reason = (limit == 256) ? "ordinal not in range(256)" : "ordinal not in range(128)";
- PyObject *errorHandler = NULL;
+ PyObject *error_handler_obj = NULL;
PyObject *exc = NULL;
- /* the following variable is used for caching string comparisons
- * -1=not initialized, 0=unknown, 1=strict, 2=replace, 3=ignore, 4=xmlcharrefreplace */
- int known_errorHandler = -1;
+ _Py_error_handler error_handler = _Py_ERROR_UNKNOWN;
+ PyObject *rep = NULL;
+ /* output object */
+ _PyBytesWriter writer;
if (PyUnicode_READY(unicode) == -1)
return NULL;
@@ -6419,186 +6612,157 @@
replacements, if we need more, we'll resize */
if (size == 0)
return PyBytes_FromStringAndSize(NULL, 0);
- res = PyBytes_FromStringAndSize(NULL, size);
- if (res == NULL)
+
+ _PyBytesWriter_Init(&writer);
+ str = _PyBytesWriter_Alloc(&writer, size);
+ if (str == NULL)
return NULL;
- str = PyBytes_AS_STRING(res);
- ressize = size;
while (pos < size) {
- Py_UCS4 c = PyUnicode_READ(kind, data, pos);
+ Py_UCS4 ch = PyUnicode_READ(kind, data, pos);
/* can we encode this? */
- if (c<limit) {
+ if (ch < limit) {
/* no overflow check, because we know that the space is enough */
- *str++ = (char)c;
+ *str++ = (char)ch;
++pos;
}
else {
- Py_ssize_t requiredsize;
- PyObject *repunicode;
- Py_ssize_t repsize, newpos, respos, i;
+ Py_ssize_t newpos, i;
/* startpos for collecting unencodable chars */
Py_ssize_t collstart = pos;
- Py_ssize_t collend = pos;
+ Py_ssize_t collend = collstart + 1;
/* find all unecodable characters */
+
while ((collend < size) && (PyUnicode_READ(kind, data, collend) >= limit))
++collend;
+
+ /* Only overallocate the buffer if it's not the last write */
+ writer.overallocate = (collend < size);
+
/* cache callback name lookup (if not done yet, i.e. it's the first error) */
- if (known_errorHandler==-1) {
- if ((errors==NULL) || (!strcmp(errors, "strict")))
- known_errorHandler = 1;
- else if (!strcmp(errors, "replace"))
- known_errorHandler = 2;
- else if (!strcmp(errors, "ignore"))
- known_errorHandler = 3;
- else if (!strcmp(errors, "xmlcharrefreplace"))
- known_errorHandler = 4;
- else
- known_errorHandler = 0;
- }
- switch (known_errorHandler) {
- case 1: /* strict */
+ if (error_handler == _Py_ERROR_UNKNOWN)
+ error_handler = get_error_handler(errors);
+
+ switch (error_handler) {
+ case _Py_ERROR_STRICT:
raise_encode_exception(&exc, encoding, unicode, collstart, collend, reason);
goto onError;
- case 2: /* replace */
- while (collstart++ < collend)
- *str++ = '?'; /* fall through */
- case 3: /* ignore */
+
+ case _Py_ERROR_REPLACE:
+ memset(str, '?', collend - collstart);
+ str += (collend - collstart);
+ /* fall through ignore error handler */
+ case _Py_ERROR_IGNORE:
pos = collend;
break;
- case 4: /* xmlcharrefreplace */
- respos = str - PyBytes_AS_STRING(res);
- requiredsize = respos;
- /* determine replacement size */
- for (i = collstart; i < collend; ++i) {
- Py_UCS4 ch = PyUnicode_READ(kind, data, i);
- Py_ssize_t incr;
- if (ch < 10)
- incr = 2+1+1;
- else if (ch < 100)
- incr = 2+2+1;
- else if (ch < 1000)
- incr = 2+3+1;
- else if (ch < 10000)
- incr = 2+4+1;
- else if (ch < 100000)
- incr = 2+5+1;
- else if (ch < 1000000)
- incr = 2+6+1;
- else {
- assert(ch <= MAX_UNICODE);
- incr = 2+7+1;
- }
- if (requiredsize > PY_SSIZE_T_MAX - incr)
- goto overflow;
- requiredsize += incr;
- }
- if (requiredsize > PY_SSIZE_T_MAX - (size - collend))
- goto overflow;
- requiredsize += size - collend;
- if (requiredsize > ressize) {
- if (ressize <= PY_SSIZE_T_MAX/2 && requiredsize < 2*ressize)
- requiredsize = 2*ressize;
- if (_PyBytes_Resize(&res, requiredsize))
- goto onError;
- str = PyBytes_AS_STRING(res) + respos;
- ressize = requiredsize;
- }
- /* generate replacement */
- for (i = collstart; i < collend; ++i) {
- str += sprintf(str, "&#%d;", PyUnicode_READ(kind, data, i));
- }
- pos = collend;
- break;
- default:
- repunicode = unicode_encode_call_errorhandler(errors, &errorHandler,
- encoding, reason, unicode, &exc,
- collstart, collend, &newpos);
- if (repunicode == NULL || (PyUnicode_Check(repunicode) &&
- PyUnicode_READY(repunicode) == -1))
+
+ case _Py_ERROR_BACKSLASHREPLACE:
+ /* substract preallocated bytes */
+ writer.min_size -= (collend - collstart);
+ str = backslashreplace(&writer, str,
+ unicode, collstart, collend);
+ if (str == NULL)
goto onError;
- if (PyBytes_Check(repunicode)) {
- /* Directly copy bytes result to output. */
- repsize = PyBytes_Size(repunicode);
- if (repsize > 1) {
- /* Make room for all additional bytes. */
- respos = str - PyBytes_AS_STRING(res);
- if (ressize > PY_SSIZE_T_MAX - repsize - 1) {
- Py_DECREF(repunicode);
- goto overflow;
- }
- if (_PyBytes_Resize(&res, ressize+repsize-1)) {
- Py_DECREF(repunicode);
- goto onError;
- }
- str = PyBytes_AS_STRING(res) + respos;
- ressize += repsize-1;
+ pos = collend;
+ break;
+
+ case _Py_ERROR_XMLCHARREFREPLACE:
+ /* substract preallocated bytes */
+ writer.min_size -= (collend - collstart);
+ str = xmlcharrefreplace(&writer, str,
+ unicode, collstart, collend);
+ if (str == NULL)
+ goto onError;
+ pos = collend;
+ break;
+
+ case _Py_ERROR_SURROGATEESCAPE:
+ for (i = collstart; i < collend; ++i) {
+ ch = PyUnicode_READ(kind, data, i);
+ if (ch < 0xdc80 || 0xdcff < ch) {
+ /* Not a UTF-8b surrogate */
+ break;
}
- memcpy(str, PyBytes_AsString(repunicode), repsize);
- str += repsize;
- pos = newpos;
- Py_DECREF(repunicode);
+ *str++ = (char)(ch - 0xdc00);
+ ++pos;
+ }
+ if (i >= collend)
break;
- }
- /* need more space? (at least enough for what we
- have+the replacement+the rest of the string, so
- we won't have to check space for encodable characters) */
- respos = str - PyBytes_AS_STRING(res);
- repsize = PyUnicode_GET_LENGTH(repunicode);
- requiredsize = respos;
- if (requiredsize > PY_SSIZE_T_MAX - repsize)
- goto overflow;
- requiredsize += repsize;
- if (requiredsize > PY_SSIZE_T_MAX - (size - collend))
- goto overflow;
- requiredsize += size - collend;
- if (requiredsize > ressize) {
- if (ressize <= PY_SSIZE_T_MAX/2 && requiredsize < 2*ressize)
- requiredsize = 2*ressize;
- if (_PyBytes_Resize(&res, requiredsize)) {
- Py_DECREF(repunicode);
+ collstart = pos;
+ assert(collstart != collend);
+ /* fallback to general error handling */
+
+ default:
+ rep = unicode_encode_call_errorhandler(errors, &error_handler_obj,
+ encoding, reason, unicode, &exc,
+ collstart, collend, &newpos);
+ if (rep == NULL)
+ goto onError;
+
+ /* substract preallocated bytes */
+ writer.min_size -= 1;
+
+ if (PyBytes_Check(rep)) {
+ /* Directly copy bytes result to output. */
+ str = _PyBytesWriter_WriteBytes(&writer, str,
+ PyBytes_AS_STRING(rep),
+ PyBytes_GET_SIZE(rep));
+ if (str == NULL)
goto onError;
- }
- str = PyBytes_AS_STRING(res) + respos;
- ressize = requiredsize;
}
- /* check if there is anything unencodable in the replacement
- and copy it to the output */
- for (i = 0; repsize-->0; ++i, ++str) {
- c = PyUnicode_READ_CHAR(repunicode, i);
- if (c >= limit) {
- raise_encode_exception(&exc, encoding, unicode,
- pos, pos+1, reason);
- Py_DECREF(repunicode);
+ else {
+ assert(PyUnicode_Check(rep));
+
+ if (PyUnicode_READY(rep) < 0)
goto onError;
+
+ if (PyUnicode_IS_ASCII(rep)) {
+ /* Fast path: all characters are smaller than limit */
+ assert(limit >= 128);
+ assert(PyUnicode_KIND(rep) == PyUnicode_1BYTE_KIND);
+ str = _PyBytesWriter_WriteBytes(&writer, str,
+ PyUnicode_DATA(rep),
+ PyUnicode_GET_LENGTH(rep));
}
- *str = (char)c;
+ else {
+ Py_ssize_t repsize = PyUnicode_GET_LENGTH(rep);
+
+ str = _PyBytesWriter_Prepare(&writer, str, repsize);
+ if (str == NULL)
+ goto onError;
+
+ /* check if there is anything unencodable in the
+ replacement and copy it to the output */
+ for (i = 0; repsize-->0; ++i, ++str) {
+ ch = PyUnicode_READ_CHAR(rep, i);
+ if (ch >= limit) {
+ raise_encode_exception(&exc, encoding, unicode,
+ pos, pos+1, reason);
+ goto onError;
+ }
+ *str = (char)ch;
+ }
+ }
}
pos = newpos;
- Py_DECREF(repunicode);
+ Py_CLEAR(rep);
}
+
+ /* If overallocation was disabled, ensure that it was the last
+ write. Otherwise, we missed an optimization */
+ assert(writer.overallocate || pos == size);
}
}
- /* Resize if we allocated to much */
- size = str - PyBytes_AS_STRING(res);
- if (size < ressize) { /* If this falls res will be NULL */
- assert(size >= 0);
- if (_PyBytes_Resize(&res, size) < 0)
- goto onError;
- }
- Py_XDECREF(errorHandler);
+ Py_XDECREF(error_handler_obj);
Py_XDECREF(exc);
- return res;
-
- overflow:
- PyErr_SetString(PyExc_OverflowError,
- "encoded result is too long for a Python string");
+ return _PyBytesWriter_Finish(&writer, str);
onError:
- Py_XDECREF(res);
- Py_XDECREF(errorHandler);
+ Py_XDECREF(rep);
+ _PyBytesWriter_Dealloc(&writer);
+ Py_XDECREF(error_handler_obj);
Py_XDECREF(exc);
return NULL;
}
@@ -6658,8 +6822,9 @@
Py_ssize_t endinpos;
Py_ssize_t outpos;
const char *e;
- PyObject *errorHandler = NULL;
+ PyObject *error_handler_obj = NULL;
PyObject *exc = NULL;
+ _Py_error_handler error_handler = _Py_ERROR_UNKNOWN;
if (size == 0)
_Py_RETURN_UNICODE_EMPTY();
@@ -6688,12 +6853,42 @@
PyUnicode_WRITE(kind, data, writer.pos, c);
writer.pos++;
++s;
+ continue;
}
- else {
+
+ /* byte outsize range 0x00..0x7f: call the error handler */
+
+ if (error_handler == _Py_ERROR_UNKNOWN)
+ error_handler = get_error_handler(errors);
+
+ switch (error_handler)
+ {
+ case _Py_ERROR_REPLACE:
+ case _Py_ERROR_SURROGATEESCAPE:
+ /* Fast-path: the error handler only writes one character,
+ but we may switch to UCS2 at the first write */
+ if (_PyUnicodeWriter_PrepareKind(&writer, PyUnicode_2BYTE_KIND) < 0)
+ goto onError;
+ kind = writer.kind;
+ data = writer.data;
+
+ if (error_handler == _Py_ERROR_REPLACE)
+ PyUnicode_WRITE(kind, data, writer.pos, 0xfffd);
+ else
+ PyUnicode_WRITE(kind, data, writer.pos, c + 0xdc00);
+ writer.pos++;
+ ++s;
+ break;
+
+ case _Py_ERROR_IGNORE:
+ ++s;
+ break;
+
+ default:
startinpos = s-starts;
endinpos = startinpos + 1;
if (unicode_decode_call_errorhandler_writer(
- errors, &errorHandler,
+ errors, &error_handler_obj,
"ascii", "ordinal not in range(128)",
&starts, &e, &startinpos, &endinpos, &exc, &s,
&writer))
@@ -6702,13 +6897,13 @@
data = writer.data;
}
}
- Py_XDECREF(errorHandler);
+ Py_XDECREF(error_handler_obj);
Py_XDECREF(exc);
return _PyUnicodeWriter_Finish(&writer);
onError:
_PyUnicodeWriter_Dealloc(&writer);
- Py_XDECREF(errorHandler);
+ Py_XDECREF(error_handler_obj);
Py_XDECREF(exc);
return NULL;
}
@@ -8074,7 +8269,7 @@
charmap_encoding_error(
PyObject *unicode, Py_ssize_t *inpos, PyObject *mapping,
PyObject **exceptionObject,
- int *known_errorHandler, PyObject **errorHandler, const char *errors,
+ _Py_error_handler *error_handler, PyObject **error_handler_obj, const char *errors,
PyObject **res, Py_ssize_t *respos)
{
PyObject *repunicode = NULL; /* initialize to prevent gcc warning */
@@ -8121,23 +8316,15 @@
}
/* cache callback name lookup
* (if not done yet, i.e. it's the first error) */
- if (*known_errorHandler==-1) {
- if ((errors==NULL) || (!strcmp(errors, "strict")))
- *known_errorHandler = 1;
- else if (!strcmp(errors, "replace"))
- *known_errorHandler = 2;
- else if (!strcmp(errors, "ignore"))
- *known_errorHandler = 3;
- else if (!strcmp(errors, "xmlcharrefreplace"))
- *known_errorHandler = 4;
- else
- *known_errorHandler = 0;
- }
- switch (*known_errorHandler) {
- case 1: /* strict */
+ if (*error_handler == _Py_ERROR_UNKNOWN)
+ *error_handler = get_error_handler(errors);
+
+ switch (*error_handler) {
+ case _Py_ERROR_STRICT:
raise_encode_exception(exceptionObject, encoding, unicode, collstartpos, collendpos, reason);
return -1;
- case 2: /* replace */
+
+ case _Py_ERROR_REPLACE:
for (collpos = collstartpos; collpos<collendpos; ++collpos) {
x = charmapencode_output('?', mapping, res, respos);
if (x==enc_EXCEPTION) {
@@ -8149,10 +8336,11 @@
}
}
/* fall through */
- case 3: /* ignore */
+ case _Py_ERROR_IGNORE:
*inpos = collendpos;
break;
- case 4: /* xmlcharrefreplace */
+
+ case _Py_ERROR_XMLCHARREFREPLACE:
/* generate replacement (temporarily (mis)uses p) */
for (collpos = collstartpos; collpos < collendpos; ++collpos) {
char buffer[2+29+1+1];
@@ -8170,8 +8358,9 @@
}
*inpos = collendpos;
break;
+
default:
- repunicode = unicode_encode_call_errorhandler(errors, errorHandler,
+ repunicode = unicode_encode_call_errorhandler(errors, error_handler_obj,
encoding, reason, unicode, exceptionObject,
collstartpos, collendpos, &newpos);
if (repunicode == NULL)
@@ -8234,12 +8423,9 @@
Py_ssize_t size;
/* current output position */
Py_ssize_t respos = 0;
- PyObject *errorHandler = NULL;
+ PyObject *error_handler_obj = NULL;
PyObject *exc = NULL;
- /* the following variable is used for caching string comparisons
- * -1=not initialized, 0=unknown, 1=strict, 2=replace,
- * 3=ignore, 4=xmlcharrefreplace */
- int known_errorHandler = -1;
+ _Py_error_handler error_handler = _Py_ERROR_UNKNOWN;
void *data;
int kind;
@@ -8270,7 +8456,7 @@
if (x==enc_FAILED) { /* unencodable character */
if (charmap_encoding_error(unicode, &inpos, mapping,
&exc,
- &known_errorHandler, &errorHandler, errors,
+ &error_handler, &error_handler_obj, errors,
&res, &respos)) {
goto onError;
}
@@ -8286,13 +8472,13 @@
goto onError;
Py_XDECREF(exc);
- Py_XDECREF(errorHandler);
+ Py_XDECREF(error_handler_obj);
return res;
onError:
Py_XDECREF(res);
Py_XDECREF(exc);
- Py_XDECREF(errorHandler);
+ Py_XDECREF(error_handler_obj);
return NULL;
}
@@ -8618,7 +8804,7 @@
return res;
}
-PyObject *
+static PyObject *
_PyUnicode_TranslateCharmap(PyObject *input,
PyObject *mapping,
const char *errors)
@@ -10889,6 +11075,12 @@
}
int
+_PyUnicode_EQ(PyObject *aa, PyObject *bb)
+{
+ return unicode_eq(aa, bb);
+}
+
+int
PyUnicode_Contains(PyObject *container, PyObject *element)
{
PyObject *str, *sub;
@@ -13221,44 +13413,50 @@
Py_LOCAL_INLINE(void)
_PyUnicodeWriter_Update(_PyUnicodeWriter *writer)
{
- if (!writer->readonly)
+ writer->maxchar = PyUnicode_MAX_CHAR_VALUE(writer->buffer);
+ writer->data = PyUnicode_DATA(writer->buffer);
+
+ if (!writer->readonly) {
+ writer->kind = PyUnicode_KIND(writer->buffer);
writer->size = PyUnicode_GET_LENGTH(writer->buffer);
+ }
else {
+ /* use a value smaller than PyUnicode_1BYTE_KIND() so
+ _PyUnicodeWriter_PrepareKind() will copy the buffer. */
+ writer->kind = PyUnicode_WCHAR_KIND;
+ assert(writer->kind <= PyUnicode_1BYTE_KIND);
+
/* Copy-on-write mode: set buffer size to 0 so
* _PyUnicodeWriter_Prepare() will copy (and enlarge) the buffer on
* next write. */
writer->size = 0;
}
- writer->maxchar = PyUnicode_MAX_CHAR_VALUE(writer->buffer);
- writer->data = PyUnicode_DATA(writer->buffer);
- writer->kind = PyUnicode_KIND(writer->buffer);
}
void
_PyUnicodeWriter_Init(_PyUnicodeWriter *writer)
{
memset(writer, 0, sizeof(*writer));
-#ifdef Py_DEBUG
- writer->kind = 5; /* invalid kind */
-#endif
+
+ /* ASCII is the bare minimum */
writer->min_char = 127;
+
+ /* use a value smaller than PyUnicode_1BYTE_KIND() so
+ _PyUnicodeWriter_PrepareKind() will copy the buffer. */
+ writer->kind = PyUnicode_WCHAR_KIND;
+ assert(writer->kind <= PyUnicode_1BYTE_KIND);
}
int
_PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer,
Py_ssize_t length, Py_UCS4 maxchar)
{
-#ifdef MS_WINDOWS
- /* On Windows, overallocate by 50% is the best factor */
-# define OVERALLOCATE_FACTOR 2
-#else
- /* On Linux, overallocate by 25% is the best factor */
-# define OVERALLOCATE_FACTOR 4
-#endif
Py_ssize_t newlen;
PyObject *newbuffer;
- assert(length > 0);
+ /* ensure that the _PyUnicodeWriter_Prepare macro was used */
+ assert((maxchar > writer->maxchar && length >= 0)
+ || length > 0);
if (length > PY_SSIZE_T_MAX - writer->pos) {
PyErr_NoMemory();
@@ -13325,6 +13523,28 @@
#undef OVERALLOCATE_FACTOR
}
+int
+_PyUnicodeWriter_PrepareKindInternal(_PyUnicodeWriter *writer,
+ enum PyUnicode_Kind kind)
+{
+ Py_UCS4 maxchar;
+
+ /* ensure that the _PyUnicodeWriter_PrepareKind macro was used */
+ assert(writer->kind < kind);
+
+ switch (kind)
+ {
+ case PyUnicode_1BYTE_KIND: maxchar = 0xff; break;
+ case PyUnicode_2BYTE_KIND: maxchar = 0xffff; break;
+ case PyUnicode_4BYTE_KIND: maxchar = 0x10ffff; break;
+ default:
+ assert(0 && "invalid kind");
+ return -1;
+ }
+
+ return _PyUnicodeWriter_PrepareInternal(writer, 0, maxchar);
+}
+
Py_LOCAL_INLINE(int)
_PyUnicodeWriter_WriteCharInline(_PyUnicodeWriter *writer, Py_UCS4 ch)
{
diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
index 52d4100..d73ce79 100644
--- a/PC/msvcrtmodule.c
+++ b/PC/msvcrtmodule.c
@@ -541,7 +541,6 @@
#endif
/* constants for the crt versions */
- (void)st;
#ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN
st = PyModule_AddStringConstant(m, "VC_ASSEMBLY_PUBLICKEYTOKEN",
_VC_ASSEMBLY_PUBLICKEYTOKEN);
@@ -567,6 +566,8 @@
st = PyModule_AddObject(m, "CRT_ASSEMBLY_VERSION", version);
if (st < 0) return NULL;
#endif
+ /* make compiler warning quiet if st is unused */
+ (void)st;
return m;
}
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
index d44173a..8861148 100644
--- a/PC/pyconfig.h
+++ b/PC/pyconfig.h
@@ -312,11 +312,11 @@
their Makefile (other compilers are generally
taken care of by distutils.) */
# if defined(_DEBUG)
-# pragma comment(lib,"python35_d.lib")
+# pragma comment(lib,"python36_d.lib")
# elif defined(Py_LIMITED_API)
# pragma comment(lib,"python3.lib")
# else
-# pragma comment(lib,"python35.lib")
+# pragma comment(lib,"python36.lib")
# endif /* _DEBUG */
# endif /* _MSC_VER */
# endif /* Py_BUILD_CORE */
diff --git a/PC/python3.def b/PC/python3.def
index 88c0742..e146e8f 100644
--- a/PC/python3.def
+++ b/PC/python3.def
@@ -2,712 +2,712 @@
; It is used when building python3dll.vcxproj
LIBRARY "python3"
EXPORTS
- PyArg_Parse=python35.PyArg_Parse
- PyArg_ParseTuple=python35.PyArg_ParseTuple
- PyArg_ParseTupleAndKeywords=python35.PyArg_ParseTupleAndKeywords
- PyArg_UnpackTuple=python35.PyArg_UnpackTuple
- PyArg_VaParse=python35.PyArg_VaParse
- PyArg_VaParseTupleAndKeywords=python35.PyArg_VaParseTupleAndKeywords
- PyArg_ValidateKeywordArguments=python35.PyArg_ValidateKeywordArguments
- PyBaseObject_Type=python35.PyBaseObject_Type DATA
- PyBool_FromLong=python35.PyBool_FromLong
- PyBool_Type=python35.PyBool_Type DATA
- PyByteArrayIter_Type=python35.PyByteArrayIter_Type DATA
- PyByteArray_AsString=python35.PyByteArray_AsString
- PyByteArray_Concat=python35.PyByteArray_Concat
- PyByteArray_FromObject=python35.PyByteArray_FromObject
- PyByteArray_FromStringAndSize=python35.PyByteArray_FromStringAndSize
- PyByteArray_Resize=python35.PyByteArray_Resize
- PyByteArray_Size=python35.PyByteArray_Size
- PyByteArray_Type=python35.PyByteArray_Type DATA
- PyBytesIter_Type=python35.PyBytesIter_Type DATA
- PyBytes_AsString=python35.PyBytes_AsString
- PyBytes_AsStringAndSize=python35.PyBytes_AsStringAndSize
- PyBytes_Concat=python35.PyBytes_Concat
- PyBytes_ConcatAndDel=python35.PyBytes_ConcatAndDel
- PyBytes_DecodeEscape=python35.PyBytes_DecodeEscape
- PyBytes_FromFormat=python35.PyBytes_FromFormat
- PyBytes_FromFormatV=python35.PyBytes_FromFormatV
- PyBytes_FromObject=python35.PyBytes_FromObject
- PyBytes_FromString=python35.PyBytes_FromString
- PyBytes_FromStringAndSize=python35.PyBytes_FromStringAndSize
- PyBytes_Repr=python35.PyBytes_Repr
- PyBytes_Size=python35.PyBytes_Size
- PyBytes_Type=python35.PyBytes_Type DATA
- PyCFunction_Call=python35.PyCFunction_Call
- PyCFunction_ClearFreeList=python35.PyCFunction_ClearFreeList
- PyCFunction_GetFlags=python35.PyCFunction_GetFlags
- PyCFunction_GetFunction=python35.PyCFunction_GetFunction
- PyCFunction_GetSelf=python35.PyCFunction_GetSelf
- PyCFunction_New=python35.PyCFunction_New
- PyCFunction_NewEx=python35.PyCFunction_NewEx
- PyCFunction_Type=python35.PyCFunction_Type DATA
- PyCallIter_New=python35.PyCallIter_New
- PyCallIter_Type=python35.PyCallIter_Type DATA
- PyCallable_Check=python35.PyCallable_Check
- PyCapsule_GetContext=python35.PyCapsule_GetContext
- PyCapsule_GetDestructor=python35.PyCapsule_GetDestructor
- PyCapsule_GetName=python35.PyCapsule_GetName
- PyCapsule_GetPointer=python35.PyCapsule_GetPointer
- PyCapsule_Import=python35.PyCapsule_Import
- PyCapsule_IsValid=python35.PyCapsule_IsValid
- PyCapsule_New=python35.PyCapsule_New
- PyCapsule_SetContext=python35.PyCapsule_SetContext
- PyCapsule_SetDestructor=python35.PyCapsule_SetDestructor
- PyCapsule_SetName=python35.PyCapsule_SetName
- PyCapsule_SetPointer=python35.PyCapsule_SetPointer
- PyCapsule_Type=python35.PyCapsule_Type DATA
- PyClassMethodDescr_Type=python35.PyClassMethodDescr_Type DATA
- PyCodec_BackslashReplaceErrors=python35.PyCodec_BackslashReplaceErrors
- PyCodec_Decode=python35.PyCodec_Decode
- PyCodec_Decoder=python35.PyCodec_Decoder
- PyCodec_Encode=python35.PyCodec_Encode
- PyCodec_Encoder=python35.PyCodec_Encoder
- PyCodec_IgnoreErrors=python35.PyCodec_IgnoreErrors
- PyCodec_IncrementalDecoder=python35.PyCodec_IncrementalDecoder
- PyCodec_IncrementalEncoder=python35.PyCodec_IncrementalEncoder
- PyCodec_KnownEncoding=python35.PyCodec_KnownEncoding
- PyCodec_LookupError=python35.PyCodec_LookupError
- PyCodec_Register=python35.PyCodec_Register
- PyCodec_RegisterError=python35.PyCodec_RegisterError
- PyCodec_ReplaceErrors=python35.PyCodec_ReplaceErrors
- PyCodec_StreamReader=python35.PyCodec_StreamReader
- PyCodec_StreamWriter=python35.PyCodec_StreamWriter
- PyCodec_StrictErrors=python35.PyCodec_StrictErrors
- PyCodec_XMLCharRefReplaceErrors=python35.PyCodec_XMLCharRefReplaceErrors
- PyComplex_FromDoubles=python35.PyComplex_FromDoubles
- PyComplex_ImagAsDouble=python35.PyComplex_ImagAsDouble
- PyComplex_RealAsDouble=python35.PyComplex_RealAsDouble
- PyComplex_Type=python35.PyComplex_Type DATA
- PyDescr_NewClassMethod=python35.PyDescr_NewClassMethod
- PyDescr_NewGetSet=python35.PyDescr_NewGetSet
- PyDescr_NewMember=python35.PyDescr_NewMember
- PyDescr_NewMethod=python35.PyDescr_NewMethod
- PyDictItems_Type=python35.PyDictItems_Type DATA
- PyDictIterItem_Type=python35.PyDictIterItem_Type DATA
- PyDictIterKey_Type=python35.PyDictIterKey_Type DATA
- PyDictIterValue_Type=python35.PyDictIterValue_Type DATA
- PyDictKeys_Type=python35.PyDictKeys_Type DATA
- PyDictProxy_New=python35.PyDictProxy_New
- PyDictProxy_Type=python35.PyDictProxy_Type DATA
- PyDictValues_Type=python35.PyDictValues_Type DATA
- PyDict_Clear=python35.PyDict_Clear
- PyDict_Contains=python35.PyDict_Contains
- PyDict_Copy=python35.PyDict_Copy
- PyDict_DelItem=python35.PyDict_DelItem
- PyDict_DelItemString=python35.PyDict_DelItemString
- PyDict_GetItem=python35.PyDict_GetItem
- PyDict_GetItemString=python35.PyDict_GetItemString
- PyDict_GetItemWithError=python35.PyDict_GetItemWithError
- PyDict_Items=python35.PyDict_Items
- PyDict_Keys=python35.PyDict_Keys
- PyDict_Merge=python35.PyDict_Merge
- PyDict_MergeFromSeq2=python35.PyDict_MergeFromSeq2
- PyDict_New=python35.PyDict_New
- PyDict_Next=python35.PyDict_Next
- PyDict_SetItem=python35.PyDict_SetItem
- PyDict_SetItemString=python35.PyDict_SetItemString
- PyDict_Size=python35.PyDict_Size
- PyDict_Type=python35.PyDict_Type DATA
- PyDict_Update=python35.PyDict_Update
- PyDict_Values=python35.PyDict_Values
- PyEllipsis_Type=python35.PyEllipsis_Type DATA
- PyEnum_Type=python35.PyEnum_Type DATA
- PyErr_BadArgument=python35.PyErr_BadArgument
- PyErr_BadInternalCall=python35.PyErr_BadInternalCall
- PyErr_CheckSignals=python35.PyErr_CheckSignals
- PyErr_Clear=python35.PyErr_Clear
- PyErr_Display=python35.PyErr_Display
- PyErr_ExceptionMatches=python35.PyErr_ExceptionMatches
- PyErr_Fetch=python35.PyErr_Fetch
- PyErr_Format=python35.PyErr_Format
- PyErr_FormatV=python35.PyErr_FormatV
- PyErr_GivenExceptionMatches=python35.PyErr_GivenExceptionMatches
- PyErr_NewException=python35.PyErr_NewException
- PyErr_NewExceptionWithDoc=python35.PyErr_NewExceptionWithDoc
- PyErr_NoMemory=python35.PyErr_NoMemory
- PyErr_NormalizeException=python35.PyErr_NormalizeException
- PyErr_Occurred=python35.PyErr_Occurred
- PyErr_Print=python35.PyErr_Print
- PyErr_PrintEx=python35.PyErr_PrintEx
- PyErr_ProgramText=python35.PyErr_ProgramText
- PyErr_Restore=python35.PyErr_Restore
- PyErr_SetFromErrno=python35.PyErr_SetFromErrno
- PyErr_SetFromErrnoWithFilename=python35.PyErr_SetFromErrnoWithFilename
- PyErr_SetFromErrnoWithFilenameObject=python35.PyErr_SetFromErrnoWithFilenameObject
- PyErr_SetInterrupt=python35.PyErr_SetInterrupt
- PyErr_SetNone=python35.PyErr_SetNone
- PyErr_SetObject=python35.PyErr_SetObject
- PyErr_SetString=python35.PyErr_SetString
- PyErr_SyntaxLocation=python35.PyErr_SyntaxLocation
- PyErr_WarnEx=python35.PyErr_WarnEx
- PyErr_WarnExplicit=python35.PyErr_WarnExplicit
- PyErr_WarnFormat=python35.PyErr_WarnFormat
- PyErr_WriteUnraisable=python35.PyErr_WriteUnraisable
- PyEval_AcquireLock=python35.PyEval_AcquireLock
- PyEval_AcquireThread=python35.PyEval_AcquireThread
- PyEval_CallFunction=python35.PyEval_CallFunction
- PyEval_CallMethod=python35.PyEval_CallMethod
- PyEval_CallObjectWithKeywords=python35.PyEval_CallObjectWithKeywords
- PyEval_EvalCode=python35.PyEval_EvalCode
- PyEval_EvalCodeEx=python35.PyEval_EvalCodeEx
- PyEval_EvalFrame=python35.PyEval_EvalFrame
- PyEval_EvalFrameEx=python35.PyEval_EvalFrameEx
- PyEval_GetBuiltins=python35.PyEval_GetBuiltins
- PyEval_GetCallStats=python35.PyEval_GetCallStats
- PyEval_GetFrame=python35.PyEval_GetFrame
- PyEval_GetFuncDesc=python35.PyEval_GetFuncDesc
- PyEval_GetFuncName=python35.PyEval_GetFuncName
- PyEval_GetGlobals=python35.PyEval_GetGlobals
- PyEval_GetLocals=python35.PyEval_GetLocals
- PyEval_InitThreads=python35.PyEval_InitThreads
- PyEval_ReInitThreads=python35.PyEval_ReInitThreads
- PyEval_ReleaseLock=python35.PyEval_ReleaseLock
- PyEval_ReleaseThread=python35.PyEval_ReleaseThread
- PyEval_RestoreThread=python35.PyEval_RestoreThread
- PyEval_SaveThread=python35.PyEval_SaveThread
- PyEval_ThreadsInitialized=python35.PyEval_ThreadsInitialized
- PyExc_ArithmeticError=python35.PyExc_ArithmeticError DATA
- PyExc_AssertionError=python35.PyExc_AssertionError DATA
- PyExc_AttributeError=python35.PyExc_AttributeError DATA
- PyExc_BaseException=python35.PyExc_BaseException DATA
- PyExc_BufferError=python35.PyExc_BufferError DATA
- PyExc_BytesWarning=python35.PyExc_BytesWarning DATA
- PyExc_DeprecationWarning=python35.PyExc_DeprecationWarning DATA
- PyExc_EOFError=python35.PyExc_EOFError DATA
- PyExc_EnvironmentError=python35.PyExc_EnvironmentError DATA
- PyExc_Exception=python35.PyExc_Exception DATA
- PyExc_FloatingPointError=python35.PyExc_FloatingPointError DATA
- PyExc_FutureWarning=python35.PyExc_FutureWarning DATA
- PyExc_GeneratorExit=python35.PyExc_GeneratorExit DATA
- PyExc_IOError=python35.PyExc_IOError DATA
- PyExc_ImportError=python35.PyExc_ImportError DATA
- PyExc_ImportWarning=python35.PyExc_ImportWarning DATA
- PyExc_IndentationError=python35.PyExc_IndentationError DATA
- PyExc_IndexError=python35.PyExc_IndexError DATA
- PyExc_KeyError=python35.PyExc_KeyError DATA
- PyExc_KeyboardInterrupt=python35.PyExc_KeyboardInterrupt DATA
- PyExc_LookupError=python35.PyExc_LookupError DATA
- PyExc_MemoryError=python35.PyExc_MemoryError DATA
- PyExc_MemoryErrorInst=python35.PyExc_MemoryErrorInst DATA
- PyExc_NameError=python35.PyExc_NameError DATA
- PyExc_NotImplementedError=python35.PyExc_NotImplementedError DATA
- PyExc_OSError=python35.PyExc_OSError DATA
- PyExc_OverflowError=python35.PyExc_OverflowError DATA
- PyExc_PendingDeprecationWarning=python35.PyExc_PendingDeprecationWarning DATA
- PyExc_RecursionErrorInst=python35.PyExc_RecursionErrorInst DATA
- PyExc_ReferenceError=python35.PyExc_ReferenceError DATA
- PyExc_RuntimeError=python35.PyExc_RuntimeError DATA
- PyExc_RuntimeWarning=python35.PyExc_RuntimeWarning DATA
- PyExc_StopIteration=python35.PyExc_StopIteration DATA
- PyExc_SyntaxError=python35.PyExc_SyntaxError DATA
- PyExc_SyntaxWarning=python35.PyExc_SyntaxWarning DATA
- PyExc_SystemError=python35.PyExc_SystemError DATA
- PyExc_SystemExit=python35.PyExc_SystemExit DATA
- PyExc_TabError=python35.PyExc_TabError DATA
- PyExc_TypeError=python35.PyExc_TypeError DATA
- PyExc_UnboundLocalError=python35.PyExc_UnboundLocalError DATA
- PyExc_UnicodeDecodeError=python35.PyExc_UnicodeDecodeError DATA
- PyExc_UnicodeEncodeError=python35.PyExc_UnicodeEncodeError DATA
- PyExc_UnicodeError=python35.PyExc_UnicodeError DATA
- PyExc_UnicodeTranslateError=python35.PyExc_UnicodeTranslateError DATA
- PyExc_UnicodeWarning=python35.PyExc_UnicodeWarning DATA
- PyExc_UserWarning=python35.PyExc_UserWarning DATA
- PyExc_ValueError=python35.PyExc_ValueError DATA
- PyExc_Warning=python35.PyExc_Warning DATA
- PyExc_ZeroDivisionError=python35.PyExc_ZeroDivisionError DATA
- PyException_GetCause=python35.PyException_GetCause
- PyException_GetContext=python35.PyException_GetContext
- PyException_GetTraceback=python35.PyException_GetTraceback
- PyException_SetCause=python35.PyException_SetCause
- PyException_SetContext=python35.PyException_SetContext
- PyException_SetTraceback=python35.PyException_SetTraceback
- PyFile_FromFd=python35.PyFile_FromFd
- PyFile_GetLine=python35.PyFile_GetLine
- PyFile_WriteObject=python35.PyFile_WriteObject
- PyFile_WriteString=python35.PyFile_WriteString
- PyFilter_Type=python35.PyFilter_Type DATA
- PyFloat_AsDouble=python35.PyFloat_AsDouble
- PyFloat_FromDouble=python35.PyFloat_FromDouble
- PyFloat_FromString=python35.PyFloat_FromString
- PyFloat_GetInfo=python35.PyFloat_GetInfo
- PyFloat_GetMax=python35.PyFloat_GetMax
- PyFloat_GetMin=python35.PyFloat_GetMin
- PyFloat_Type=python35.PyFloat_Type DATA
- PyFrozenSet_New=python35.PyFrozenSet_New
- PyFrozenSet_Type=python35.PyFrozenSet_Type DATA
- PyGC_Collect=python35.PyGC_Collect
- PyGILState_Ensure=python35.PyGILState_Ensure
- PyGILState_GetThisThreadState=python35.PyGILState_GetThisThreadState
- PyGILState_Release=python35.PyGILState_Release
- PyGetSetDescr_Type=python35.PyGetSetDescr_Type DATA
- PyImport_AddModule=python35.PyImport_AddModule
- PyImport_AppendInittab=python35.PyImport_AppendInittab
- PyImport_Cleanup=python35.PyImport_Cleanup
- PyImport_ExecCodeModule=python35.PyImport_ExecCodeModule
- PyImport_ExecCodeModuleEx=python35.PyImport_ExecCodeModuleEx
- PyImport_ExecCodeModuleWithPathnames=python35.PyImport_ExecCodeModuleWithPathnames
- PyImport_GetImporter=python35.PyImport_GetImporter
- PyImport_GetMagicNumber=python35.PyImport_GetMagicNumber
- PyImport_GetMagicTag=python35.PyImport_GetMagicTag
- PyImport_GetModuleDict=python35.PyImport_GetModuleDict
- PyImport_Import=python35.PyImport_Import
- PyImport_ImportFrozenModule=python35.PyImport_ImportFrozenModule
- PyImport_ImportModule=python35.PyImport_ImportModule
- PyImport_ImportModuleLevel=python35.PyImport_ImportModuleLevel
- PyImport_ImportModuleNoBlock=python35.PyImport_ImportModuleNoBlock
- PyImport_ReloadModule=python35.PyImport_ReloadModule
- PyInterpreterState_Clear=python35.PyInterpreterState_Clear
- PyInterpreterState_Delete=python35.PyInterpreterState_Delete
- PyInterpreterState_New=python35.PyInterpreterState_New
- PyIter_Next=python35.PyIter_Next
- PyListIter_Type=python35.PyListIter_Type DATA
- PyListRevIter_Type=python35.PyListRevIter_Type DATA
- PyList_Append=python35.PyList_Append
- PyList_AsTuple=python35.PyList_AsTuple
- PyList_GetItem=python35.PyList_GetItem
- PyList_GetSlice=python35.PyList_GetSlice
- PyList_Insert=python35.PyList_Insert
- PyList_New=python35.PyList_New
- PyList_Reverse=python35.PyList_Reverse
- PyList_SetItem=python35.PyList_SetItem
- PyList_SetSlice=python35.PyList_SetSlice
- PyList_Size=python35.PyList_Size
- PyList_Sort=python35.PyList_Sort
- PyList_Type=python35.PyList_Type DATA
- PyLongRangeIter_Type=python35.PyLongRangeIter_Type DATA
- PyLong_AsDouble=python35.PyLong_AsDouble
- PyLong_AsLong=python35.PyLong_AsLong
- PyLong_AsLongAndOverflow=python35.PyLong_AsLongAndOverflow
- PyLong_AsLongLong=python35.PyLong_AsLongLong
- PyLong_AsLongLongAndOverflow=python35.PyLong_AsLongLongAndOverflow
- PyLong_AsSize_t=python35.PyLong_AsSize_t
- PyLong_AsSsize_t=python35.PyLong_AsSsize_t
- PyLong_AsUnsignedLong=python35.PyLong_AsUnsignedLong
- PyLong_AsUnsignedLongLong=python35.PyLong_AsUnsignedLongLong
- PyLong_AsUnsignedLongLongMask=python35.PyLong_AsUnsignedLongLongMask
- PyLong_AsUnsignedLongMask=python35.PyLong_AsUnsignedLongMask
- PyLong_AsVoidPtr=python35.PyLong_AsVoidPtr
- PyLong_FromDouble=python35.PyLong_FromDouble
- PyLong_FromLong=python35.PyLong_FromLong
- PyLong_FromLongLong=python35.PyLong_FromLongLong
- PyLong_FromSize_t=python35.PyLong_FromSize_t
- PyLong_FromSsize_t=python35.PyLong_FromSsize_t
- PyLong_FromString=python35.PyLong_FromString
- PyLong_FromUnsignedLong=python35.PyLong_FromUnsignedLong
- PyLong_FromUnsignedLongLong=python35.PyLong_FromUnsignedLongLong
- PyLong_FromVoidPtr=python35.PyLong_FromVoidPtr
- PyLong_GetInfo=python35.PyLong_GetInfo
- PyLong_Type=python35.PyLong_Type DATA
- PyMap_Type=python35.PyMap_Type DATA
- PyMapping_Check=python35.PyMapping_Check
- PyMapping_GetItemString=python35.PyMapping_GetItemString
- PyMapping_HasKey=python35.PyMapping_HasKey
- PyMapping_HasKeyString=python35.PyMapping_HasKeyString
- PyMapping_Items=python35.PyMapping_Items
- PyMapping_Keys=python35.PyMapping_Keys
- PyMapping_Length=python35.PyMapping_Length
- PyMapping_SetItemString=python35.PyMapping_SetItemString
- PyMapping_Size=python35.PyMapping_Size
- PyMapping_Values=python35.PyMapping_Values
- PyMem_Free=python35.PyMem_Free
- PyMem_Malloc=python35.PyMem_Malloc
- PyMem_Realloc=python35.PyMem_Realloc
- PyMemberDescr_Type=python35.PyMemberDescr_Type DATA
- PyMemoryView_FromObject=python35.PyMemoryView_FromObject
- PyMemoryView_GetContiguous=python35.PyMemoryView_GetContiguous
- PyMemoryView_Type=python35.PyMemoryView_Type DATA
- PyMethodDescr_Type=python35.PyMethodDescr_Type DATA
- PyModule_AddIntConstant=python35.PyModule_AddIntConstant
- PyModule_AddObject=python35.PyModule_AddObject
- PyModule_AddStringConstant=python35.PyModule_AddStringConstant
- PyModule_Create2=python35.PyModule_Create2
- PyModule_GetDef=python35.PyModule_GetDef
- PyModule_GetDict=python35.PyModule_GetDict
- PyModule_GetFilename=python35.PyModule_GetFilename
- PyModule_GetFilenameObject=python35.PyModule_GetFilenameObject
- PyModule_GetName=python35.PyModule_GetName
- PyModule_GetState=python35.PyModule_GetState
- PyModule_New=python35.PyModule_New
- PyModule_Type=python35.PyModule_Type DATA
- PyModuleDef_Init=python35.PyModuleDef_Init
- PyModuleDef_Type=python35.PyModuleDef_Type DATA
- PyNullImporter_Type=python35.PyNullImporter_Type DATA
- PyNumber_Absolute=python35.PyNumber_Absolute
- PyNumber_Add=python35.PyNumber_Add
- PyNumber_And=python35.PyNumber_And
- PyNumber_AsSsize_t=python35.PyNumber_AsSsize_t
- PyNumber_Check=python35.PyNumber_Check
- PyNumber_Divmod=python35.PyNumber_Divmod
- PyNumber_Float=python35.PyNumber_Float
- PyNumber_FloorDivide=python35.PyNumber_FloorDivide
- PyNumber_InPlaceAdd=python35.PyNumber_InPlaceAdd
- PyNumber_InPlaceAnd=python35.PyNumber_InPlaceAnd
- PyNumber_InPlaceFloorDivide=python35.PyNumber_InPlaceFloorDivide
- PyNumber_InPlaceLshift=python35.PyNumber_InPlaceLshift
- PyNumber_InPlaceMultiply=python35.PyNumber_InPlaceMultiply
- PyNumber_InPlaceOr=python35.PyNumber_InPlaceOr
- PyNumber_InPlacePower=python35.PyNumber_InPlacePower
- PyNumber_InPlaceRemainder=python35.PyNumber_InPlaceRemainder
- PyNumber_InPlaceRshift=python35.PyNumber_InPlaceRshift
- PyNumber_InPlaceSubtract=python35.PyNumber_InPlaceSubtract
- PyNumber_InPlaceTrueDivide=python35.PyNumber_InPlaceTrueDivide
- PyNumber_InPlaceXor=python35.PyNumber_InPlaceXor
- PyNumber_Index=python35.PyNumber_Index
- PyNumber_Invert=python35.PyNumber_Invert
- PyNumber_Long=python35.PyNumber_Long
- PyNumber_Lshift=python35.PyNumber_Lshift
- PyNumber_Multiply=python35.PyNumber_Multiply
- PyNumber_Negative=python35.PyNumber_Negative
- PyNumber_Or=python35.PyNumber_Or
- PyNumber_Positive=python35.PyNumber_Positive
- PyNumber_Power=python35.PyNumber_Power
- PyNumber_Remainder=python35.PyNumber_Remainder
- PyNumber_Rshift=python35.PyNumber_Rshift
- PyNumber_Subtract=python35.PyNumber_Subtract
- PyNumber_ToBase=python35.PyNumber_ToBase
- PyNumber_TrueDivide=python35.PyNumber_TrueDivide
- PyNumber_Xor=python35.PyNumber_Xor
- PyOS_AfterFork=python35.PyOS_AfterFork
- PyOS_InitInterrupts=python35.PyOS_InitInterrupts
- PyOS_InputHook=python35.PyOS_InputHook DATA
- PyOS_InterruptOccurred=python35.PyOS_InterruptOccurred
- PyOS_ReadlineFunctionPointer=python35.PyOS_ReadlineFunctionPointer DATA
- PyOS_double_to_string=python35.PyOS_double_to_string
- PyOS_getsig=python35.PyOS_getsig
- PyOS_mystricmp=python35.PyOS_mystricmp
- PyOS_mystrnicmp=python35.PyOS_mystrnicmp
- PyOS_setsig=python35.PyOS_setsig
- PyOS_snprintf=python35.PyOS_snprintf
- PyOS_string_to_double=python35.PyOS_string_to_double
- PyOS_strtol=python35.PyOS_strtol
- PyOS_strtoul=python35.PyOS_strtoul
- PyOS_vsnprintf=python35.PyOS_vsnprintf
- PyObject_ASCII=python35.PyObject_ASCII
- PyObject_AsCharBuffer=python35.PyObject_AsCharBuffer
- PyObject_AsFileDescriptor=python35.PyObject_AsFileDescriptor
- PyObject_AsReadBuffer=python35.PyObject_AsReadBuffer
- PyObject_AsWriteBuffer=python35.PyObject_AsWriteBuffer
- PyObject_Bytes=python35.PyObject_Bytes
- PyObject_Call=python35.PyObject_Call
- PyObject_CallFunction=python35.PyObject_CallFunction
- PyObject_CallFunctionObjArgs=python35.PyObject_CallFunctionObjArgs
- PyObject_CallMethod=python35.PyObject_CallMethod
- PyObject_CallMethodObjArgs=python35.PyObject_CallMethodObjArgs
- PyObject_CallObject=python35.PyObject_CallObject
- PyObject_CheckReadBuffer=python35.PyObject_CheckReadBuffer
- PyObject_ClearWeakRefs=python35.PyObject_ClearWeakRefs
- PyObject_DelItem=python35.PyObject_DelItem
- PyObject_DelItemString=python35.PyObject_DelItemString
- PyObject_Dir=python35.PyObject_Dir
- PyObject_Format=python35.PyObject_Format
- PyObject_Free=python35.PyObject_Free
- PyObject_GC_Del=python35.PyObject_GC_Del
- PyObject_GC_Track=python35.PyObject_GC_Track
- PyObject_GC_UnTrack=python35.PyObject_GC_UnTrack
- PyObject_GenericGetAttr=python35.PyObject_GenericGetAttr
- PyObject_GenericSetAttr=python35.PyObject_GenericSetAttr
- PyObject_GetAttr=python35.PyObject_GetAttr
- PyObject_GetAttrString=python35.PyObject_GetAttrString
- PyObject_GetItem=python35.PyObject_GetItem
- PyObject_GetIter=python35.PyObject_GetIter
- PyObject_HasAttr=python35.PyObject_HasAttr
- PyObject_HasAttrString=python35.PyObject_HasAttrString
- PyObject_Hash=python35.PyObject_Hash
- PyObject_HashNotImplemented=python35.PyObject_HashNotImplemented
- PyObject_Init=python35.PyObject_Init
- PyObject_InitVar=python35.PyObject_InitVar
- PyObject_IsInstance=python35.PyObject_IsInstance
- PyObject_IsSubclass=python35.PyObject_IsSubclass
- PyObject_IsTrue=python35.PyObject_IsTrue
- PyObject_Length=python35.PyObject_Length
- PyObject_Malloc=python35.PyObject_Malloc
- PyObject_Not=python35.PyObject_Not
- PyObject_Realloc=python35.PyObject_Realloc
- PyObject_Repr=python35.PyObject_Repr
- PyObject_RichCompare=python35.PyObject_RichCompare
- PyObject_RichCompareBool=python35.PyObject_RichCompareBool
- PyObject_SelfIter=python35.PyObject_SelfIter
- PyObject_SetAttr=python35.PyObject_SetAttr
- PyObject_SetAttrString=python35.PyObject_SetAttrString
- PyObject_SetItem=python35.PyObject_SetItem
- PyObject_Size=python35.PyObject_Size
- PyObject_Str=python35.PyObject_Str
- PyObject_Type=python35.PyObject_Type DATA
- PyODict_DelItem=python35.PyODict_DelItem
- PyODict_New=python35.PyODict_New
- PyODict_SetItem=python35.PyODict_SetItem
- PyODict_Type=python35.PyODict_Type DATA
- PyODictItems_Type=python35.PyODictItems_Type DATA
- PyODictIter_Type=python35.PyODictIter_Type DATA
- PyODictKeys_Type=python35.PyODictKeys_Type DATA
- PyODictValues_Type=python35.PyODictValues_Type DATA
- PyParser_SimpleParseFileFlags=python35.PyParser_SimpleParseFileFlags
- PyParser_SimpleParseStringFlags=python35.PyParser_SimpleParseStringFlags
- PyProperty_Type=python35.PyProperty_Type DATA
- PyRangeIter_Type=python35.PyRangeIter_Type DATA
- PyRange_Type=python35.PyRange_Type DATA
- PyReversed_Type=python35.PyReversed_Type DATA
- PySeqIter_New=python35.PySeqIter_New
- PySeqIter_Type=python35.PySeqIter_Type DATA
- PySequence_Check=python35.PySequence_Check
- PySequence_Concat=python35.PySequence_Concat
- PySequence_Contains=python35.PySequence_Contains
- PySequence_Count=python35.PySequence_Count
- PySequence_DelItem=python35.PySequence_DelItem
- PySequence_DelSlice=python35.PySequence_DelSlice
- PySequence_Fast=python35.PySequence_Fast
- PySequence_GetItem=python35.PySequence_GetItem
- PySequence_GetSlice=python35.PySequence_GetSlice
- PySequence_In=python35.PySequence_In
- PySequence_InPlaceConcat=python35.PySequence_InPlaceConcat
- PySequence_InPlaceRepeat=python35.PySequence_InPlaceRepeat
- PySequence_Index=python35.PySequence_Index
- PySequence_Length=python35.PySequence_Length
- PySequence_List=python35.PySequence_List
- PySequence_Repeat=python35.PySequence_Repeat
- PySequence_SetItem=python35.PySequence_SetItem
- PySequence_SetSlice=python35.PySequence_SetSlice
- PySequence_Size=python35.PySequence_Size
- PySequence_Tuple=python35.PySequence_Tuple
- PySetIter_Type=python35.PySetIter_Type DATA
- PySet_Add=python35.PySet_Add
- PySet_Clear=python35.PySet_Clear
- PySet_Contains=python35.PySet_Contains
- PySet_Discard=python35.PySet_Discard
- PySet_New=python35.PySet_New
- PySet_Pop=python35.PySet_Pop
- PySet_Size=python35.PySet_Size
- PySet_Type=python35.PySet_Type DATA
- PySlice_GetIndices=python35.PySlice_GetIndices
- PySlice_GetIndicesEx=python35.PySlice_GetIndicesEx
- PySlice_New=python35.PySlice_New
- PySlice_Type=python35.PySlice_Type DATA
- PySortWrapper_Type=python35.PySortWrapper_Type DATA
- PyState_FindModule=python35.PyState_FindModule
- PyState_AddModule=python35.PyState_AddModule
- PyState_RemoveModule=python35.PyState_RemoveModule
- PyStructSequence_GetItem=python35.PyStructSequence_GetItem
- PyStructSequence_New=python35.PyStructSequence_New
- PyStructSequence_NewType=python35.PyStructSequence_NewType
- PyStructSequence_SetItem=python35.PyStructSequence_SetItem
- PySuper_Type=python35.PySuper_Type DATA
- PySys_AddWarnOption=python35.PySys_AddWarnOption
- PySys_AddWarnOptionUnicode=python35.PySys_AddWarnOptionUnicode
- PySys_FormatStderr=python35.PySys_FormatStderr
- PySys_FormatStdout=python35.PySys_FormatStdout
- PySys_GetObject=python35.PySys_GetObject
- PySys_HasWarnOptions=python35.PySys_HasWarnOptions
- PySys_ResetWarnOptions=python35.PySys_ResetWarnOptions
- PySys_SetArgv=python35.PySys_SetArgv
- PySys_SetArgvEx=python35.PySys_SetArgvEx
- PySys_SetObject=python35.PySys_SetObject
- PySys_SetPath=python35.PySys_SetPath
- PySys_WriteStderr=python35.PySys_WriteStderr
- PySys_WriteStdout=python35.PySys_WriteStdout
- PyThreadState_Clear=python35.PyThreadState_Clear
- PyThreadState_Delete=python35.PyThreadState_Delete
- PyThreadState_DeleteCurrent=python35.PyThreadState_DeleteCurrent
- PyThreadState_Get=python35.PyThreadState_Get
- PyThreadState_GetDict=python35.PyThreadState_GetDict
- PyThreadState_New=python35.PyThreadState_New
- PyThreadState_SetAsyncExc=python35.PyThreadState_SetAsyncExc
- PyThreadState_Swap=python35.PyThreadState_Swap
- PyTraceBack_Here=python35.PyTraceBack_Here
- PyTraceBack_Print=python35.PyTraceBack_Print
- PyTraceBack_Type=python35.PyTraceBack_Type DATA
- PyTupleIter_Type=python35.PyTupleIter_Type DATA
- PyTuple_ClearFreeList=python35.PyTuple_ClearFreeList
- PyTuple_GetItem=python35.PyTuple_GetItem
- PyTuple_GetSlice=python35.PyTuple_GetSlice
- PyTuple_New=python35.PyTuple_New
- PyTuple_Pack=python35.PyTuple_Pack
- PyTuple_SetItem=python35.PyTuple_SetItem
- PyTuple_Size=python35.PyTuple_Size
- PyTuple_Type=python35.PyTuple_Type DATA
- PyType_ClearCache=python35.PyType_ClearCache
- PyType_FromSpec=python35.PyType_FromSpec
- PyType_FromSpecWithBases=python35.PyType_FromSpecWithBases
- PyType_GenericAlloc=python35.PyType_GenericAlloc
- PyType_GenericNew=python35.PyType_GenericNew
- PyType_GetFlags=python35.PyType_GetFlags
- PyType_GetSlot=python35.PyType_GetSlot
- PyType_IsSubtype=python35.PyType_IsSubtype
- PyType_Modified=python35.PyType_Modified
- PyType_Ready=python35.PyType_Ready
- PyType_Type=python35.PyType_Type DATA
- PyUnicodeDecodeError_Create=python35.PyUnicodeDecodeError_Create
- PyUnicodeDecodeError_GetEncoding=python35.PyUnicodeDecodeError_GetEncoding
- PyUnicodeDecodeError_GetEnd=python35.PyUnicodeDecodeError_GetEnd
- PyUnicodeDecodeError_GetObject=python35.PyUnicodeDecodeError_GetObject
- PyUnicodeDecodeError_GetReason=python35.PyUnicodeDecodeError_GetReason
- PyUnicodeDecodeError_GetStart=python35.PyUnicodeDecodeError_GetStart
- PyUnicodeDecodeError_SetEnd=python35.PyUnicodeDecodeError_SetEnd
- PyUnicodeDecodeError_SetReason=python35.PyUnicodeDecodeError_SetReason
- PyUnicodeDecodeError_SetStart=python35.PyUnicodeDecodeError_SetStart
- PyUnicodeEncodeError_GetEncoding=python35.PyUnicodeEncodeError_GetEncoding
- PyUnicodeEncodeError_GetEnd=python35.PyUnicodeEncodeError_GetEnd
- PyUnicodeEncodeError_GetObject=python35.PyUnicodeEncodeError_GetObject
- PyUnicodeEncodeError_GetReason=python35.PyUnicodeEncodeError_GetReason
- PyUnicodeEncodeError_GetStart=python35.PyUnicodeEncodeError_GetStart
- PyUnicodeEncodeError_SetEnd=python35.PyUnicodeEncodeError_SetEnd
- PyUnicodeEncodeError_SetReason=python35.PyUnicodeEncodeError_SetReason
- PyUnicodeEncodeError_SetStart=python35.PyUnicodeEncodeError_SetStart
- PyUnicodeIter_Type=python35.PyUnicodeIter_Type DATA
- PyUnicodeTranslateError_GetEnd=python35.PyUnicodeTranslateError_GetEnd
- PyUnicodeTranslateError_GetObject=python35.PyUnicodeTranslateError_GetObject
- PyUnicodeTranslateError_GetReason=python35.PyUnicodeTranslateError_GetReason
- PyUnicodeTranslateError_GetStart=python35.PyUnicodeTranslateError_GetStart
- PyUnicodeTranslateError_SetEnd=python35.PyUnicodeTranslateError_SetEnd
- PyUnicodeTranslateError_SetReason=python35.PyUnicodeTranslateError_SetReason
- PyUnicodeTranslateError_SetStart=python35.PyUnicodeTranslateError_SetStart
- PyUnicode_Append=python35.PyUnicode_Append
- PyUnicode_AppendAndDel=python35.PyUnicode_AppendAndDel
- PyUnicode_AsASCIIString=python35.PyUnicode_AsASCIIString
- PyUnicode_AsCharmapString=python35.PyUnicode_AsCharmapString
- PyUnicode_AsDecodedObject=python35.PyUnicode_AsDecodedObject
- PyUnicode_AsDecodedUnicode=python35.PyUnicode_AsDecodedUnicode
- PyUnicode_AsEncodedObject=python35.PyUnicode_AsEncodedObject
- PyUnicode_AsEncodedString=python35.PyUnicode_AsEncodedString
- PyUnicode_AsEncodedUnicode=python35.PyUnicode_AsEncodedUnicode
- PyUnicode_AsLatin1String=python35.PyUnicode_AsLatin1String
- PyUnicode_AsRawUnicodeEscapeString=python35.PyUnicode_AsRawUnicodeEscapeString
- PyUnicode_AsUTF16String=python35.PyUnicode_AsUTF16String
- PyUnicode_AsUTF32String=python35.PyUnicode_AsUTF32String
- PyUnicode_AsUTF8String=python35.PyUnicode_AsUTF8String
- PyUnicode_AsUnicodeEscapeString=python35.PyUnicode_AsUnicodeEscapeString
- PyUnicode_AsWideChar=python35.PyUnicode_AsWideChar
- PyUnicode_ClearFreelist=python35.PyUnicode_ClearFreelist
- PyUnicode_Compare=python35.PyUnicode_Compare
- PyUnicode_Concat=python35.PyUnicode_Concat
- PyUnicode_Contains=python35.PyUnicode_Contains
- PyUnicode_Count=python35.PyUnicode_Count
- PyUnicode_Decode=python35.PyUnicode_Decode
- PyUnicode_DecodeASCII=python35.PyUnicode_DecodeASCII
- PyUnicode_DecodeCharmap=python35.PyUnicode_DecodeCharmap
- PyUnicode_DecodeFSDefault=python35.PyUnicode_DecodeFSDefault
- PyUnicode_DecodeFSDefaultAndSize=python35.PyUnicode_DecodeFSDefaultAndSize
- PyUnicode_DecodeLatin1=python35.PyUnicode_DecodeLatin1
- PyUnicode_DecodeRawUnicodeEscape=python35.PyUnicode_DecodeRawUnicodeEscape
- PyUnicode_DecodeUTF16=python35.PyUnicode_DecodeUTF16
- PyUnicode_DecodeUTF16Stateful=python35.PyUnicode_DecodeUTF16Stateful
- PyUnicode_DecodeUTF32=python35.PyUnicode_DecodeUTF32
- PyUnicode_DecodeUTF32Stateful=python35.PyUnicode_DecodeUTF32Stateful
- PyUnicode_DecodeUTF8=python35.PyUnicode_DecodeUTF8
- PyUnicode_DecodeUTF8Stateful=python35.PyUnicode_DecodeUTF8Stateful
- PyUnicode_DecodeUnicodeEscape=python35.PyUnicode_DecodeUnicodeEscape
- PyUnicode_FSConverter=python35.PyUnicode_FSConverter
- PyUnicode_FSDecoder=python35.PyUnicode_FSDecoder
- PyUnicode_Find=python35.PyUnicode_Find
- PyUnicode_Format=python35.PyUnicode_Format
- PyUnicode_FromEncodedObject=python35.PyUnicode_FromEncodedObject
- PyUnicode_FromFormat=python35.PyUnicode_FromFormat
- PyUnicode_FromFormatV=python35.PyUnicode_FromFormatV
- PyUnicode_FromObject=python35.PyUnicode_FromObject
- PyUnicode_FromOrdinal=python35.PyUnicode_FromOrdinal
- PyUnicode_FromString=python35.PyUnicode_FromString
- PyUnicode_FromStringAndSize=python35.PyUnicode_FromStringAndSize
- PyUnicode_FromWideChar=python35.PyUnicode_FromWideChar
- PyUnicode_GetDefaultEncoding=python35.PyUnicode_GetDefaultEncoding
- PyUnicode_GetSize=python35.PyUnicode_GetSize
- PyUnicode_IsIdentifier=python35.PyUnicode_IsIdentifier
- PyUnicode_Join=python35.PyUnicode_Join
- PyUnicode_Partition=python35.PyUnicode_Partition
- PyUnicode_RPartition=python35.PyUnicode_RPartition
- PyUnicode_RSplit=python35.PyUnicode_RSplit
- PyUnicode_Replace=python35.PyUnicode_Replace
- PyUnicode_Resize=python35.PyUnicode_Resize
- PyUnicode_RichCompare=python35.PyUnicode_RichCompare
- PyUnicode_SetDefaultEncoding=python35.PyUnicode_SetDefaultEncoding
- PyUnicode_Split=python35.PyUnicode_Split
- PyUnicode_Splitlines=python35.PyUnicode_Splitlines
- PyUnicode_Tailmatch=python35.PyUnicode_Tailmatch
- PyUnicode_Translate=python35.PyUnicode_Translate
- PyUnicode_BuildEncodingMap=python35.PyUnicode_BuildEncodingMap
- PyUnicode_CompareWithASCIIString=python35.PyUnicode_CompareWithASCIIString
- PyUnicode_DecodeUTF7=python35.PyUnicode_DecodeUTF7
- PyUnicode_DecodeUTF7Stateful=python35.PyUnicode_DecodeUTF7Stateful
- PyUnicode_EncodeFSDefault=python35.PyUnicode_EncodeFSDefault
- PyUnicode_InternFromString=python35.PyUnicode_InternFromString
- PyUnicode_InternImmortal=python35.PyUnicode_InternImmortal
- PyUnicode_InternInPlace=python35.PyUnicode_InternInPlace
- PyUnicode_Type=python35.PyUnicode_Type DATA
- PyWeakref_GetObject=python35.PyWeakref_GetObject DATA
- PyWeakref_NewProxy=python35.PyWeakref_NewProxy
- PyWeakref_NewRef=python35.PyWeakref_NewRef
- PyWrapperDescr_Type=python35.PyWrapperDescr_Type DATA
- PyWrapper_New=python35.PyWrapper_New
- PyZip_Type=python35.PyZip_Type DATA
- Py_AddPendingCall=python35.Py_AddPendingCall
- Py_AtExit=python35.Py_AtExit
- Py_BuildValue=python35.Py_BuildValue
- Py_CompileString=python35.Py_CompileString
- Py_DecRef=python35.Py_DecRef
- Py_EndInterpreter=python35.Py_EndInterpreter
- Py_Exit=python35.Py_Exit
- Py_FatalError=python35.Py_FatalError
- Py_FileSystemDefaultEncoding=python35.Py_FileSystemDefaultEncoding DATA
- Py_Finalize=python35.Py_Finalize
- Py_GetBuildInfo=python35.Py_GetBuildInfo
- Py_GetCompiler=python35.Py_GetCompiler
- Py_GetCopyright=python35.Py_GetCopyright
- Py_GetExecPrefix=python35.Py_GetExecPrefix
- Py_GetPath=python35.Py_GetPath
- Py_GetPlatform=python35.Py_GetPlatform
- Py_GetPrefix=python35.Py_GetPrefix
- Py_GetProgramFullPath=python35.Py_GetProgramFullPath
- Py_GetProgramName=python35.Py_GetProgramName
- Py_GetPythonHome=python35.Py_GetPythonHome
- Py_GetRecursionLimit=python35.Py_GetRecursionLimit
- Py_GetVersion=python35.Py_GetVersion
- Py_HasFileSystemDefaultEncoding=python35.Py_HasFileSystemDefaultEncoding DATA
- Py_IncRef=python35.Py_IncRef
- Py_Initialize=python35.Py_Initialize
- Py_InitializeEx=python35.Py_InitializeEx
- Py_IsInitialized=python35.Py_IsInitialized
- Py_Main=python35.Py_Main
- Py_MakePendingCalls=python35.Py_MakePendingCalls
- Py_NewInterpreter=python35.Py_NewInterpreter
- Py_ReprEnter=python35.Py_ReprEnter
- Py_ReprLeave=python35.Py_ReprLeave
- Py_SetProgramName=python35.Py_SetProgramName
- Py_SetPythonHome=python35.Py_SetPythonHome
- Py_SetRecursionLimit=python35.Py_SetRecursionLimit
- Py_SymtableString=python35.Py_SymtableString
- Py_VaBuildValue=python35.Py_VaBuildValue
- _PyErr_BadInternalCall=python35._PyErr_BadInternalCall
- _PyObject_CallFunction_SizeT=python35._PyObject_CallFunction_SizeT
- _PyObject_CallMethod_SizeT=python35._PyObject_CallMethod_SizeT
- _PyObject_GC_Malloc=python35._PyObject_GC_Malloc
- _PyObject_GC_New=python35._PyObject_GC_New
- _PyObject_GC_NewVar=python35._PyObject_GC_NewVar
- _PyObject_GC_Resize=python35._PyObject_GC_Resize
- _PyObject_New=python35._PyObject_New
- _PyObject_NewVar=python35._PyObject_NewVar
- _PyState_AddModule=python35._PyState_AddModule
- _PyThreadState_Init=python35._PyThreadState_Init
- _PyThreadState_Prealloc=python35._PyThreadState_Prealloc
- _PyTrash_delete_later=python35._PyTrash_delete_later DATA
- _PyTrash_delete_nesting=python35._PyTrash_delete_nesting DATA
- _PyTrash_deposit_object=python35._PyTrash_deposit_object
- _PyTrash_destroy_chain=python35._PyTrash_destroy_chain
- _PyWeakref_CallableProxyType=python35._PyWeakref_CallableProxyType DATA
- _PyWeakref_ProxyType=python35._PyWeakref_ProxyType DATA
- _PyWeakref_RefType=python35._PyWeakref_RefType DATA
- _Py_BuildValue_SizeT=python35._Py_BuildValue_SizeT
- _Py_CheckRecursionLimit=python35._Py_CheckRecursionLimit DATA
- _Py_CheckRecursiveCall=python35._Py_CheckRecursiveCall
- _Py_Dealloc=python35._Py_Dealloc
- _Py_EllipsisObject=python35._Py_EllipsisObject DATA
- _Py_FalseStruct=python35._Py_FalseStruct DATA
- _Py_NoneStruct=python35._Py_NoneStruct DATA
- _Py_NotImplementedStruct=python35._Py_NotImplementedStruct DATA
- _Py_SwappedOp=python35._Py_SwappedOp DATA
- _Py_TrueStruct=python35._Py_TrueStruct DATA
- _Py_VaBuildValue_SizeT=python35._Py_VaBuildValue_SizeT
- _PyArg_Parse_SizeT=python35._PyArg_Parse_SizeT
- _PyArg_ParseTuple_SizeT=python35._PyArg_ParseTuple_SizeT
- _PyArg_ParseTupleAndKeywords_SizeT=python35._PyArg_ParseTupleAndKeywords_SizeT
- _PyArg_VaParse_SizeT=python35._PyArg_VaParse_SizeT
- _PyArg_VaParseTupleAndKeywords_SizeT=python35._PyArg_VaParseTupleAndKeywords_SizeT
- _Py_BuildValue_SizeT=python35._Py_BuildValue_SizeT
+ PyArg_Parse=python36.PyArg_Parse
+ PyArg_ParseTuple=python36.PyArg_ParseTuple
+ PyArg_ParseTupleAndKeywords=python36.PyArg_ParseTupleAndKeywords
+ PyArg_UnpackTuple=python36.PyArg_UnpackTuple
+ PyArg_VaParse=python36.PyArg_VaParse
+ PyArg_VaParseTupleAndKeywords=python36.PyArg_VaParseTupleAndKeywords
+ PyArg_ValidateKeywordArguments=python36.PyArg_ValidateKeywordArguments
+ PyBaseObject_Type=python36.PyBaseObject_Type DATA
+ PyBool_FromLong=python36.PyBool_FromLong
+ PyBool_Type=python36.PyBool_Type DATA
+ PyByteArrayIter_Type=python36.PyByteArrayIter_Type DATA
+ PyByteArray_AsString=python36.PyByteArray_AsString
+ PyByteArray_Concat=python36.PyByteArray_Concat
+ PyByteArray_FromObject=python36.PyByteArray_FromObject
+ PyByteArray_FromStringAndSize=python36.PyByteArray_FromStringAndSize
+ PyByteArray_Resize=python36.PyByteArray_Resize
+ PyByteArray_Size=python36.PyByteArray_Size
+ PyByteArray_Type=python36.PyByteArray_Type DATA
+ PyBytesIter_Type=python36.PyBytesIter_Type DATA
+ PyBytes_AsString=python36.PyBytes_AsString
+ PyBytes_AsStringAndSize=python36.PyBytes_AsStringAndSize
+ PyBytes_Concat=python36.PyBytes_Concat
+ PyBytes_ConcatAndDel=python36.PyBytes_ConcatAndDel
+ PyBytes_DecodeEscape=python36.PyBytes_DecodeEscape
+ PyBytes_FromFormat=python36.PyBytes_FromFormat
+ PyBytes_FromFormatV=python36.PyBytes_FromFormatV
+ PyBytes_FromObject=python36.PyBytes_FromObject
+ PyBytes_FromString=python36.PyBytes_FromString
+ PyBytes_FromStringAndSize=python36.PyBytes_FromStringAndSize
+ PyBytes_Repr=python36.PyBytes_Repr
+ PyBytes_Size=python36.PyBytes_Size
+ PyBytes_Type=python36.PyBytes_Type DATA
+ PyCFunction_Call=python36.PyCFunction_Call
+ PyCFunction_ClearFreeList=python36.PyCFunction_ClearFreeList
+ PyCFunction_GetFlags=python36.PyCFunction_GetFlags
+ PyCFunction_GetFunction=python36.PyCFunction_GetFunction
+ PyCFunction_GetSelf=python36.PyCFunction_GetSelf
+ PyCFunction_New=python36.PyCFunction_New
+ PyCFunction_NewEx=python36.PyCFunction_NewEx
+ PyCFunction_Type=python36.PyCFunction_Type DATA
+ PyCallIter_New=python36.PyCallIter_New
+ PyCallIter_Type=python36.PyCallIter_Type DATA
+ PyCallable_Check=python36.PyCallable_Check
+ PyCapsule_GetContext=python36.PyCapsule_GetContext
+ PyCapsule_GetDestructor=python36.PyCapsule_GetDestructor
+ PyCapsule_GetName=python36.PyCapsule_GetName
+ PyCapsule_GetPointer=python36.PyCapsule_GetPointer
+ PyCapsule_Import=python36.PyCapsule_Import
+ PyCapsule_IsValid=python36.PyCapsule_IsValid
+ PyCapsule_New=python36.PyCapsule_New
+ PyCapsule_SetContext=python36.PyCapsule_SetContext
+ PyCapsule_SetDestructor=python36.PyCapsule_SetDestructor
+ PyCapsule_SetName=python36.PyCapsule_SetName
+ PyCapsule_SetPointer=python36.PyCapsule_SetPointer
+ PyCapsule_Type=python36.PyCapsule_Type DATA
+ PyClassMethodDescr_Type=python36.PyClassMethodDescr_Type DATA
+ PyCodec_BackslashReplaceErrors=python36.PyCodec_BackslashReplaceErrors
+ PyCodec_Decode=python36.PyCodec_Decode
+ PyCodec_Decoder=python36.PyCodec_Decoder
+ PyCodec_Encode=python36.PyCodec_Encode
+ PyCodec_Encoder=python36.PyCodec_Encoder
+ PyCodec_IgnoreErrors=python36.PyCodec_IgnoreErrors
+ PyCodec_IncrementalDecoder=python36.PyCodec_IncrementalDecoder
+ PyCodec_IncrementalEncoder=python36.PyCodec_IncrementalEncoder
+ PyCodec_KnownEncoding=python36.PyCodec_KnownEncoding
+ PyCodec_LookupError=python36.PyCodec_LookupError
+ PyCodec_Register=python36.PyCodec_Register
+ PyCodec_RegisterError=python36.PyCodec_RegisterError
+ PyCodec_ReplaceErrors=python36.PyCodec_ReplaceErrors
+ PyCodec_StreamReader=python36.PyCodec_StreamReader
+ PyCodec_StreamWriter=python36.PyCodec_StreamWriter
+ PyCodec_StrictErrors=python36.PyCodec_StrictErrors
+ PyCodec_XMLCharRefReplaceErrors=python36.PyCodec_XMLCharRefReplaceErrors
+ PyComplex_FromDoubles=python36.PyComplex_FromDoubles
+ PyComplex_ImagAsDouble=python36.PyComplex_ImagAsDouble
+ PyComplex_RealAsDouble=python36.PyComplex_RealAsDouble
+ PyComplex_Type=python36.PyComplex_Type DATA
+ PyDescr_NewClassMethod=python36.PyDescr_NewClassMethod
+ PyDescr_NewGetSet=python36.PyDescr_NewGetSet
+ PyDescr_NewMember=python36.PyDescr_NewMember
+ PyDescr_NewMethod=python36.PyDescr_NewMethod
+ PyDictItems_Type=python36.PyDictItems_Type DATA
+ PyDictIterItem_Type=python36.PyDictIterItem_Type DATA
+ PyDictIterKey_Type=python36.PyDictIterKey_Type DATA
+ PyDictIterValue_Type=python36.PyDictIterValue_Type DATA
+ PyDictKeys_Type=python36.PyDictKeys_Type DATA
+ PyDictProxy_New=python36.PyDictProxy_New
+ PyDictProxy_Type=python36.PyDictProxy_Type DATA
+ PyDictValues_Type=python36.PyDictValues_Type DATA
+ PyDict_Clear=python36.PyDict_Clear
+ PyDict_Contains=python36.PyDict_Contains
+ PyDict_Copy=python36.PyDict_Copy
+ PyDict_DelItem=python36.PyDict_DelItem
+ PyDict_DelItemString=python36.PyDict_DelItemString
+ PyDict_GetItem=python36.PyDict_GetItem
+ PyDict_GetItemString=python36.PyDict_GetItemString
+ PyDict_GetItemWithError=python36.PyDict_GetItemWithError
+ PyDict_Items=python36.PyDict_Items
+ PyDict_Keys=python36.PyDict_Keys
+ PyDict_Merge=python36.PyDict_Merge
+ PyDict_MergeFromSeq2=python36.PyDict_MergeFromSeq2
+ PyDict_New=python36.PyDict_New
+ PyDict_Next=python36.PyDict_Next
+ PyDict_SetItem=python36.PyDict_SetItem
+ PyDict_SetItemString=python36.PyDict_SetItemString
+ PyDict_Size=python36.PyDict_Size
+ PyDict_Type=python36.PyDict_Type DATA
+ PyDict_Update=python36.PyDict_Update
+ PyDict_Values=python36.PyDict_Values
+ PyEllipsis_Type=python36.PyEllipsis_Type DATA
+ PyEnum_Type=python36.PyEnum_Type DATA
+ PyErr_BadArgument=python36.PyErr_BadArgument
+ PyErr_BadInternalCall=python36.PyErr_BadInternalCall
+ PyErr_CheckSignals=python36.PyErr_CheckSignals
+ PyErr_Clear=python36.PyErr_Clear
+ PyErr_Display=python36.PyErr_Display
+ PyErr_ExceptionMatches=python36.PyErr_ExceptionMatches
+ PyErr_Fetch=python36.PyErr_Fetch
+ PyErr_Format=python36.PyErr_Format
+ PyErr_FormatV=python36.PyErr_FormatV
+ PyErr_GivenExceptionMatches=python36.PyErr_GivenExceptionMatches
+ PyErr_NewException=python36.PyErr_NewException
+ PyErr_NewExceptionWithDoc=python36.PyErr_NewExceptionWithDoc
+ PyErr_NoMemory=python36.PyErr_NoMemory
+ PyErr_NormalizeException=python36.PyErr_NormalizeException
+ PyErr_Occurred=python36.PyErr_Occurred
+ PyErr_Print=python36.PyErr_Print
+ PyErr_PrintEx=python36.PyErr_PrintEx
+ PyErr_ProgramText=python36.PyErr_ProgramText
+ PyErr_Restore=python36.PyErr_Restore
+ PyErr_SetFromErrno=python36.PyErr_SetFromErrno
+ PyErr_SetFromErrnoWithFilename=python36.PyErr_SetFromErrnoWithFilename
+ PyErr_SetFromErrnoWithFilenameObject=python36.PyErr_SetFromErrnoWithFilenameObject
+ PyErr_SetInterrupt=python36.PyErr_SetInterrupt
+ PyErr_SetNone=python36.PyErr_SetNone
+ PyErr_SetObject=python36.PyErr_SetObject
+ PyErr_SetString=python36.PyErr_SetString
+ PyErr_SyntaxLocation=python36.PyErr_SyntaxLocation
+ PyErr_WarnEx=python36.PyErr_WarnEx
+ PyErr_WarnExplicit=python36.PyErr_WarnExplicit
+ PyErr_WarnFormat=python36.PyErr_WarnFormat
+ PyErr_WriteUnraisable=python36.PyErr_WriteUnraisable
+ PyEval_AcquireLock=python36.PyEval_AcquireLock
+ PyEval_AcquireThread=python36.PyEval_AcquireThread
+ PyEval_CallFunction=python36.PyEval_CallFunction
+ PyEval_CallMethod=python36.PyEval_CallMethod
+ PyEval_CallObjectWithKeywords=python36.PyEval_CallObjectWithKeywords
+ PyEval_EvalCode=python36.PyEval_EvalCode
+ PyEval_EvalCodeEx=python36.PyEval_EvalCodeEx
+ PyEval_EvalFrame=python36.PyEval_EvalFrame
+ PyEval_EvalFrameEx=python36.PyEval_EvalFrameEx
+ PyEval_GetBuiltins=python36.PyEval_GetBuiltins
+ PyEval_GetCallStats=python36.PyEval_GetCallStats
+ PyEval_GetFrame=python36.PyEval_GetFrame
+ PyEval_GetFuncDesc=python36.PyEval_GetFuncDesc
+ PyEval_GetFuncName=python36.PyEval_GetFuncName
+ PyEval_GetGlobals=python36.PyEval_GetGlobals
+ PyEval_GetLocals=python36.PyEval_GetLocals
+ PyEval_InitThreads=python36.PyEval_InitThreads
+ PyEval_ReInitThreads=python36.PyEval_ReInitThreads
+ PyEval_ReleaseLock=python36.PyEval_ReleaseLock
+ PyEval_ReleaseThread=python36.PyEval_ReleaseThread
+ PyEval_RestoreThread=python36.PyEval_RestoreThread
+ PyEval_SaveThread=python36.PyEval_SaveThread
+ PyEval_ThreadsInitialized=python36.PyEval_ThreadsInitialized
+ PyExc_ArithmeticError=python36.PyExc_ArithmeticError DATA
+ PyExc_AssertionError=python36.PyExc_AssertionError DATA
+ PyExc_AttributeError=python36.PyExc_AttributeError DATA
+ PyExc_BaseException=python36.PyExc_BaseException DATA
+ PyExc_BufferError=python36.PyExc_BufferError DATA
+ PyExc_BytesWarning=python36.PyExc_BytesWarning DATA
+ PyExc_DeprecationWarning=python36.PyExc_DeprecationWarning DATA
+ PyExc_EOFError=python36.PyExc_EOFError DATA
+ PyExc_EnvironmentError=python36.PyExc_EnvironmentError DATA
+ PyExc_Exception=python36.PyExc_Exception DATA
+ PyExc_FloatingPointError=python36.PyExc_FloatingPointError DATA
+ PyExc_FutureWarning=python36.PyExc_FutureWarning DATA
+ PyExc_GeneratorExit=python36.PyExc_GeneratorExit DATA
+ PyExc_IOError=python36.PyExc_IOError DATA
+ PyExc_ImportError=python36.PyExc_ImportError DATA
+ PyExc_ImportWarning=python36.PyExc_ImportWarning DATA
+ PyExc_IndentationError=python36.PyExc_IndentationError DATA
+ PyExc_IndexError=python36.PyExc_IndexError DATA
+ PyExc_KeyError=python36.PyExc_KeyError DATA
+ PyExc_KeyboardInterrupt=python36.PyExc_KeyboardInterrupt DATA
+ PyExc_LookupError=python36.PyExc_LookupError DATA
+ PyExc_MemoryError=python36.PyExc_MemoryError DATA
+ PyExc_MemoryErrorInst=python36.PyExc_MemoryErrorInst DATA
+ PyExc_NameError=python36.PyExc_NameError DATA
+ PyExc_NotImplementedError=python36.PyExc_NotImplementedError DATA
+ PyExc_OSError=python36.PyExc_OSError DATA
+ PyExc_OverflowError=python36.PyExc_OverflowError DATA
+ PyExc_PendingDeprecationWarning=python36.PyExc_PendingDeprecationWarning DATA
+ PyExc_RecursionErrorInst=python36.PyExc_RecursionErrorInst DATA
+ PyExc_ReferenceError=python36.PyExc_ReferenceError DATA
+ PyExc_RuntimeError=python36.PyExc_RuntimeError DATA
+ PyExc_RuntimeWarning=python36.PyExc_RuntimeWarning DATA
+ PyExc_StopIteration=python36.PyExc_StopIteration DATA
+ PyExc_SyntaxError=python36.PyExc_SyntaxError DATA
+ PyExc_SyntaxWarning=python36.PyExc_SyntaxWarning DATA
+ PyExc_SystemError=python36.PyExc_SystemError DATA
+ PyExc_SystemExit=python36.PyExc_SystemExit DATA
+ PyExc_TabError=python36.PyExc_TabError DATA
+ PyExc_TypeError=python36.PyExc_TypeError DATA
+ PyExc_UnboundLocalError=python36.PyExc_UnboundLocalError DATA
+ PyExc_UnicodeDecodeError=python36.PyExc_UnicodeDecodeError DATA
+ PyExc_UnicodeEncodeError=python36.PyExc_UnicodeEncodeError DATA
+ PyExc_UnicodeError=python36.PyExc_UnicodeError DATA
+ PyExc_UnicodeTranslateError=python36.PyExc_UnicodeTranslateError DATA
+ PyExc_UnicodeWarning=python36.PyExc_UnicodeWarning DATA
+ PyExc_UserWarning=python36.PyExc_UserWarning DATA
+ PyExc_ValueError=python36.PyExc_ValueError DATA
+ PyExc_Warning=python36.PyExc_Warning DATA
+ PyExc_ZeroDivisionError=python36.PyExc_ZeroDivisionError DATA
+ PyException_GetCause=python36.PyException_GetCause
+ PyException_GetContext=python36.PyException_GetContext
+ PyException_GetTraceback=python36.PyException_GetTraceback
+ PyException_SetCause=python36.PyException_SetCause
+ PyException_SetContext=python36.PyException_SetContext
+ PyException_SetTraceback=python36.PyException_SetTraceback
+ PyFile_FromFd=python36.PyFile_FromFd
+ PyFile_GetLine=python36.PyFile_GetLine
+ PyFile_WriteObject=python36.PyFile_WriteObject
+ PyFile_WriteString=python36.PyFile_WriteString
+ PyFilter_Type=python36.PyFilter_Type DATA
+ PyFloat_AsDouble=python36.PyFloat_AsDouble
+ PyFloat_FromDouble=python36.PyFloat_FromDouble
+ PyFloat_FromString=python36.PyFloat_FromString
+ PyFloat_GetInfo=python36.PyFloat_GetInfo
+ PyFloat_GetMax=python36.PyFloat_GetMax
+ PyFloat_GetMin=python36.PyFloat_GetMin
+ PyFloat_Type=python36.PyFloat_Type DATA
+ PyFrozenSet_New=python36.PyFrozenSet_New
+ PyFrozenSet_Type=python36.PyFrozenSet_Type DATA
+ PyGC_Collect=python36.PyGC_Collect
+ PyGILState_Ensure=python36.PyGILState_Ensure
+ PyGILState_GetThisThreadState=python36.PyGILState_GetThisThreadState
+ PyGILState_Release=python36.PyGILState_Release
+ PyGetSetDescr_Type=python36.PyGetSetDescr_Type DATA
+ PyImport_AddModule=python36.PyImport_AddModule
+ PyImport_AppendInittab=python36.PyImport_AppendInittab
+ PyImport_Cleanup=python36.PyImport_Cleanup
+ PyImport_ExecCodeModule=python36.PyImport_ExecCodeModule
+ PyImport_ExecCodeModuleEx=python36.PyImport_ExecCodeModuleEx
+ PyImport_ExecCodeModuleWithPathnames=python36.PyImport_ExecCodeModuleWithPathnames
+ PyImport_GetImporter=python36.PyImport_GetImporter
+ PyImport_GetMagicNumber=python36.PyImport_GetMagicNumber
+ PyImport_GetMagicTag=python36.PyImport_GetMagicTag
+ PyImport_GetModuleDict=python36.PyImport_GetModuleDict
+ PyImport_Import=python36.PyImport_Import
+ PyImport_ImportFrozenModule=python36.PyImport_ImportFrozenModule
+ PyImport_ImportModule=python36.PyImport_ImportModule
+ PyImport_ImportModuleLevel=python36.PyImport_ImportModuleLevel
+ PyImport_ImportModuleNoBlock=python36.PyImport_ImportModuleNoBlock
+ PyImport_ReloadModule=python36.PyImport_ReloadModule
+ PyInterpreterState_Clear=python36.PyInterpreterState_Clear
+ PyInterpreterState_Delete=python36.PyInterpreterState_Delete
+ PyInterpreterState_New=python36.PyInterpreterState_New
+ PyIter_Next=python36.PyIter_Next
+ PyListIter_Type=python36.PyListIter_Type DATA
+ PyListRevIter_Type=python36.PyListRevIter_Type DATA
+ PyList_Append=python36.PyList_Append
+ PyList_AsTuple=python36.PyList_AsTuple
+ PyList_GetItem=python36.PyList_GetItem
+ PyList_GetSlice=python36.PyList_GetSlice
+ PyList_Insert=python36.PyList_Insert
+ PyList_New=python36.PyList_New
+ PyList_Reverse=python36.PyList_Reverse
+ PyList_SetItem=python36.PyList_SetItem
+ PyList_SetSlice=python36.PyList_SetSlice
+ PyList_Size=python36.PyList_Size
+ PyList_Sort=python36.PyList_Sort
+ PyList_Type=python36.PyList_Type DATA
+ PyLongRangeIter_Type=python36.PyLongRangeIter_Type DATA
+ PyLong_AsDouble=python36.PyLong_AsDouble
+ PyLong_AsLong=python36.PyLong_AsLong
+ PyLong_AsLongAndOverflow=python36.PyLong_AsLongAndOverflow
+ PyLong_AsLongLong=python36.PyLong_AsLongLong
+ PyLong_AsLongLongAndOverflow=python36.PyLong_AsLongLongAndOverflow
+ PyLong_AsSize_t=python36.PyLong_AsSize_t
+ PyLong_AsSsize_t=python36.PyLong_AsSsize_t
+ PyLong_AsUnsignedLong=python36.PyLong_AsUnsignedLong
+ PyLong_AsUnsignedLongLong=python36.PyLong_AsUnsignedLongLong
+ PyLong_AsUnsignedLongLongMask=python36.PyLong_AsUnsignedLongLongMask
+ PyLong_AsUnsignedLongMask=python36.PyLong_AsUnsignedLongMask
+ PyLong_AsVoidPtr=python36.PyLong_AsVoidPtr
+ PyLong_FromDouble=python36.PyLong_FromDouble
+ PyLong_FromLong=python36.PyLong_FromLong
+ PyLong_FromLongLong=python36.PyLong_FromLongLong
+ PyLong_FromSize_t=python36.PyLong_FromSize_t
+ PyLong_FromSsize_t=python36.PyLong_FromSsize_t
+ PyLong_FromString=python36.PyLong_FromString
+ PyLong_FromUnsignedLong=python36.PyLong_FromUnsignedLong
+ PyLong_FromUnsignedLongLong=python36.PyLong_FromUnsignedLongLong
+ PyLong_FromVoidPtr=python36.PyLong_FromVoidPtr
+ PyLong_GetInfo=python36.PyLong_GetInfo
+ PyLong_Type=python36.PyLong_Type DATA
+ PyMap_Type=python36.PyMap_Type DATA
+ PyMapping_Check=python36.PyMapping_Check
+ PyMapping_GetItemString=python36.PyMapping_GetItemString
+ PyMapping_HasKey=python36.PyMapping_HasKey
+ PyMapping_HasKeyString=python36.PyMapping_HasKeyString
+ PyMapping_Items=python36.PyMapping_Items
+ PyMapping_Keys=python36.PyMapping_Keys
+ PyMapping_Length=python36.PyMapping_Length
+ PyMapping_SetItemString=python36.PyMapping_SetItemString
+ PyMapping_Size=python36.PyMapping_Size
+ PyMapping_Values=python36.PyMapping_Values
+ PyMem_Free=python36.PyMem_Free
+ PyMem_Malloc=python36.PyMem_Malloc
+ PyMem_Realloc=python36.PyMem_Realloc
+ PyMemberDescr_Type=python36.PyMemberDescr_Type DATA
+ PyMemoryView_FromObject=python36.PyMemoryView_FromObject
+ PyMemoryView_GetContiguous=python36.PyMemoryView_GetContiguous
+ PyMemoryView_Type=python36.PyMemoryView_Type DATA
+ PyMethodDescr_Type=python36.PyMethodDescr_Type DATA
+ PyModule_AddIntConstant=python36.PyModule_AddIntConstant
+ PyModule_AddObject=python36.PyModule_AddObject
+ PyModule_AddStringConstant=python36.PyModule_AddStringConstant
+ PyModule_Create2=python36.PyModule_Create2
+ PyModule_GetDef=python36.PyModule_GetDef
+ PyModule_GetDict=python36.PyModule_GetDict
+ PyModule_GetFilename=python36.PyModule_GetFilename
+ PyModule_GetFilenameObject=python36.PyModule_GetFilenameObject
+ PyModule_GetName=python36.PyModule_GetName
+ PyModule_GetState=python36.PyModule_GetState
+ PyModule_New=python36.PyModule_New
+ PyModule_Type=python36.PyModule_Type DATA
+ PyModuleDef_Init=python36.PyModuleDef_Init
+ PyModuleDef_Type=python36.PyModuleDef_Type DATA
+ PyNullImporter_Type=python36.PyNullImporter_Type DATA
+ PyNumber_Absolute=python36.PyNumber_Absolute
+ PyNumber_Add=python36.PyNumber_Add
+ PyNumber_And=python36.PyNumber_And
+ PyNumber_AsSsize_t=python36.PyNumber_AsSsize_t
+ PyNumber_Check=python36.PyNumber_Check
+ PyNumber_Divmod=python36.PyNumber_Divmod
+ PyNumber_Float=python36.PyNumber_Float
+ PyNumber_FloorDivide=python36.PyNumber_FloorDivide
+ PyNumber_InPlaceAdd=python36.PyNumber_InPlaceAdd
+ PyNumber_InPlaceAnd=python36.PyNumber_InPlaceAnd
+ PyNumber_InPlaceFloorDivide=python36.PyNumber_InPlaceFloorDivide
+ PyNumber_InPlaceLshift=python36.PyNumber_InPlaceLshift
+ PyNumber_InPlaceMultiply=python36.PyNumber_InPlaceMultiply
+ PyNumber_InPlaceOr=python36.PyNumber_InPlaceOr
+ PyNumber_InPlacePower=python36.PyNumber_InPlacePower
+ PyNumber_InPlaceRemainder=python36.PyNumber_InPlaceRemainder
+ PyNumber_InPlaceRshift=python36.PyNumber_InPlaceRshift
+ PyNumber_InPlaceSubtract=python36.PyNumber_InPlaceSubtract
+ PyNumber_InPlaceTrueDivide=python36.PyNumber_InPlaceTrueDivide
+ PyNumber_InPlaceXor=python36.PyNumber_InPlaceXor
+ PyNumber_Index=python36.PyNumber_Index
+ PyNumber_Invert=python36.PyNumber_Invert
+ PyNumber_Long=python36.PyNumber_Long
+ PyNumber_Lshift=python36.PyNumber_Lshift
+ PyNumber_Multiply=python36.PyNumber_Multiply
+ PyNumber_Negative=python36.PyNumber_Negative
+ PyNumber_Or=python36.PyNumber_Or
+ PyNumber_Positive=python36.PyNumber_Positive
+ PyNumber_Power=python36.PyNumber_Power
+ PyNumber_Remainder=python36.PyNumber_Remainder
+ PyNumber_Rshift=python36.PyNumber_Rshift
+ PyNumber_Subtract=python36.PyNumber_Subtract
+ PyNumber_ToBase=python36.PyNumber_ToBase
+ PyNumber_TrueDivide=python36.PyNumber_TrueDivide
+ PyNumber_Xor=python36.PyNumber_Xor
+ PyOS_AfterFork=python36.PyOS_AfterFork
+ PyOS_InitInterrupts=python36.PyOS_InitInterrupts
+ PyOS_InputHook=python36.PyOS_InputHook DATA
+ PyOS_InterruptOccurred=python36.PyOS_InterruptOccurred
+ PyOS_ReadlineFunctionPointer=python36.PyOS_ReadlineFunctionPointer DATA
+ PyOS_double_to_string=python36.PyOS_double_to_string
+ PyOS_getsig=python36.PyOS_getsig
+ PyOS_mystricmp=python36.PyOS_mystricmp
+ PyOS_mystrnicmp=python36.PyOS_mystrnicmp
+ PyOS_setsig=python36.PyOS_setsig
+ PyOS_snprintf=python36.PyOS_snprintf
+ PyOS_string_to_double=python36.PyOS_string_to_double
+ PyOS_strtol=python36.PyOS_strtol
+ PyOS_strtoul=python36.PyOS_strtoul
+ PyOS_vsnprintf=python36.PyOS_vsnprintf
+ PyObject_ASCII=python36.PyObject_ASCII
+ PyObject_AsCharBuffer=python36.PyObject_AsCharBuffer
+ PyObject_AsFileDescriptor=python36.PyObject_AsFileDescriptor
+ PyObject_AsReadBuffer=python36.PyObject_AsReadBuffer
+ PyObject_AsWriteBuffer=python36.PyObject_AsWriteBuffer
+ PyObject_Bytes=python36.PyObject_Bytes
+ PyObject_Call=python36.PyObject_Call
+ PyObject_CallFunction=python36.PyObject_CallFunction
+ PyObject_CallFunctionObjArgs=python36.PyObject_CallFunctionObjArgs
+ PyObject_CallMethod=python36.PyObject_CallMethod
+ PyObject_CallMethodObjArgs=python36.PyObject_CallMethodObjArgs
+ PyObject_CallObject=python36.PyObject_CallObject
+ PyObject_CheckReadBuffer=python36.PyObject_CheckReadBuffer
+ PyObject_ClearWeakRefs=python36.PyObject_ClearWeakRefs
+ PyObject_DelItem=python36.PyObject_DelItem
+ PyObject_DelItemString=python36.PyObject_DelItemString
+ PyObject_Dir=python36.PyObject_Dir
+ PyObject_Format=python36.PyObject_Format
+ PyObject_Free=python36.PyObject_Free
+ PyObject_GC_Del=python36.PyObject_GC_Del
+ PyObject_GC_Track=python36.PyObject_GC_Track
+ PyObject_GC_UnTrack=python36.PyObject_GC_UnTrack
+ PyObject_GenericGetAttr=python36.PyObject_GenericGetAttr
+ PyObject_GenericSetAttr=python36.PyObject_GenericSetAttr
+ PyObject_GetAttr=python36.PyObject_GetAttr
+ PyObject_GetAttrString=python36.PyObject_GetAttrString
+ PyObject_GetItem=python36.PyObject_GetItem
+ PyObject_GetIter=python36.PyObject_GetIter
+ PyObject_HasAttr=python36.PyObject_HasAttr
+ PyObject_HasAttrString=python36.PyObject_HasAttrString
+ PyObject_Hash=python36.PyObject_Hash
+ PyObject_HashNotImplemented=python36.PyObject_HashNotImplemented
+ PyObject_Init=python36.PyObject_Init
+ PyObject_InitVar=python36.PyObject_InitVar
+ PyObject_IsInstance=python36.PyObject_IsInstance
+ PyObject_IsSubclass=python36.PyObject_IsSubclass
+ PyObject_IsTrue=python36.PyObject_IsTrue
+ PyObject_Length=python36.PyObject_Length
+ PyObject_Malloc=python36.PyObject_Malloc
+ PyObject_Not=python36.PyObject_Not
+ PyObject_Realloc=python36.PyObject_Realloc
+ PyObject_Repr=python36.PyObject_Repr
+ PyObject_RichCompare=python36.PyObject_RichCompare
+ PyObject_RichCompareBool=python36.PyObject_RichCompareBool
+ PyObject_SelfIter=python36.PyObject_SelfIter
+ PyObject_SetAttr=python36.PyObject_SetAttr
+ PyObject_SetAttrString=python36.PyObject_SetAttrString
+ PyObject_SetItem=python36.PyObject_SetItem
+ PyObject_Size=python36.PyObject_Size
+ PyObject_Str=python36.PyObject_Str
+ PyObject_Type=python36.PyObject_Type DATA
+ PyODict_DelItem=python36.PyODict_DelItem
+ PyODict_New=python36.PyODict_New
+ PyODict_SetItem=python36.PyODict_SetItem
+ PyODict_Type=python36.PyODict_Type DATA
+ PyODictItems_Type=python36.PyODictItems_Type DATA
+ PyODictIter_Type=python36.PyODictIter_Type DATA
+ PyODictKeys_Type=python36.PyODictKeys_Type DATA
+ PyODictValues_Type=python36.PyODictValues_Type DATA
+ PyParser_SimpleParseFileFlags=python36.PyParser_SimpleParseFileFlags
+ PyParser_SimpleParseStringFlags=python36.PyParser_SimpleParseStringFlags
+ PyProperty_Type=python36.PyProperty_Type DATA
+ PyRangeIter_Type=python36.PyRangeIter_Type DATA
+ PyRange_Type=python36.PyRange_Type DATA
+ PyReversed_Type=python36.PyReversed_Type DATA
+ PySeqIter_New=python36.PySeqIter_New
+ PySeqIter_Type=python36.PySeqIter_Type DATA
+ PySequence_Check=python36.PySequence_Check
+ PySequence_Concat=python36.PySequence_Concat
+ PySequence_Contains=python36.PySequence_Contains
+ PySequence_Count=python36.PySequence_Count
+ PySequence_DelItem=python36.PySequence_DelItem
+ PySequence_DelSlice=python36.PySequence_DelSlice
+ PySequence_Fast=python36.PySequence_Fast
+ PySequence_GetItem=python36.PySequence_GetItem
+ PySequence_GetSlice=python36.PySequence_GetSlice
+ PySequence_In=python36.PySequence_In
+ PySequence_InPlaceConcat=python36.PySequence_InPlaceConcat
+ PySequence_InPlaceRepeat=python36.PySequence_InPlaceRepeat
+ PySequence_Index=python36.PySequence_Index
+ PySequence_Length=python36.PySequence_Length
+ PySequence_List=python36.PySequence_List
+ PySequence_Repeat=python36.PySequence_Repeat
+ PySequence_SetItem=python36.PySequence_SetItem
+ PySequence_SetSlice=python36.PySequence_SetSlice
+ PySequence_Size=python36.PySequence_Size
+ PySequence_Tuple=python36.PySequence_Tuple
+ PySetIter_Type=python36.PySetIter_Type DATA
+ PySet_Add=python36.PySet_Add
+ PySet_Clear=python36.PySet_Clear
+ PySet_Contains=python36.PySet_Contains
+ PySet_Discard=python36.PySet_Discard
+ PySet_New=python36.PySet_New
+ PySet_Pop=python36.PySet_Pop
+ PySet_Size=python36.PySet_Size
+ PySet_Type=python36.PySet_Type DATA
+ PySlice_GetIndices=python36.PySlice_GetIndices
+ PySlice_GetIndicesEx=python36.PySlice_GetIndicesEx
+ PySlice_New=python36.PySlice_New
+ PySlice_Type=python36.PySlice_Type DATA
+ PySortWrapper_Type=python36.PySortWrapper_Type DATA
+ PyState_FindModule=python36.PyState_FindModule
+ PyState_AddModule=python36.PyState_AddModule
+ PyState_RemoveModule=python36.PyState_RemoveModule
+ PyStructSequence_GetItem=python36.PyStructSequence_GetItem
+ PyStructSequence_New=python36.PyStructSequence_New
+ PyStructSequence_NewType=python36.PyStructSequence_NewType
+ PyStructSequence_SetItem=python36.PyStructSequence_SetItem
+ PySuper_Type=python36.PySuper_Type DATA
+ PySys_AddWarnOption=python36.PySys_AddWarnOption
+ PySys_AddWarnOptionUnicode=python36.PySys_AddWarnOptionUnicode
+ PySys_FormatStderr=python36.PySys_FormatStderr
+ PySys_FormatStdout=python36.PySys_FormatStdout
+ PySys_GetObject=python36.PySys_GetObject
+ PySys_HasWarnOptions=python36.PySys_HasWarnOptions
+ PySys_ResetWarnOptions=python36.PySys_ResetWarnOptions
+ PySys_SetArgv=python36.PySys_SetArgv
+ PySys_SetArgvEx=python36.PySys_SetArgvEx
+ PySys_SetObject=python36.PySys_SetObject
+ PySys_SetPath=python36.PySys_SetPath
+ PySys_WriteStderr=python36.PySys_WriteStderr
+ PySys_WriteStdout=python36.PySys_WriteStdout
+ PyThreadState_Clear=python36.PyThreadState_Clear
+ PyThreadState_Delete=python36.PyThreadState_Delete
+ PyThreadState_DeleteCurrent=python36.PyThreadState_DeleteCurrent
+ PyThreadState_Get=python36.PyThreadState_Get
+ PyThreadState_GetDict=python36.PyThreadState_GetDict
+ PyThreadState_New=python36.PyThreadState_New
+ PyThreadState_SetAsyncExc=python36.PyThreadState_SetAsyncExc
+ PyThreadState_Swap=python36.PyThreadState_Swap
+ PyTraceBack_Here=python36.PyTraceBack_Here
+ PyTraceBack_Print=python36.PyTraceBack_Print
+ PyTraceBack_Type=python36.PyTraceBack_Type DATA
+ PyTupleIter_Type=python36.PyTupleIter_Type DATA
+ PyTuple_ClearFreeList=python36.PyTuple_ClearFreeList
+ PyTuple_GetItem=python36.PyTuple_GetItem
+ PyTuple_GetSlice=python36.PyTuple_GetSlice
+ PyTuple_New=python36.PyTuple_New
+ PyTuple_Pack=python36.PyTuple_Pack
+ PyTuple_SetItem=python36.PyTuple_SetItem
+ PyTuple_Size=python36.PyTuple_Size
+ PyTuple_Type=python36.PyTuple_Type DATA
+ PyType_ClearCache=python36.PyType_ClearCache
+ PyType_FromSpec=python36.PyType_FromSpec
+ PyType_FromSpecWithBases=python36.PyType_FromSpecWithBases
+ PyType_GenericAlloc=python36.PyType_GenericAlloc
+ PyType_GenericNew=python36.PyType_GenericNew
+ PyType_GetFlags=python36.PyType_GetFlags
+ PyType_GetSlot=python36.PyType_GetSlot
+ PyType_IsSubtype=python36.PyType_IsSubtype
+ PyType_Modified=python36.PyType_Modified
+ PyType_Ready=python36.PyType_Ready
+ PyType_Type=python36.PyType_Type DATA
+ PyUnicodeDecodeError_Create=python36.PyUnicodeDecodeError_Create
+ PyUnicodeDecodeError_GetEncoding=python36.PyUnicodeDecodeError_GetEncoding
+ PyUnicodeDecodeError_GetEnd=python36.PyUnicodeDecodeError_GetEnd
+ PyUnicodeDecodeError_GetObject=python36.PyUnicodeDecodeError_GetObject
+ PyUnicodeDecodeError_GetReason=python36.PyUnicodeDecodeError_GetReason
+ PyUnicodeDecodeError_GetStart=python36.PyUnicodeDecodeError_GetStart
+ PyUnicodeDecodeError_SetEnd=python36.PyUnicodeDecodeError_SetEnd
+ PyUnicodeDecodeError_SetReason=python36.PyUnicodeDecodeError_SetReason
+ PyUnicodeDecodeError_SetStart=python36.PyUnicodeDecodeError_SetStart
+ PyUnicodeEncodeError_GetEncoding=python36.PyUnicodeEncodeError_GetEncoding
+ PyUnicodeEncodeError_GetEnd=python36.PyUnicodeEncodeError_GetEnd
+ PyUnicodeEncodeError_GetObject=python36.PyUnicodeEncodeError_GetObject
+ PyUnicodeEncodeError_GetReason=python36.PyUnicodeEncodeError_GetReason
+ PyUnicodeEncodeError_GetStart=python36.PyUnicodeEncodeError_GetStart
+ PyUnicodeEncodeError_SetEnd=python36.PyUnicodeEncodeError_SetEnd
+ PyUnicodeEncodeError_SetReason=python36.PyUnicodeEncodeError_SetReason
+ PyUnicodeEncodeError_SetStart=python36.PyUnicodeEncodeError_SetStart
+ PyUnicodeIter_Type=python36.PyUnicodeIter_Type DATA
+ PyUnicodeTranslateError_GetEnd=python36.PyUnicodeTranslateError_GetEnd
+ PyUnicodeTranslateError_GetObject=python36.PyUnicodeTranslateError_GetObject
+ PyUnicodeTranslateError_GetReason=python36.PyUnicodeTranslateError_GetReason
+ PyUnicodeTranslateError_GetStart=python36.PyUnicodeTranslateError_GetStart
+ PyUnicodeTranslateError_SetEnd=python36.PyUnicodeTranslateError_SetEnd
+ PyUnicodeTranslateError_SetReason=python36.PyUnicodeTranslateError_SetReason
+ PyUnicodeTranslateError_SetStart=python36.PyUnicodeTranslateError_SetStart
+ PyUnicode_Append=python36.PyUnicode_Append
+ PyUnicode_AppendAndDel=python36.PyUnicode_AppendAndDel
+ PyUnicode_AsASCIIString=python36.PyUnicode_AsASCIIString
+ PyUnicode_AsCharmapString=python36.PyUnicode_AsCharmapString
+ PyUnicode_AsDecodedObject=python36.PyUnicode_AsDecodedObject
+ PyUnicode_AsDecodedUnicode=python36.PyUnicode_AsDecodedUnicode
+ PyUnicode_AsEncodedObject=python36.PyUnicode_AsEncodedObject
+ PyUnicode_AsEncodedString=python36.PyUnicode_AsEncodedString
+ PyUnicode_AsEncodedUnicode=python36.PyUnicode_AsEncodedUnicode
+ PyUnicode_AsLatin1String=python36.PyUnicode_AsLatin1String
+ PyUnicode_AsRawUnicodeEscapeString=python36.PyUnicode_AsRawUnicodeEscapeString
+ PyUnicode_AsUTF16String=python36.PyUnicode_AsUTF16String
+ PyUnicode_AsUTF32String=python36.PyUnicode_AsUTF32String
+ PyUnicode_AsUTF8String=python36.PyUnicode_AsUTF8String
+ PyUnicode_AsUnicodeEscapeString=python36.PyUnicode_AsUnicodeEscapeString
+ PyUnicode_AsWideChar=python36.PyUnicode_AsWideChar
+ PyUnicode_ClearFreelist=python36.PyUnicode_ClearFreelist
+ PyUnicode_Compare=python36.PyUnicode_Compare
+ PyUnicode_Concat=python36.PyUnicode_Concat
+ PyUnicode_Contains=python36.PyUnicode_Contains
+ PyUnicode_Count=python36.PyUnicode_Count
+ PyUnicode_Decode=python36.PyUnicode_Decode
+ PyUnicode_DecodeASCII=python36.PyUnicode_DecodeASCII
+ PyUnicode_DecodeCharmap=python36.PyUnicode_DecodeCharmap
+ PyUnicode_DecodeFSDefault=python36.PyUnicode_DecodeFSDefault
+ PyUnicode_DecodeFSDefaultAndSize=python36.PyUnicode_DecodeFSDefaultAndSize
+ PyUnicode_DecodeLatin1=python36.PyUnicode_DecodeLatin1
+ PyUnicode_DecodeRawUnicodeEscape=python36.PyUnicode_DecodeRawUnicodeEscape
+ PyUnicode_DecodeUTF16=python36.PyUnicode_DecodeUTF16
+ PyUnicode_DecodeUTF16Stateful=python36.PyUnicode_DecodeUTF16Stateful
+ PyUnicode_DecodeUTF32=python36.PyUnicode_DecodeUTF32
+ PyUnicode_DecodeUTF32Stateful=python36.PyUnicode_DecodeUTF32Stateful
+ PyUnicode_DecodeUTF8=python36.PyUnicode_DecodeUTF8
+ PyUnicode_DecodeUTF8Stateful=python36.PyUnicode_DecodeUTF8Stateful
+ PyUnicode_DecodeUnicodeEscape=python36.PyUnicode_DecodeUnicodeEscape
+ PyUnicode_FSConverter=python36.PyUnicode_FSConverter
+ PyUnicode_FSDecoder=python36.PyUnicode_FSDecoder
+ PyUnicode_Find=python36.PyUnicode_Find
+ PyUnicode_Format=python36.PyUnicode_Format
+ PyUnicode_FromEncodedObject=python36.PyUnicode_FromEncodedObject
+ PyUnicode_FromFormat=python36.PyUnicode_FromFormat
+ PyUnicode_FromFormatV=python36.PyUnicode_FromFormatV
+ PyUnicode_FromObject=python36.PyUnicode_FromObject
+ PyUnicode_FromOrdinal=python36.PyUnicode_FromOrdinal
+ PyUnicode_FromString=python36.PyUnicode_FromString
+ PyUnicode_FromStringAndSize=python36.PyUnicode_FromStringAndSize
+ PyUnicode_FromWideChar=python36.PyUnicode_FromWideChar
+ PyUnicode_GetDefaultEncoding=python36.PyUnicode_GetDefaultEncoding
+ PyUnicode_GetSize=python36.PyUnicode_GetSize
+ PyUnicode_IsIdentifier=python36.PyUnicode_IsIdentifier
+ PyUnicode_Join=python36.PyUnicode_Join
+ PyUnicode_Partition=python36.PyUnicode_Partition
+ PyUnicode_RPartition=python36.PyUnicode_RPartition
+ PyUnicode_RSplit=python36.PyUnicode_RSplit
+ PyUnicode_Replace=python36.PyUnicode_Replace
+ PyUnicode_Resize=python36.PyUnicode_Resize
+ PyUnicode_RichCompare=python36.PyUnicode_RichCompare
+ PyUnicode_SetDefaultEncoding=python36.PyUnicode_SetDefaultEncoding
+ PyUnicode_Split=python36.PyUnicode_Split
+ PyUnicode_Splitlines=python36.PyUnicode_Splitlines
+ PyUnicode_Tailmatch=python36.PyUnicode_Tailmatch
+ PyUnicode_Translate=python36.PyUnicode_Translate
+ PyUnicode_BuildEncodingMap=python36.PyUnicode_BuildEncodingMap
+ PyUnicode_CompareWithASCIIString=python36.PyUnicode_CompareWithASCIIString
+ PyUnicode_DecodeUTF7=python36.PyUnicode_DecodeUTF7
+ PyUnicode_DecodeUTF7Stateful=python36.PyUnicode_DecodeUTF7Stateful
+ PyUnicode_EncodeFSDefault=python36.PyUnicode_EncodeFSDefault
+ PyUnicode_InternFromString=python36.PyUnicode_InternFromString
+ PyUnicode_InternImmortal=python36.PyUnicode_InternImmortal
+ PyUnicode_InternInPlace=python36.PyUnicode_InternInPlace
+ PyUnicode_Type=python36.PyUnicode_Type DATA
+ PyWeakref_GetObject=python36.PyWeakref_GetObject DATA
+ PyWeakref_NewProxy=python36.PyWeakref_NewProxy
+ PyWeakref_NewRef=python36.PyWeakref_NewRef
+ PyWrapperDescr_Type=python36.PyWrapperDescr_Type DATA
+ PyWrapper_New=python36.PyWrapper_New
+ PyZip_Type=python36.PyZip_Type DATA
+ Py_AddPendingCall=python36.Py_AddPendingCall
+ Py_AtExit=python36.Py_AtExit
+ Py_BuildValue=python36.Py_BuildValue
+ Py_CompileString=python36.Py_CompileString
+ Py_DecRef=python36.Py_DecRef
+ Py_EndInterpreter=python36.Py_EndInterpreter
+ Py_Exit=python36.Py_Exit
+ Py_FatalError=python36.Py_FatalError
+ Py_FileSystemDefaultEncoding=python36.Py_FileSystemDefaultEncoding DATA
+ Py_Finalize=python36.Py_Finalize
+ Py_GetBuildInfo=python36.Py_GetBuildInfo
+ Py_GetCompiler=python36.Py_GetCompiler
+ Py_GetCopyright=python36.Py_GetCopyright
+ Py_GetExecPrefix=python36.Py_GetExecPrefix
+ Py_GetPath=python36.Py_GetPath
+ Py_GetPlatform=python36.Py_GetPlatform
+ Py_GetPrefix=python36.Py_GetPrefix
+ Py_GetProgramFullPath=python36.Py_GetProgramFullPath
+ Py_GetProgramName=python36.Py_GetProgramName
+ Py_GetPythonHome=python36.Py_GetPythonHome
+ Py_GetRecursionLimit=python36.Py_GetRecursionLimit
+ Py_GetVersion=python36.Py_GetVersion
+ Py_HasFileSystemDefaultEncoding=python36.Py_HasFileSystemDefaultEncoding DATA
+ Py_IncRef=python36.Py_IncRef
+ Py_Initialize=python36.Py_Initialize
+ Py_InitializeEx=python36.Py_InitializeEx
+ Py_IsInitialized=python36.Py_IsInitialized
+ Py_Main=python36.Py_Main
+ Py_MakePendingCalls=python36.Py_MakePendingCalls
+ Py_NewInterpreter=python36.Py_NewInterpreter
+ Py_ReprEnter=python36.Py_ReprEnter
+ Py_ReprLeave=python36.Py_ReprLeave
+ Py_SetProgramName=python36.Py_SetProgramName
+ Py_SetPythonHome=python36.Py_SetPythonHome
+ Py_SetRecursionLimit=python36.Py_SetRecursionLimit
+ Py_SymtableString=python36.Py_SymtableString
+ Py_VaBuildValue=python36.Py_VaBuildValue
+ _PyErr_BadInternalCall=python36._PyErr_BadInternalCall
+ _PyObject_CallFunction_SizeT=python36._PyObject_CallFunction_SizeT
+ _PyObject_CallMethod_SizeT=python36._PyObject_CallMethod_SizeT
+ _PyObject_GC_Malloc=python36._PyObject_GC_Malloc
+ _PyObject_GC_New=python36._PyObject_GC_New
+ _PyObject_GC_NewVar=python36._PyObject_GC_NewVar
+ _PyObject_GC_Resize=python36._PyObject_GC_Resize
+ _PyObject_New=python36._PyObject_New
+ _PyObject_NewVar=python36._PyObject_NewVar
+ _PyState_AddModule=python36._PyState_AddModule
+ _PyThreadState_Init=python36._PyThreadState_Init
+ _PyThreadState_Prealloc=python36._PyThreadState_Prealloc
+ _PyTrash_delete_later=python36._PyTrash_delete_later DATA
+ _PyTrash_delete_nesting=python36._PyTrash_delete_nesting DATA
+ _PyTrash_deposit_object=python36._PyTrash_deposit_object
+ _PyTrash_destroy_chain=python36._PyTrash_destroy_chain
+ _PyWeakref_CallableProxyType=python36._PyWeakref_CallableProxyType DATA
+ _PyWeakref_ProxyType=python36._PyWeakref_ProxyType DATA
+ _PyWeakref_RefType=python36._PyWeakref_RefType DATA
+ _Py_BuildValue_SizeT=python36._Py_BuildValue_SizeT
+ _Py_CheckRecursionLimit=python36._Py_CheckRecursionLimit DATA
+ _Py_CheckRecursiveCall=python36._Py_CheckRecursiveCall
+ _Py_Dealloc=python36._Py_Dealloc
+ _Py_EllipsisObject=python36._Py_EllipsisObject DATA
+ _Py_FalseStruct=python36._Py_FalseStruct DATA
+ _Py_NoneStruct=python36._Py_NoneStruct DATA
+ _Py_NotImplementedStruct=python36._Py_NotImplementedStruct DATA
+ _Py_SwappedOp=python36._Py_SwappedOp DATA
+ _Py_TrueStruct=python36._Py_TrueStruct DATA
+ _Py_VaBuildValue_SizeT=python36._Py_VaBuildValue_SizeT
+ _PyArg_Parse_SizeT=python36._PyArg_Parse_SizeT
+ _PyArg_ParseTuple_SizeT=python36._PyArg_ParseTuple_SizeT
+ _PyArg_ParseTupleAndKeywords_SizeT=python36._PyArg_ParseTupleAndKeywords_SizeT
+ _PyArg_VaParse_SizeT=python36._PyArg_VaParse_SizeT
+ _PyArg_VaParseTupleAndKeywords_SizeT=python36._PyArg_VaParseTupleAndKeywords_SizeT
+ _Py_BuildValue_SizeT=python36._Py_BuildValue_SizeT
diff --git a/PCbuild/prepare_ssl.bat b/PCbuild/prepare_ssl.bat
index c08a9f3..3153615 100644
--- a/PCbuild/prepare_ssl.bat
+++ b/PCbuild/prepare_ssl.bat
@@ -3,10 +3,10 @@
if %1 EQU Debug (
shift
set HOST_PYTHON=python_d.exe
- if not exist python35_d.dll exit 1
+ if not exist python36_d.dll exit 1
) ELSE (
set HOST_PYTHON=python.exe
- if not exist python35.dll exit 1
+ if not exist python36.dll exit 1
)
)
%HOST_PYTHON% prepare_ssl.py %1
diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt
index 09a996f..5be66f4 100644
--- a/PCbuild/readme.txt
+++ b/PCbuild/readme.txt
@@ -48,7 +48,7 @@
Used to build Python with extra debugging capabilities, equivalent
to using ./configure --with-pydebug on UNIX. All binaries built
using this configuration have "_d" added to their name:
- python35_d.dll, python_d.exe, parser_d.pyd, and so on. Both the
+ python36_d.dll, python_d.exe, parser_d.pyd, and so on. Both the
build and rt (run test) batch files in this directory accept a -d
option for debug builds. If you are building Python to help with
development of CPython, you will most likely use this configuration.
diff --git a/PCbuild/xxlimited.vcxproj b/PCbuild/xxlimited.vcxproj
index 0144fa9..9dbdc77 100644
--- a/PCbuild/xxlimited.vcxproj
+++ b/PCbuild/xxlimited.vcxproj
@@ -62,7 +62,7 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);Py_LIMITED_API=0x03050000</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);Py_LIMITED_API=0x03060000</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
diff --git a/Parser/Python.asdl b/Parser/Python.asdl
index cd0832d..22775c6 100644
--- a/Parser/Python.asdl
+++ b/Parser/Python.asdl
@@ -71,6 +71,8 @@
| Call(expr func, expr* args, keyword* keywords)
| Num(object n) -- a number as a PyObject.
| Str(string s) -- need to specify raw, unicode, etc?
+ | FormattedValue(expr value, int? conversion, expr? format_spec)
+ | JoinedStr(expr* values)
| Bytes(bytes s)
| NameConstant(singleton value)
| Ellipsis
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
old mode 100755
new mode 100644
index a5e35d9..d597122
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -898,7 +898,7 @@
return 1;
}
- i = (int)PyLong_AsLong(obj);
+ i = _PyLong_AsInt(obj);
if (i == -1 && PyErr_Occurred())
return 1;
*out = i;
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 04baeaf..2369be4 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1477,17 +1477,19 @@
nonascii = 0;
if (is_potential_identifier_start(c)) {
/* Process b"", r"", u"", br"" and rb"" */
- int saw_b = 0, saw_r = 0, saw_u = 0;
+ int saw_b = 0, saw_r = 0, saw_u = 0, saw_f = 0;
while (1) {
- if (!(saw_b || saw_u) && (c == 'b' || c == 'B'))
+ if (!(saw_b || saw_u || saw_f) && (c == 'b' || c == 'B'))
saw_b = 1;
/* Since this is a backwards compatibility support literal we don't
want to support it in arbitrary order like byte literals. */
- else if (!(saw_b || saw_u || saw_r) && (c == 'u' || c == 'U'))
+ else if (!(saw_b || saw_u || saw_r || saw_f) && (c == 'u' || c == 'U'))
saw_u = 1;
/* ur"" and ru"" are not supported */
else if (!(saw_r || saw_u) && (c == 'r' || c == 'R'))
saw_r = 1;
+ else if (!(saw_f || saw_b || saw_u) && (c == 'f' || c == 'F'))
+ saw_f = 1;
else
break;
c = tok_nextc(tok);
@@ -1741,7 +1743,7 @@
else {
end_quote_size = 0;
if (c == '\\')
- c = tok_nextc(tok); /* skip escaped char */
+ c = tok_nextc(tok); /* skip escaped char */
}
}
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 8a2dc7c..a2e9816 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -285,6 +285,18 @@
static char *Str_fields[]={
"s",
};
+static PyTypeObject *FormattedValue_type;
+_Py_IDENTIFIER(conversion);
+_Py_IDENTIFIER(format_spec);
+static char *FormattedValue_fields[]={
+ "value",
+ "conversion",
+ "format_spec",
+};
+static PyTypeObject *JoinedStr_type;
+static char *JoinedStr_fields[]={
+ "values",
+};
static PyTypeObject *Bytes_type;
static char *Bytes_fields[]={
"s",
@@ -769,7 +781,7 @@
return 1;
}
- i = (int)PyLong_AsLong(obj);
+ i = _PyLong_AsInt(obj);
if (i == -1 && PyErr_Occurred())
return 1;
*out = i;
@@ -917,6 +929,11 @@
if (!Num_type) return 0;
Str_type = make_type("Str", expr_type, Str_fields, 1);
if (!Str_type) return 0;
+ FormattedValue_type = make_type("FormattedValue", expr_type,
+ FormattedValue_fields, 3);
+ if (!FormattedValue_type) return 0;
+ JoinedStr_type = make_type("JoinedStr", expr_type, JoinedStr_fields, 1);
+ if (!JoinedStr_type) return 0;
Bytes_type = make_type("Bytes", expr_type, Bytes_fields, 1);
if (!Bytes_type) return 0;
NameConstant_type = make_type("NameConstant", expr_type,
@@ -2063,6 +2080,42 @@
}
expr_ty
+FormattedValue(expr_ty value, int conversion, expr_ty format_spec, int lineno,
+ int col_offset, PyArena *arena)
+{
+ expr_ty p;
+ if (!value) {
+ PyErr_SetString(PyExc_ValueError,
+ "field value is required for FormattedValue");
+ return NULL;
+ }
+ p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ if (!p)
+ return NULL;
+ p->kind = FormattedValue_kind;
+ p->v.FormattedValue.value = value;
+ p->v.FormattedValue.conversion = conversion;
+ p->v.FormattedValue.format_spec = format_spec;
+ p->lineno = lineno;
+ p->col_offset = col_offset;
+ return p;
+}
+
+expr_ty
+JoinedStr(asdl_seq * values, int lineno, int col_offset, PyArena *arena)
+{
+ expr_ty p;
+ p = (expr_ty)PyArena_Malloc(arena, sizeof(*p));
+ if (!p)
+ return NULL;
+ p->kind = JoinedStr_kind;
+ p->v.JoinedStr.values = values;
+ p->lineno = lineno;
+ p->col_offset = col_offset;
+ return p;
+}
+
+expr_ty
Bytes(bytes s, int lineno, int col_offset, PyArena *arena)
{
expr_ty p;
@@ -3161,6 +3214,34 @@
goto failed;
Py_DECREF(value);
break;
+ case FormattedValue_kind:
+ result = PyType_GenericNew(FormattedValue_type, NULL, NULL);
+ if (!result) goto failed;
+ value = ast2obj_expr(o->v.FormattedValue.value);
+ if (!value) goto failed;
+ if (_PyObject_SetAttrId(result, &PyId_value, value) == -1)
+ goto failed;
+ Py_DECREF(value);
+ value = ast2obj_int(o->v.FormattedValue.conversion);
+ if (!value) goto failed;
+ if (_PyObject_SetAttrId(result, &PyId_conversion, value) == -1)
+ goto failed;
+ Py_DECREF(value);
+ value = ast2obj_expr(o->v.FormattedValue.format_spec);
+ if (!value) goto failed;
+ if (_PyObject_SetAttrId(result, &PyId_format_spec, value) == -1)
+ goto failed;
+ Py_DECREF(value);
+ break;
+ case JoinedStr_kind:
+ result = PyType_GenericNew(JoinedStr_type, NULL, NULL);
+ if (!result) goto failed;
+ value = ast2obj_list(o->v.JoinedStr.values, ast2obj_expr);
+ if (!value) goto failed;
+ if (_PyObject_SetAttrId(result, &PyId_values, value) == -1)
+ goto failed;
+ Py_DECREF(value);
+ break;
case Bytes_kind:
result = PyType_GenericNew(Bytes_type, NULL, NULL);
if (!result) goto failed;
@@ -6022,6 +6103,86 @@
if (*out == NULL) goto failed;
return 0;
}
+ isinstance = PyObject_IsInstance(obj, (PyObject*)FormattedValue_type);
+ if (isinstance == -1) {
+ return 1;
+ }
+ if (isinstance) {
+ expr_ty value;
+ int conversion;
+ expr_ty format_spec;
+
+ if (_PyObject_HasAttrId(obj, &PyId_value)) {
+ int res;
+ tmp = _PyObject_GetAttrId(obj, &PyId_value);
+ if (tmp == NULL) goto failed;
+ res = obj2ast_expr(tmp, &value, arena);
+ if (res != 0) goto failed;
+ Py_CLEAR(tmp);
+ } else {
+ PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from FormattedValue");
+ return 1;
+ }
+ if (exists_not_none(obj, &PyId_conversion)) {
+ int res;
+ tmp = _PyObject_GetAttrId(obj, &PyId_conversion);
+ if (tmp == NULL) goto failed;
+ res = obj2ast_int(tmp, &conversion, arena);
+ if (res != 0) goto failed;
+ Py_CLEAR(tmp);
+ } else {
+ conversion = 0;
+ }
+ if (exists_not_none(obj, &PyId_format_spec)) {
+ int res;
+ tmp = _PyObject_GetAttrId(obj, &PyId_format_spec);
+ if (tmp == NULL) goto failed;
+ res = obj2ast_expr(tmp, &format_spec, arena);
+ if (res != 0) goto failed;
+ Py_CLEAR(tmp);
+ } else {
+ format_spec = NULL;
+ }
+ *out = FormattedValue(value, conversion, format_spec, lineno,
+ col_offset, arena);
+ if (*out == NULL) goto failed;
+ return 0;
+ }
+ isinstance = PyObject_IsInstance(obj, (PyObject*)JoinedStr_type);
+ if (isinstance == -1) {
+ return 1;
+ }
+ if (isinstance) {
+ asdl_seq* values;
+
+ if (_PyObject_HasAttrId(obj, &PyId_values)) {
+ int res;
+ Py_ssize_t len;
+ Py_ssize_t i;
+ tmp = _PyObject_GetAttrId(obj, &PyId_values);
+ if (tmp == NULL) goto failed;
+ if (!PyList_Check(tmp)) {
+ PyErr_Format(PyExc_TypeError, "JoinedStr field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name);
+ goto failed;
+ }
+ len = PyList_GET_SIZE(tmp);
+ values = _Py_asdl_seq_new(len, arena);
+ if (values == NULL) goto failed;
+ for (i = 0; i < len; i++) {
+ expr_ty value;
+ res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
+ if (res != 0) goto failed;
+ asdl_seq_SET(values, i, value);
+ }
+ Py_CLEAR(tmp);
+ } else {
+ PyErr_SetString(PyExc_TypeError, "required field \"values\" missing from JoinedStr");
+ return 1;
+ }
+ *out = JoinedStr(values, lineno, col_offset, arena);
+ if (*out == NULL) goto failed;
+ return 0;
+ }
isinstance = PyObject_IsInstance(obj, (PyObject*)Bytes_type);
if (isinstance == -1) {
return 1;
@@ -7319,6 +7480,10 @@
if (PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Num", (PyObject*)Num_type) < 0) return NULL;
if (PyDict_SetItemString(d, "Str", (PyObject*)Str_type) < 0) return NULL;
+ if (PyDict_SetItemString(d, "FormattedValue",
+ (PyObject*)FormattedValue_type) < 0) return NULL;
+ if (PyDict_SetItemString(d, "JoinedStr", (PyObject*)JoinedStr_type) < 0)
+ return NULL;
if (PyDict_SetItemString(d, "Bytes", (PyObject*)Bytes_type) < 0) return
NULL;
if (PyDict_SetItemString(d, "NameConstant", (PyObject*)NameConstant_type) <
diff --git a/Python/ast.c b/Python/ast.c
index dd5187a..5a7a745 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -257,6 +257,14 @@
}
return 1;
}
+ case JoinedStr_kind:
+ return validate_exprs(exp->v.JoinedStr.values, Load, 0);
+ case FormattedValue_kind:
+ if (validate_expr(exp->v.FormattedValue.value, Load) == 0)
+ return 0;
+ if (exp->v.FormattedValue.format_spec)
+ return validate_expr(exp->v.FormattedValue.format_spec, Load);
+ return 1;
case Bytes_kind: {
PyObject *b = exp->v.Bytes.s;
if (!PyBytes_CheckExact(b)) {
@@ -513,7 +521,7 @@
/* Data structure used internally */
struct compiling {
char *c_encoding; /* source encoding */
- PyArena *c_arena; /* arena for allocating memeory */
+ PyArena *c_arena; /* Arena for allocating memory. */
PyObject *c_filename; /* filename */
PyObject *c_normalize; /* Normalization function from unicodedata. */
PyObject *c_normalize_args; /* Normalization argument tuple. */
@@ -535,9 +543,7 @@
static expr_ty ast_for_call(struct compiling *, const node *, expr_ty);
static PyObject *parsenumber(struct compiling *, const char *);
-static PyObject *parsestr(struct compiling *, const node *n, int *bytesmode);
-static PyObject *parsestrplus(struct compiling *, const node *n,
- int *bytesmode);
+static expr_ty parsestrplus(struct compiling *, const node *n);
#define COMP_GENEXP 0
#define COMP_LISTCOMP 1
@@ -986,6 +992,8 @@
case Num_kind:
case Str_kind:
case Bytes_kind:
+ case JoinedStr_kind:
+ case FormattedValue_kind:
expr_name = "literal";
break;
case NameConstant_kind:
@@ -1262,16 +1270,20 @@
and varargslist (lambda definition).
parameters: '(' [typedargslist] ')'
- typedargslist: ((tfpdef ['=' test] ',')*
- ('*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef]
- | '**' tfpdef)
- | tfpdef ['=' test] (',' tfpdef ['=' test])* [','])
+ typedargslist: (tfpdef ['=' test] (',' tfpdef ['=' test])* [',' [
+ '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]]
+ | '**' tfpdef [',']]]
+ | '*' [tfpdef] (',' tfpdef ['=' test])* [',' ['**' tfpdef [',']]]
+ | '**' tfpdef [','])
tfpdef: NAME [':' test]
- varargslist: ((vfpdef ['=' test] ',')*
- ('*' [vfpdef] (',' vfpdef ['=' test])* [',' '**' vfpdef]
- | '**' vfpdef)
- | vfpdef ['=' test] (',' vfpdef ['=' test])* [','])
+ varargslist: (vfpdef ['=' test] (',' vfpdef ['=' test])* [',' [
+ '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]
+ | '**' vfpdef [',']]]
+ | '*' [vfpdef] (',' vfpdef ['=' test])* [',' ['**' vfpdef [',']]]
+ | '**' vfpdef [',']
+ )
vfpdef: NAME
+
*/
int i, j, k, nposargs = 0, nkwonlyargs = 0;
int nposdefaults = 0, found_default = 0;
@@ -1373,7 +1385,8 @@
i += 2; /* the name and the comma */
break;
case STAR:
- if (i+1 >= NCH(n)) {
+ if (i+1 >= NCH(n) ||
+ (i+2 == NCH(n) && TYPE(CHILD(n, i+1)) == COMMA)) {
ast_error(c, CHILD(n, i),
"named arguments must follow bare *");
return NULL;
@@ -1996,7 +2009,6 @@
| '...' | 'None' | 'True' | 'False'
*/
node *ch = CHILD(n, 0);
- int bytesmode = 0;
switch (TYPE(ch)) {
case NAME: {
@@ -2018,7 +2030,7 @@
return Name(name, Load, LINENO(n), n->n_col_offset, c->c_arena);
}
case STRING: {
- PyObject *str = parsestrplus(c, n, &bytesmode);
+ expr_ty str = parsestrplus(c, n);
if (!str) {
const char *errtype = NULL;
if (PyErr_ExceptionMatches(PyExc_UnicodeError))
@@ -2035,6 +2047,7 @@
PyOS_snprintf(buf, sizeof(buf), "(%s) %s", errtype, s);
Py_DECREF(errstr);
} else {
+ PyErr_Clear();
PyOS_snprintf(buf, sizeof(buf), "(%s) unknown error", errtype);
}
ast_error(c, n, buf);
@@ -2044,14 +2057,7 @@
}
return NULL;
}
- if (PyArena_AddPyObject(c->c_arena, str) < 0) {
- Py_DECREF(str);
- return NULL;
- }
- if (bytesmode)
- return Bytes(str, LINENO(n), n->n_col_offset, c->c_arena);
- else
- return Str(str, LINENO(n), n->n_col_offset, c->c_arena);
+ return str;
}
case NUMBER: {
PyObject *pynum = parsenumber(c, STR(ch));
@@ -3938,7 +3944,7 @@
}
static PyObject *
-decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, const char *encoding)
+decode_unicode(struct compiling *c, const char *s, size_t len, const char *encoding)
{
PyObject *v, *u;
char *buf;
@@ -3994,20 +4000,878 @@
len = p - buf;
s = buf;
}
- if (rawmode)
- v = PyUnicode_DecodeRawUnicodeEscape(s, len, NULL);
- else
- v = PyUnicode_DecodeUnicodeEscape(s, len, NULL);
+ v = PyUnicode_DecodeUnicodeEscape(s, len, NULL);
Py_XDECREF(u);
return v;
}
-/* s is a Python string literal, including the bracketing quote characters,
- * and r &/or b prefixes (if any), and embedded escape sequences (if any).
- * parsestr parses it, and returns the decoded Python string object.
- */
+/* Compile this expression in to an expr_ty. We know that we can
+ temporarily modify the character before the start of this string
+ (it's '{'), and we know we can temporarily modify the character
+ after this string (it is a '}'). Leverage this to create a
+ sub-string with enough room for us to add parens around the
+ expression. This is to allow strings with embedded newlines, for
+ example. */
+static expr_ty
+fstring_compile_expr(PyObject *str, Py_ssize_t expr_start,
+ Py_ssize_t expr_end, struct compiling *c, const node *n)
+
+{
+ PyCompilerFlags cf;
+ mod_ty mod;
+ char *utf_expr;
+ Py_ssize_t i;
+ Py_UCS4 end_ch = -1;
+ int all_whitespace;
+ PyObject *sub = NULL;
+
+ /* We only decref sub if we allocated it with a PyUnicode_Substring.
+ decref_sub records that. */
+ int decref_sub = 0;
+
+ assert(str);
+
+ assert(expr_start >= 0 && expr_start < PyUnicode_GET_LENGTH(str));
+ assert(expr_end >= 0 && expr_end < PyUnicode_GET_LENGTH(str));
+ assert(expr_end >= expr_start);
+
+ /* There has to be at least one character on each side of the
+ expression inside this str. This will have been caught before
+ we're called. */
+ assert(expr_start >= 1);
+ assert(expr_end <= PyUnicode_GET_LENGTH(str)-1);
+
+ /* If the substring is all whitespace, it's an error. We need to
+ catch this here, and not when we call PyParser_ASTFromString,
+ because turning the expression '' in to '()' would go from
+ being invalid to valid. */
+ /* Note that this code says an empty string is all
+ whitespace. That's important. There's a test for it: f'{}'. */
+ all_whitespace = 1;
+ for (i = expr_start; i < expr_end; i++) {
+ if (!Py_UNICODE_ISSPACE(PyUnicode_READ_CHAR(str, i))) {
+ all_whitespace = 0;
+ break;
+ }
+ }
+ if (all_whitespace) {
+ ast_error(c, n, "f-string: empty expression not allowed");
+ goto error;
+ }
+
+ /* If the substring will be the entire source string, we can't use
+ PyUnicode_Substring, since it will return another reference to
+ our original string. Because we're modifying the string in
+ place, that's a no-no. So, detect that case and just use our
+ string directly. */
+
+ if (expr_start-1 == 0 && expr_end+1 == PyUnicode_GET_LENGTH(str)) {
+ /* If str is well formed, then the first and last chars must
+ be '{' and '}', respectively. But, if there's a syntax
+ error, for example f'{3!', then the last char won't be a
+ closing brace. So, remember the last character we read in
+ order for us to restore it. */
+ end_ch = PyUnicode_ReadChar(str, expr_end-expr_start+1);
+ assert(end_ch != (Py_UCS4)-1);
+
+ /* In all cases, however, start_ch must be '{'. */
+ assert(PyUnicode_ReadChar(str, 0) == '{');
+
+ sub = str;
+ } else {
+ /* Create a substring object. It must be a new object, with
+ refcount==1, so that we can modify it. */
+ sub = PyUnicode_Substring(str, expr_start-1, expr_end+1);
+ if (!sub)
+ goto error;
+ assert(sub != str); /* Make sure it's a new string. */
+ decref_sub = 1; /* Remember to deallocate it on error. */
+ }
+
+ /* Put () around the expression. */
+ if (PyUnicode_WriteChar(sub, 0, '(') < 0 ||
+ PyUnicode_WriteChar(sub, expr_end-expr_start+1, ')') < 0)
+ goto error;
+
+ /* No need to free the memory returned here: it's managed by the
+ string. */
+ utf_expr = PyUnicode_AsUTF8(sub);
+ if (!utf_expr)
+ goto error;
+
+ cf.cf_flags = PyCF_ONLY_AST;
+ mod = PyParser_ASTFromString(utf_expr, "<fstring>",
+ Py_eval_input, &cf, c->c_arena);
+ if (!mod)
+ goto error;
+
+ if (sub != str)
+ /* Clear instead of decref in case we ever modify this code to change
+ the error handling: this is safest because the XDECREF won't try
+ and decref it when it's NULL. */
+ /* No need to restore the chars in sub, since we know it's getting
+ ready to get deleted (refcount must be 1, since we got a new string
+ in PyUnicode_Substring). */
+ Py_CLEAR(sub);
+ else {
+ assert(!decref_sub);
+ assert(end_ch != (Py_UCS4)-1);
+ /* Restore str, which we earlier modified directly. */
+ if (PyUnicode_WriteChar(str, 0, '{') < 0 ||
+ PyUnicode_WriteChar(str, expr_end-expr_start+1, end_ch) < 0)
+ goto error;
+ }
+ return mod->v.Expression.body;
+
+error:
+ /* Only decref sub if it was the result of a call to SubString. */
+ if (decref_sub)
+ Py_XDECREF(sub);
+
+ if (end_ch != (Py_UCS4)-1) {
+ /* We only get here if we modified str. Make sure that's the
+ case: str will be equal to sub. */
+ if (str == sub) {
+ /* Don't check the error, because we've already set the
+ error state (that's why we're in 'error', after
+ all). */
+ PyUnicode_WriteChar(str, 0, '{');
+ PyUnicode_WriteChar(str, expr_end-expr_start+1, end_ch);
+ }
+ }
+ return NULL;
+}
+
+/* Return -1 on error.
+
+ Return 0 if we reached the end of the literal.
+
+ Return 1 if we haven't reached the end of the literal, but we want
+ the caller to process the literal up to this point. Used for
+ doubled braces.
+*/
+static int
+fstring_find_literal(PyObject *str, Py_ssize_t *ofs, PyObject **literal,
+ int recurse_lvl, struct compiling *c, const node *n)
+{
+ /* Get any literal string. It ends when we hit an un-doubled brace, or the
+ end of the string. */
+
+ Py_ssize_t literal_start, literal_end;
+ int result = 0;
+
+ enum PyUnicode_Kind kind = PyUnicode_KIND(str);
+ void *data = PyUnicode_DATA(str);
+
+ assert(*literal == NULL);
+
+ literal_start = *ofs;
+ for (; *ofs < PyUnicode_GET_LENGTH(str); *ofs += 1) {
+ Py_UCS4 ch = PyUnicode_READ(kind, data, *ofs);
+ if (ch == '{' || ch == '}') {
+ /* Check for doubled braces, but only at the top level. If
+ we checked at every level, then f'{0:{3}}' would fail
+ with the two closing braces. */
+ if (recurse_lvl == 0) {
+ if (*ofs + 1 < PyUnicode_GET_LENGTH(str) &&
+ PyUnicode_READ(kind, data, *ofs + 1) == ch) {
+ /* We're going to tell the caller that the literal ends
+ here, but that they should continue scanning. But also
+ skip over the second brace when we resume scanning. */
+ literal_end = *ofs + 1;
+ *ofs += 2;
+ result = 1;
+ goto done;
+ }
+
+ /* Where a single '{' is the start of a new expression, a
+ single '}' is not allowed. */
+ if (ch == '}') {
+ ast_error(c, n, "f-string: single '}' is not allowed");
+ return -1;
+ }
+ }
+
+ /* We're either at a '{', which means we're starting another
+ expression; or a '}', which means we're at the end of this
+ f-string (for a nested format_spec). */
+ break;
+ }
+ }
+ literal_end = *ofs;
+
+ assert(*ofs == PyUnicode_GET_LENGTH(str) ||
+ PyUnicode_READ(kind, data, *ofs) == '{' ||
+ PyUnicode_READ(kind, data, *ofs) == '}');
+done:
+ if (literal_start != literal_end) {
+ *literal = PyUnicode_Substring(str, literal_start, literal_end);
+ if (!*literal)
+ return -1;
+ }
+
+ return result;
+}
+
+/* Forward declaration because parsing is recursive. */
+static expr_ty
+fstring_parse(PyObject *str, Py_ssize_t *ofs, int recurse_lvl,
+ struct compiling *c, const node *n);
+
+/* Parse the f-string str, starting at ofs. We know *ofs starts an
+ expression (so it must be a '{'). Returns the FormattedValue node,
+ which includes the expression, conversion character, and
+ format_spec expression.
+
+ Note that I don't do a perfect job here: I don't make sure that a
+ closing brace doesn't match an opening paren, for example. It
+ doesn't need to error on all invalid expressions, just correctly
+ find the end of all valid ones. Any errors inside the expression
+ will be caught when we parse it later. */
+static int
+fstring_find_expr(PyObject *str, Py_ssize_t *ofs, int recurse_lvl,
+ expr_ty *expression, struct compiling *c, const node *n)
+{
+ /* Return -1 on error, else 0. */
+
+ Py_ssize_t expr_start;
+ Py_ssize_t expr_end;
+ expr_ty simple_expression;
+ expr_ty format_spec = NULL; /* Optional format specifier. */
+ Py_UCS4 conversion = -1; /* The conversion char. -1 if not specified. */
+
+ enum PyUnicode_Kind kind = PyUnicode_KIND(str);
+ void *data = PyUnicode_DATA(str);
+
+ /* 0 if we're not in a string, else the quote char we're trying to
+ match (single or double quote). */
+ Py_UCS4 quote_char = 0;
+
+ /* If we're inside a string, 1=normal, 3=triple-quoted. */
+ int string_type = 0;
+
+ /* Keep track of nesting level for braces/parens/brackets in
+ expressions. */
+ Py_ssize_t nested_depth = 0;
+
+ /* Can only nest one level deep. */
+ if (recurse_lvl >= 2) {
+ ast_error(c, n, "f-string: expressions nested too deeply");
+ return -1;
+ }
+
+ /* The first char must be a left brace, or we wouldn't have gotten
+ here. Skip over it. */
+ assert(PyUnicode_READ(kind, data, *ofs) == '{');
+ *ofs += 1;
+
+ expr_start = *ofs;
+ for (; *ofs < PyUnicode_GET_LENGTH(str); *ofs += 1) {
+ Py_UCS4 ch;
+
+ /* Loop invariants. */
+ assert(nested_depth >= 0);
+ assert(*ofs >= expr_start);
+ if (quote_char)
+ assert(string_type == 1 || string_type == 3);
+ else
+ assert(string_type == 0);
+
+ ch = PyUnicode_READ(kind, data, *ofs);
+ if (quote_char) {
+ /* We're inside a string. See if we're at the end. */
+ /* This code needs to implement the same non-error logic
+ as tok_get from tokenizer.c, at the letter_quote
+ label. To actually share that code would be a
+ nightmare. But, it's unlikely to change and is small,
+ so duplicate it here. Note we don't need to catch all
+ of the errors, since they'll be caught when parsing the
+ expression. We just need to match the non-error
+ cases. Thus we can ignore \n in single-quoted strings,
+ for example. Or non-terminated strings. */
+ if (ch == quote_char) {
+ /* Does this match the string_type (single or triple
+ quoted)? */
+ if (string_type == 3) {
+ if (*ofs+2 < PyUnicode_GET_LENGTH(str) &&
+ PyUnicode_READ(kind, data, *ofs+1) == ch &&
+ PyUnicode_READ(kind, data, *ofs+2) == ch) {
+ /* We're at the end of a triple quoted string. */
+ *ofs += 2;
+ string_type = 0;
+ quote_char = 0;
+ continue;
+ }
+ } else {
+ /* We're at the end of a normal string. */
+ quote_char = 0;
+ string_type = 0;
+ continue;
+ }
+ }
+ /* We're inside a string, and not finished with the
+ string. If this is a backslash, skip the next char (it
+ might be an end quote that needs skipping). Otherwise,
+ just consume this character normally. */
+ if (ch == '\\' && *ofs+1 < PyUnicode_GET_LENGTH(str)) {
+ /* Just skip the next char, whatever it is. */
+ *ofs += 1;
+ }
+ } else if (ch == '\'' || ch == '"') {
+ /* Is this a triple quoted string? */
+ if (*ofs+2 < PyUnicode_GET_LENGTH(str) &&
+ PyUnicode_READ(kind, data, *ofs+1) == ch &&
+ PyUnicode_READ(kind, data, *ofs+2) == ch) {
+ string_type = 3;
+ *ofs += 2;
+ } else {
+ /* Start of a normal string. */
+ string_type = 1;
+ }
+ /* Start looking for the end of the string. */
+ quote_char = ch;
+ } else if (ch == '[' || ch == '{' || ch == '(') {
+ nested_depth++;
+ } else if (nested_depth != 0 &&
+ (ch == ']' || ch == '}' || ch == ')')) {
+ nested_depth--;
+ } else if (ch == '#') {
+ /* Error: can't include a comment character, inside parens
+ or not. */
+ ast_error(c, n, "f-string cannot include '#'");
+ return -1;
+ } else if (nested_depth == 0 &&
+ (ch == '!' || ch == ':' || ch == '}')) {
+ /* First, test for the special case of "!=". Since '=' is
+ not an allowed conversion character, nothing is lost in
+ this test. */
+ if (ch == '!' && *ofs+1 < PyUnicode_GET_LENGTH(str) &&
+ PyUnicode_READ(kind, data, *ofs+1) == '=')
+ /* This isn't a conversion character, just continue. */
+ continue;
+
+ /* Normal way out of this loop. */
+ break;
+ } else {
+ /* Just consume this char and loop around. */
+ }
+ }
+ expr_end = *ofs;
+ /* If we leave this loop in a string or with mismatched parens, we
+ don't care. We'll get a syntax error when compiling the
+ expression. But, we can produce a better error message, so
+ let's just do that.*/
+ if (quote_char) {
+ ast_error(c, n, "f-string: unterminated string");
+ return -1;
+ }
+ if (nested_depth) {
+ ast_error(c, n, "f-string: mismatched '(', '{', or '['");
+ return -1;
+ }
+
+ if (*ofs >= PyUnicode_GET_LENGTH(str))
+ goto unexpected_end_of_string;
+
+ /* Compile the expression as soon as possible, so we show errors
+ related to the expression before errors related to the
+ conversion or format_spec. */
+ simple_expression = fstring_compile_expr(str, expr_start, expr_end, c, n);
+ if (!simple_expression)
+ return -1;
+
+ /* Check for a conversion char, if present. */
+ if (PyUnicode_READ(kind, data, *ofs) == '!') {
+ *ofs += 1;
+ if (*ofs >= PyUnicode_GET_LENGTH(str))
+ goto unexpected_end_of_string;
+
+ conversion = PyUnicode_READ(kind, data, *ofs);
+ *ofs += 1;
+
+ /* Validate the conversion. */
+ if (!(conversion == 's' || conversion == 'r'
+ || conversion == 'a')) {
+ ast_error(c, n, "f-string: invalid conversion character: "
+ "expected 's', 'r', or 'a'");
+ return -1;
+ }
+ }
+
+ /* Check for the format spec, if present. */
+ if (*ofs >= PyUnicode_GET_LENGTH(str))
+ goto unexpected_end_of_string;
+ if (PyUnicode_READ(kind, data, *ofs) == ':') {
+ *ofs += 1;
+ if (*ofs >= PyUnicode_GET_LENGTH(str))
+ goto unexpected_end_of_string;
+
+ /* Parse the format spec. */
+ format_spec = fstring_parse(str, ofs, recurse_lvl+1, c, n);
+ if (!format_spec)
+ return -1;
+ }
+
+ if (*ofs >= PyUnicode_GET_LENGTH(str) ||
+ PyUnicode_READ(kind, data, *ofs) != '}')
+ goto unexpected_end_of_string;
+
+ /* We're at a right brace. Consume it. */
+ assert(*ofs < PyUnicode_GET_LENGTH(str));
+ assert(PyUnicode_READ(kind, data, *ofs) == '}');
+ *ofs += 1;
+
+ /* And now create the FormattedValue node that represents this entire
+ expression with the conversion and format spec. */
+ *expression = FormattedValue(simple_expression, (int)conversion,
+ format_spec, LINENO(n), n->n_col_offset,
+ c->c_arena);
+ if (!*expression)
+ return -1;
+
+ return 0;
+
+unexpected_end_of_string:
+ ast_error(c, n, "f-string: expecting '}'");
+ return -1;
+}
+
+/* Return -1 on error.
+
+ Return 0 if we have a literal (possible zero length) and an
+ expression (zero length if at the end of the string.
+
+ Return 1 if we have a literal, but no expression, and we want the
+ caller to call us again. This is used to deal with doubled
+ braces.
+
+ When called multiple times on the string 'a{{b{0}c', this function
+ will return:
+
+ 1. the literal 'a{' with no expression, and a return value
+ of 1. Despite the fact that there's no expression, the return
+ value of 1 means we're not finished yet.
+
+ 2. the literal 'b' and the expression '0', with a return value of
+ 0. The fact that there's an expression means we're not finished.
+
+ 3. literal 'c' with no expression and a return value of 0. The
+ combination of the return value of 0 with no expression means
+ we're finished.
+*/
+static int
+fstring_find_literal_and_expr(PyObject *str, Py_ssize_t *ofs, int recurse_lvl,
+ PyObject **literal, expr_ty *expression,
+ struct compiling *c, const node *n)
+{
+ int result;
+
+ assert(*literal == NULL && *expression == NULL);
+
+ /* Get any literal string. */
+ result = fstring_find_literal(str, ofs, literal, recurse_lvl, c, n);
+ if (result < 0)
+ goto error;
+
+ assert(result == 0 || result == 1);
+
+ if (result == 1)
+ /* We have a literal, but don't look at the expression. */
+ return 1;
+
+ assert(*ofs <= PyUnicode_GET_LENGTH(str));
+
+ if (*ofs >= PyUnicode_GET_LENGTH(str) ||
+ PyUnicode_READ_CHAR(str, *ofs) == '}')
+ /* We're at the end of the string or the end of a nested
+ f-string: no expression. The top-level error case where we
+ expect to be at the end of the string but we're at a '}' is
+ handled later. */
+ return 0;
+
+ /* We must now be the start of an expression, on a '{'. */
+ assert(*ofs < PyUnicode_GET_LENGTH(str) &&
+ PyUnicode_READ_CHAR(str, *ofs) == '{');
+
+ if (fstring_find_expr(str, ofs, recurse_lvl, expression, c, n) < 0)
+ goto error;
+
+ return 0;
+
+error:
+ Py_XDECREF(*literal);
+ *literal = NULL;
+ return -1;
+}
+
+#define EXPRLIST_N_CACHED 64
+
+typedef struct {
+ /* Incrementally build an array of expr_ty, so be used in an
+ asdl_seq. Cache some small but reasonably sized number of
+ expr_ty's, and then after that start dynamically allocating,
+ doubling the number allocated each time. Note that the f-string
+ f'{0}a{1}' contains 3 expr_ty's: 2 FormattedValue's, and one
+ Str for the literal 'a'. So you add expr_ty's about twice as
+ fast as you add exressions in an f-string. */
+
+ Py_ssize_t allocated; /* Number we've allocated. */
+ Py_ssize_t size; /* Number we've used. */
+ expr_ty *p; /* Pointer to the memory we're actually
+ using. Will point to 'data' until we
+ start dynamically allocating. */
+ expr_ty data[EXPRLIST_N_CACHED];
+} ExprList;
+
+#ifdef NDEBUG
+#define ExprList_check_invariants(l)
+#else
+static void
+ExprList_check_invariants(ExprList *l)
+{
+ /* Check our invariants. Make sure this object is "live", and
+ hasn't been deallocated. */
+ assert(l->size >= 0);
+ assert(l->p != NULL);
+ if (l->size <= EXPRLIST_N_CACHED)
+ assert(l->data == l->p);
+}
+#endif
+
+static void
+ExprList_Init(ExprList *l)
+{
+ l->allocated = EXPRLIST_N_CACHED;
+ l->size = 0;
+
+ /* Until we start allocating dynamically, p points to data. */
+ l->p = l->data;
+
+ ExprList_check_invariants(l);
+}
+
+static int
+ExprList_Append(ExprList *l, expr_ty exp)
+{
+ ExprList_check_invariants(l);
+ if (l->size >= l->allocated) {
+ /* We need to alloc (or realloc) the memory. */
+ Py_ssize_t new_size = l->allocated * 2;
+
+ /* See if we've ever allocated anything dynamically. */
+ if (l->p == l->data) {
+ Py_ssize_t i;
+ /* We're still using the cached data. Switch to
+ alloc-ing. */
+ l->p = PyMem_RawMalloc(sizeof(expr_ty) * new_size);
+ if (!l->p)
+ return -1;
+ /* Copy the cached data into the new buffer. */
+ for (i = 0; i < l->size; i++)
+ l->p[i] = l->data[i];
+ } else {
+ /* Just realloc. */
+ expr_ty *tmp = PyMem_RawRealloc(l->p, sizeof(expr_ty) * new_size);
+ if (!tmp) {
+ PyMem_RawFree(l->p);
+ l->p = NULL;
+ return -1;
+ }
+ l->p = tmp;
+ }
+
+ l->allocated = new_size;
+ assert(l->allocated == 2 * l->size);
+ }
+
+ l->p[l->size++] = exp;
+
+ ExprList_check_invariants(l);
+ return 0;
+}
+
+static void
+ExprList_Dealloc(ExprList *l)
+{
+ ExprList_check_invariants(l);
+
+ /* If there's been an error, or we've never dynamically allocated,
+ do nothing. */
+ if (!l->p || l->p == l->data) {
+ /* Do nothing. */
+ } else {
+ /* We have dynamically allocated. Free the memory. */
+ PyMem_RawFree(l->p);
+ }
+ l->p = NULL;
+ l->size = -1;
+}
+
+static asdl_seq *
+ExprList_Finish(ExprList *l, PyArena *arena)
+{
+ asdl_seq *seq;
+
+ ExprList_check_invariants(l);
+
+ /* Allocate the asdl_seq and copy the expressions in to it. */
+ seq = _Py_asdl_seq_new(l->size, arena);
+ if (seq) {
+ Py_ssize_t i;
+ for (i = 0; i < l->size; i++)
+ asdl_seq_SET(seq, i, l->p[i]);
+ }
+ ExprList_Dealloc(l);
+ return seq;
+}
+
+/* The FstringParser is designed to add a mix of strings and
+ f-strings, and concat them together as needed. Ultimately, it
+ generates an expr_ty. */
+typedef struct {
+ PyObject *last_str;
+ ExprList expr_list;
+} FstringParser;
+
+#ifdef NDEBUG
+#define FstringParser_check_invariants(state)
+#else
+static void
+FstringParser_check_invariants(FstringParser *state)
+{
+ if (state->last_str)
+ assert(PyUnicode_CheckExact(state->last_str));
+ ExprList_check_invariants(&state->expr_list);
+}
+#endif
+
+static void
+FstringParser_Init(FstringParser *state)
+{
+ state->last_str = NULL;
+ ExprList_Init(&state->expr_list);
+ FstringParser_check_invariants(state);
+}
+
+static void
+FstringParser_Dealloc(FstringParser *state)
+{
+ FstringParser_check_invariants(state);
+
+ Py_XDECREF(state->last_str);
+ ExprList_Dealloc(&state->expr_list);
+}
+
+/* Make a Str node, but decref the PyUnicode object being added. */
+static expr_ty
+make_str_node_and_del(PyObject **str, struct compiling *c, const node* n)
+{
+ PyObject *s = *str;
+ *str = NULL;
+ assert(PyUnicode_CheckExact(s));
+ if (PyArena_AddPyObject(c->c_arena, s) < 0) {
+ Py_DECREF(s);
+ return NULL;
+ }
+ return Str(s, LINENO(n), n->n_col_offset, c->c_arena);
+}
+
+/* Add a non-f-string (that is, a regular literal string). str is
+ decref'd. */
+static int
+FstringParser_ConcatAndDel(FstringParser *state, PyObject *str)
+{
+ FstringParser_check_invariants(state);
+
+ assert(PyUnicode_CheckExact(str));
+
+ if (PyUnicode_GET_LENGTH(str) == 0) {
+ Py_DECREF(str);
+ return 0;
+ }
+
+ if (!state->last_str) {
+ /* We didn't have a string before, so just remember this one. */
+ state->last_str = str;
+ } else {
+ /* Concatenate this with the previous string. */
+ PyObject *temp = PyUnicode_Concat(state->last_str, str);
+ Py_DECREF(state->last_str);
+ Py_DECREF(str);
+ state->last_str = temp;
+ if (!temp)
+ return -1;
+ }
+ FstringParser_check_invariants(state);
+ return 0;
+}
+
+/* Parse an f-string. The f-string is in str, starting at ofs, with no 'f'
+ or quotes. str is not decref'd, since we don't know if it's used elsewhere.
+ And if we're only looking at a part of a string, then decref'ing is
+ definitely not the right thing to do! */
+static int
+FstringParser_ConcatFstring(FstringParser *state, PyObject *str,
+ Py_ssize_t *ofs, int recurse_lvl,
+ struct compiling *c, const node *n)
+{
+ FstringParser_check_invariants(state);
+
+ /* Parse the f-string. */
+ while (1) {
+ PyObject *literal = NULL;
+ expr_ty expression = NULL;
+
+ /* If there's a zero length literal in front of the
+ expression, literal will be NULL. If we're at the end of
+ the f-string, expression will be NULL (unless result == 1,
+ see below). */
+ int result = fstring_find_literal_and_expr(str, ofs, recurse_lvl,
+ &literal, &expression,
+ c, n);
+ if (result < 0)
+ return -1;
+
+ /* Add the literal, if any. */
+ if (!literal) {
+ /* Do nothing. Just leave last_str alone (and possibly
+ NULL). */
+ } else if (!state->last_str) {
+ state->last_str = literal;
+ literal = NULL;
+ } else {
+ /* We have a literal, concatenate it. */
+ assert(PyUnicode_GET_LENGTH(literal) != 0);
+ if (FstringParser_ConcatAndDel(state, literal) < 0)
+ return -1;
+ literal = NULL;
+ }
+ assert(!state->last_str ||
+ PyUnicode_GET_LENGTH(state->last_str) != 0);
+
+ /* We've dealt with the literal now. It can't be leaked on further
+ errors. */
+ assert(literal == NULL);
+
+ /* See if we should just loop around to get the next literal
+ and expression, while ignoring the expression this
+ time. This is used for un-doubling braces, as an
+ optimization. */
+ if (result == 1)
+ continue;
+
+ if (!expression)
+ /* We're done with this f-string. */
+ break;
+
+ /* We know we have an expression. Convert any existing string
+ to a Str node. */
+ if (!state->last_str) {
+ /* Do nothing. No previous literal. */
+ } else {
+ /* Convert the existing last_str literal to a Str node. */
+ expr_ty str = make_str_node_and_del(&state->last_str, c, n);
+ if (!str || ExprList_Append(&state->expr_list, str) < 0)
+ return -1;
+ }
+
+ if (ExprList_Append(&state->expr_list, expression) < 0)
+ return -1;
+ }
+
+ assert(*ofs <= PyUnicode_GET_LENGTH(str));
+
+ /* If recurse_lvl is zero, then we must be at the end of the
+ string. Otherwise, we must be at a right brace. */
+
+ if (recurse_lvl == 0 && *ofs < PyUnicode_GET_LENGTH(str)) {
+ ast_error(c, n, "f-string: unexpected end of string");
+ return -1;
+ }
+ if (recurse_lvl != 0 && PyUnicode_READ_CHAR(str, *ofs) != '}') {
+ ast_error(c, n, "f-string: expecting '}'");
+ return -1;
+ }
+
+ FstringParser_check_invariants(state);
+ return 0;
+}
+
+/* Convert the partial state reflected in last_str and expr_list to an
+ expr_ty. The expr_ty can be a Str, or a JoinedStr. */
+static expr_ty
+FstringParser_Finish(FstringParser *state, struct compiling *c,
+ const node *n)
+{
+ asdl_seq *seq;
+
+ FstringParser_check_invariants(state);
+
+ /* If we're just a constant string with no expressions, return
+ that. */
+ if(state->expr_list.size == 0) {
+ if (!state->last_str) {
+ /* Create a zero length string. */
+ state->last_str = PyUnicode_FromStringAndSize(NULL, 0);
+ if (!state->last_str)
+ goto error;
+ }
+ return make_str_node_and_del(&state->last_str, c, n);
+ }
+
+ /* Create a Str node out of last_str, if needed. It will be the
+ last node in our expression list. */
+ if (state->last_str) {
+ expr_ty str = make_str_node_and_del(&state->last_str, c, n);
+ if (!str || ExprList_Append(&state->expr_list, str) < 0)
+ goto error;
+ }
+ /* This has already been freed. */
+ assert(state->last_str == NULL);
+
+ seq = ExprList_Finish(&state->expr_list, c->c_arena);
+ if (!seq)
+ goto error;
+
+ /* If there's only one expression, return it. Otherwise, we need
+ to join them together. */
+ if (seq->size == 1)
+ return seq->elements[0];
+
+ return JoinedStr(seq, LINENO(n), n->n_col_offset, c->c_arena);
+
+error:
+ FstringParser_Dealloc(state);
+ return NULL;
+}
+
+/* Given an f-string (with no 'f' or quotes) that's in str starting at
+ ofs, parse it into an expr_ty. Return NULL on error. Does not
+ decref str. */
+static expr_ty
+fstring_parse(PyObject *str, Py_ssize_t *ofs, int recurse_lvl,
+ struct compiling *c, const node *n)
+{
+ FstringParser state;
+
+ FstringParser_Init(&state);
+ if (FstringParser_ConcatFstring(&state, str, ofs, recurse_lvl,
+ c, n) < 0) {
+ FstringParser_Dealloc(&state);
+ return NULL;
+ }
+
+ return FstringParser_Finish(&state, c, n);
+}
+
+/* n is a Python string literal, including the bracketing quote
+ characters, and r, b, u, &/or f prefixes (if any), and embedded
+ escape sequences (if any). parsestr parses it, and returns the
+ decoded Python string object. If the string is an f-string, set
+ *fmode and return the unparsed string object.
+*/
static PyObject *
-parsestr(struct compiling *c, const node *n, int *bytesmode)
+parsestr(struct compiling *c, const node *n, int *bytesmode, int *fmode)
{
size_t len;
const char *s = STR(n);
@@ -4027,15 +4891,24 @@
quote = *++s;
rawmode = 1;
}
+ else if (quote == 'f' || quote == 'F') {
+ quote = *++s;
+ *fmode = 1;
+ }
else {
break;
}
}
}
+ if (*fmode && *bytesmode) {
+ PyErr_BadInternalCall();
+ return NULL;
+ }
if (quote != '\'' && quote != '\"') {
PyErr_BadInternalCall();
return NULL;
}
+ /* Skip the leading quote char. */
s++;
len = strlen(s);
if (len > INT_MAX) {
@@ -4044,19 +4917,24 @@
return NULL;
}
if (s[--len] != quote) {
+ /* Last quote char must match the first. */
PyErr_BadInternalCall();
return NULL;
}
if (len >= 4 && s[0] == quote && s[1] == quote) {
+ /* A triple quoted string. We've already skipped one quote at
+ the start and one at the end of the string. Now skip the
+ two at the start. */
s += 2;
len -= 2;
+ /* And check that the last two match. */
if (s[--len] != quote || s[--len] != quote) {
PyErr_BadInternalCall();
return NULL;
}
}
if (!*bytesmode && !rawmode) {
- return decode_unicode(c, s, len, rawmode, c->c_encoding);
+ return decode_unicode(c, s, len, c->c_encoding);
}
if (*bytesmode) {
/* Disallow non-ascii characters (but not escapes) */
@@ -4088,51 +4966,84 @@
}
}
return PyBytes_DecodeEscape(s, len, NULL, 1,
- need_encoding ? c->c_encoding : NULL);
+ need_encoding ? c->c_encoding : NULL);
}
-/* Build a Python string object out of a STRING+ atom. This takes care of
- * compile-time literal catenation, calling parsestr() on each piece, and
- * pasting the intermediate results together.
- */
-static PyObject *
-parsestrplus(struct compiling *c, const node *n, int *bytesmode)
+/* Accepts a STRING+ atom, and produces an expr_ty node. Run through
+ each STRING atom, and process it as needed. For bytes, just
+ concatenate them together, and the result will be a Bytes node. For
+ normal strings and f-strings, concatenate them together. The result
+ will be a Str node if there were no f-strings; a FormattedValue
+ node if there's just an f-string (with no leading or trailing
+ literals), or a JoinedStr node if there are multiple f-strings or
+ any literals involved. */
+static expr_ty
+parsestrplus(struct compiling *c, const node *n)
{
- PyObject *v;
+ int bytesmode = 0;
+ PyObject *bytes_str = NULL;
int i;
- REQ(CHILD(n, 0), STRING);
- v = parsestr(c, CHILD(n, 0), bytesmode);
- if (v != NULL) {
- /* String literal concatenation */
- for (i = 1; i < NCH(n); i++) {
- PyObject *s;
- int subbm = 0;
- s = parsestr(c, CHILD(n, i), &subbm);
- if (s == NULL)
- goto onError;
- if (*bytesmode != subbm) {
- ast_error(c, n, "cannot mix bytes and nonbytes literals");
- Py_DECREF(s);
- goto onError;
+
+ FstringParser state;
+ FstringParser_Init(&state);
+
+ for (i = 0; i < NCH(n); i++) {
+ int this_bytesmode = 0;
+ int this_fmode = 0;
+ PyObject *s;
+
+ REQ(CHILD(n, i), STRING);
+ s = parsestr(c, CHILD(n, i), &this_bytesmode, &this_fmode);
+ if (!s)
+ goto error;
+
+ /* Check that we're not mixing bytes with unicode. */
+ if (i != 0 && bytesmode != this_bytesmode) {
+ ast_error(c, n, "cannot mix bytes and nonbytes literals");
+ Py_DECREF(s);
+ goto error;
+ }
+ bytesmode = this_bytesmode;
+
+ assert(bytesmode ? PyBytes_CheckExact(s) : PyUnicode_CheckExact(s));
+
+ if (bytesmode) {
+ /* For bytes, concat as we go. */
+ if (i == 0) {
+ /* First time, just remember this value. */
+ bytes_str = s;
+ } else {
+ PyBytes_ConcatAndDel(&bytes_str, s);
+ if (!bytes_str)
+ goto error;
}
- if (PyBytes_Check(v) && PyBytes_Check(s)) {
- PyBytes_ConcatAndDel(&v, s);
- if (v == NULL)
- goto onError;
- }
- else {
- PyObject *temp = PyUnicode_Concat(v, s);
- Py_DECREF(s);
- Py_DECREF(v);
- v = temp;
- if (v == NULL)
- goto onError;
- }
+ } else if (this_fmode) {
+ /* This is an f-string. Concatenate and decref it. */
+ Py_ssize_t ofs = 0;
+ int result = FstringParser_ConcatFstring(&state, s, &ofs, 0, c, n);
+ Py_DECREF(s);
+ if (result < 0)
+ goto error;
+ } else {
+ /* This is a regular string. Concatenate it. */
+ if (FstringParser_ConcatAndDel(&state, s) < 0)
+ goto error;
}
}
- return v;
+ if (bytesmode) {
+ /* Just return the bytes object and we're done. */
+ if (PyArena_AddPyObject(c->c_arena, bytes_str) < 0)
+ goto error;
+ return Bytes(bytes_str, LINENO(n), n->n_col_offset, c->c_arena);
+ }
- onError:
- Py_XDECREF(v);
+ /* We're not a bytes string, bytes_str should never have been set. */
+ assert(bytes_str == NULL);
+
+ return FstringParser_Finish(&state, c, n);
+
+error:
+ Py_XDECREF(bytes_str);
+ FstringParser_Dealloc(&state);
return NULL;
}
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 7f7d051..3b70718 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -331,7 +331,7 @@
Py_DECREF(it);
return NULL;
}
- if (cmp == 1) {
+ if (cmp > 0) {
Py_DECREF(it);
Py_RETURN_TRUE;
}
@@ -469,6 +469,7 @@
PyObject *it = lz->it;
long ok;
PyObject *(*iternext)(PyObject *);
+ int checktrue = lz->func == Py_None || lz->func == (PyObject *)&PyBool_Type;
iternext = *Py_TYPE(it)->tp_iternext;
for (;;) {
@@ -476,12 +477,11 @@
if (item == NULL)
return NULL;
- if (lz->func == Py_None || lz->func == (PyObject *)&PyBool_Type) {
+ if (checktrue) {
ok = PyObject_IsTrue(item);
} else {
PyObject *good;
- good = PyObject_CallFunctionObjArgs(lz->func,
- item, NULL);
+ good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
if (good == NULL) {
Py_DECREF(item);
return NULL;
@@ -1158,13 +1158,14 @@
PyObject *result;
Py_ssize_t numargs, i;
- numargs = PyTuple_Size(lz->iters);
+ numargs = PyTuple_GET_SIZE(lz->iters);
argtuple = PyTuple_New(numargs);
if (argtuple == NULL)
return NULL;
for (i=0 ; i<numargs ; i++) {
- val = PyIter_Next(PyTuple_GET_ITEM(lz->iters, i));
+ PyObject *it = PyTuple_GET_ITEM(lz->iters, i);
+ val = Py_TYPE(it)->tp_iternext(it);
if (val == NULL) {
Py_DECREF(argtuple);
return NULL;
diff --git a/Python/compile.c b/Python/compile.c
index 97bb12e..3a49ece 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -731,6 +731,7 @@
return 1;
}
+
/* Allocate a new block and return a pointer to it.
Returns NULL on error.
*/
@@ -3209,6 +3210,117 @@
e->v.Call.keywords);
}
+static int
+compiler_joined_str(struct compiler *c, expr_ty e)
+{
+ /* Concatenate parts of a string using ''.join(parts). There are
+ probably better ways of doing this.
+
+ This is used for constructs like "'x=' f'{42}'", which have to
+ be evaluated at compile time. */
+
+ static PyObject *empty_string;
+ static PyObject *join_string;
+
+ if (!empty_string) {
+ empty_string = PyUnicode_FromString("");
+ if (!empty_string)
+ return 0;
+ }
+ if (!join_string) {
+ join_string = PyUnicode_FromString("join");
+ if (!join_string)
+ return 0;
+ }
+
+ ADDOP_O(c, LOAD_CONST, empty_string, consts);
+ ADDOP_NAME(c, LOAD_ATTR, join_string, names);
+ VISIT_SEQ(c, expr, e->v.JoinedStr.values);
+ ADDOP_I(c, BUILD_LIST, asdl_seq_LEN(e->v.JoinedStr.values));
+ ADDOP_I(c, CALL_FUNCTION, 1);
+ return 1;
+}
+
+/* Note that this code uses the builtin functions format(), str(),
+ repr(), and ascii(). You can break this code, or make it do odd
+ things, by redefining those functions. */
+static int
+compiler_formatted_value(struct compiler *c, expr_ty e)
+{
+ PyObject *conversion_name = NULL;
+
+ static PyObject *format_string;
+ static PyObject *str_string;
+ static PyObject *repr_string;
+ static PyObject *ascii_string;
+
+ if (!format_string) {
+ format_string = PyUnicode_InternFromString("format");
+ if (!format_string)
+ return 0;
+ }
+
+ if (!str_string) {
+ str_string = PyUnicode_InternFromString("str");
+ if (!str_string)
+ return 0;
+ }
+
+ if (!repr_string) {
+ repr_string = PyUnicode_InternFromString("repr");
+ if (!repr_string)
+ return 0;
+ }
+ if (!ascii_string) {
+ ascii_string = PyUnicode_InternFromString("ascii");
+ if (!ascii_string)
+ return 0;
+ }
+
+ ADDOP_NAME(c, LOAD_GLOBAL, format_string, names);
+
+ /* If needed, convert via str, repr, or ascii. */
+ if (e->v.FormattedValue.conversion != -1) {
+ switch (e->v.FormattedValue.conversion) {
+ case 's':
+ conversion_name = str_string;
+ break;
+ case 'r':
+ conversion_name = repr_string;
+ break;
+ case 'a':
+ conversion_name = ascii_string;
+ break;
+ default:
+ PyErr_SetString(PyExc_SystemError,
+ "Unrecognized conversion character");
+ return 0;
+ }
+ ADDOP_NAME(c, LOAD_GLOBAL, conversion_name, names);
+ }
+
+ /* Evaluate the value. */
+ VISIT(c, expr, e->v.FormattedValue.value);
+
+ /* If needed, convert via str, repr, or ascii. */
+ if (conversion_name) {
+ /* Call the function we previously pushed. */
+ ADDOP_I(c, CALL_FUNCTION, 1);
+ }
+
+ /* If we have a format spec, use format(value, format_spec). Otherwise,
+ use the single argument form. */
+ if (e->v.FormattedValue.format_spec) {
+ VISIT(c, expr, e->v.FormattedValue.format_spec);
+ ADDOP_I(c, CALL_FUNCTION, 2);
+ } else {
+ /* No format spec specified, call format(value). */
+ ADDOP_I(c, CALL_FUNCTION, 1);
+ }
+
+ return 1;
+}
+
/* shared code between compiler_call and compiler_class */
static int
compiler_call_helper(struct compiler *c,
@@ -3628,9 +3740,9 @@
BLOCK
finally:
if an exception was raised:
- exc = copy of (exception, instance, traceback)
+ exc = copy of (exception, instance, traceback)
else:
- exc = (None, None, None)
+ exc = (None, None, None)
if not (await exit(*exc)):
raise
*/
@@ -3878,6 +3990,10 @@
case Str_kind:
ADDOP_O(c, LOAD_CONST, e->v.Str.s, consts);
break;
+ case JoinedStr_kind:
+ return compiler_joined_str(c, e);
+ case FormattedValue_kind:
+ return compiler_formatted_value(c, e);
case Bytes_kind:
ADDOP_O(c, LOAD_CONST, e->v.Bytes.s, consts);
break;
@@ -4784,4 +4900,3 @@
{
return PyAST_CompileEx(mod, filename, flags, -1, arena);
}
-
diff --git a/Python/graminit.c b/Python/graminit.c
index 8212b2a..354dc12 100644
--- a/Python/graminit.c
+++ b/Python/graminit.c
@@ -204,11 +204,13 @@
{32, 7},
{0, 6},
};
-static arc arcs_9_7[2] = {
+static arc arcs_9_7[3] = {
{30, 12},
{34, 3},
+ {0, 7},
};
-static arc arcs_9_8[1] = {
+static arc arcs_9_8[2] = {
+ {32, 13},
{0, 8},
};
static arc arcs_9_9[2] = {
@@ -221,35 +223,39 @@
{0, 10},
};
static arc arcs_9_11[3] = {
- {30, 13},
- {32, 14},
+ {30, 14},
+ {32, 15},
{0, 11},
};
static arc arcs_9_12[3] = {
{32, 7},
- {31, 15},
+ {31, 16},
{0, 12},
};
-static arc arcs_9_13[2] = {
- {32, 14},
+static arc arcs_9_13[1] = {
{0, 13},
};
static arc arcs_9_14[2] = {
- {30, 16},
- {34, 3},
+ {32, 15},
+ {0, 14},
};
-static arc arcs_9_15[1] = {
+static arc arcs_9_15[3] = {
+ {30, 17},
+ {34, 3},
+ {0, 15},
+};
+static arc arcs_9_16[1] = {
{26, 6},
};
-static arc arcs_9_16[3] = {
- {32, 14},
- {31, 17},
- {0, 16},
+static arc arcs_9_17[3] = {
+ {32, 15},
+ {31, 18},
+ {0, 17},
};
-static arc arcs_9_17[1] = {
- {26, 13},
+static arc arcs_9_18[1] = {
+ {26, 14},
};
-static state states_9[18] = {
+static state states_9[19] = {
{3, arcs_9_0},
{3, arcs_9_1},
{3, arcs_9_2},
@@ -257,17 +263,18 @@
{1, arcs_9_4},
{4, arcs_9_5},
{2, arcs_9_6},
- {2, arcs_9_7},
- {1, arcs_9_8},
+ {3, arcs_9_7},
+ {2, arcs_9_8},
{2, arcs_9_9},
{3, arcs_9_10},
{3, arcs_9_11},
{3, arcs_9_12},
- {2, arcs_9_13},
+ {1, arcs_9_13},
{2, arcs_9_14},
- {1, arcs_9_15},
- {3, arcs_9_16},
- {1, arcs_9_17},
+ {3, arcs_9_15},
+ {1, arcs_9_16},
+ {3, arcs_9_17},
+ {1, arcs_9_18},
};
static arc arcs_10_0[1] = {
{23, 1},
@@ -319,11 +326,13 @@
{32, 7},
{0, 6},
};
-static arc arcs_11_7[2] = {
+static arc arcs_11_7[3] = {
{36, 12},
{34, 3},
+ {0, 7},
};
-static arc arcs_11_8[1] = {
+static arc arcs_11_8[2] = {
+ {32, 13},
{0, 8},
};
static arc arcs_11_9[2] = {
@@ -336,35 +345,39 @@
{0, 10},
};
static arc arcs_11_11[3] = {
- {36, 13},
- {32, 14},
+ {36, 14},
+ {32, 15},
{0, 11},
};
static arc arcs_11_12[3] = {
{32, 7},
- {31, 15},
+ {31, 16},
{0, 12},
};
-static arc arcs_11_13[2] = {
- {32, 14},
+static arc arcs_11_13[1] = {
{0, 13},
};
static arc arcs_11_14[2] = {
- {36, 16},
- {34, 3},
+ {32, 15},
+ {0, 14},
};
-static arc arcs_11_15[1] = {
+static arc arcs_11_15[3] = {
+ {36, 17},
+ {34, 3},
+ {0, 15},
+};
+static arc arcs_11_16[1] = {
{26, 6},
};
-static arc arcs_11_16[3] = {
- {32, 14},
- {31, 17},
- {0, 16},
+static arc arcs_11_17[3] = {
+ {32, 15},
+ {31, 18},
+ {0, 17},
};
-static arc arcs_11_17[1] = {
- {26, 13},
+static arc arcs_11_18[1] = {
+ {26, 14},
};
-static state states_11[18] = {
+static state states_11[19] = {
{3, arcs_11_0},
{3, arcs_11_1},
{3, arcs_11_2},
@@ -372,17 +385,18 @@
{1, arcs_11_4},
{4, arcs_11_5},
{2, arcs_11_6},
- {2, arcs_11_7},
- {1, arcs_11_8},
+ {3, arcs_11_7},
+ {2, arcs_11_8},
{2, arcs_11_9},
{3, arcs_11_10},
{3, arcs_11_11},
{3, arcs_11_12},
- {2, arcs_11_13},
+ {1, arcs_11_13},
{2, arcs_11_14},
- {1, arcs_11_15},
- {3, arcs_11_16},
- {1, arcs_11_17},
+ {3, arcs_11_15},
+ {1, arcs_11_16},
+ {3, arcs_11_17},
+ {1, arcs_11_18},
};
static arc arcs_12_0[1] = {
{23, 1},
@@ -1879,11 +1893,11 @@
"\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{264, "parameters", 0, 4, states_8,
"\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
- {265, "typedargslist", 0, 18, states_9,
+ {265, "typedargslist", 0, 19, states_9,
"\000\000\200\000\006\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{266, "tfpdef", 0, 4, states_10,
"\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
- {267, "varargslist", 0, 18, states_11,
+ {267, "varargslist", 0, 19, states_11,
"\000\000\200\000\006\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
{268, "vfpdef", 0, 2, states_12,
"\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"},
diff --git a/Python/importlib_external.h b/Python/importlib_external.h
index b20ce17..c4b6dc9 100644
--- a/Python/importlib_external.h
+++ b/Python/importlib_external.h
@@ -1,8 +1,8 @@
/* Auto-generated by Programs/_freeze_importlib.c */
const unsigned char _Py_M__importlib_external[] = {
99,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,
- 0,64,0,0,0,115,228,2,0,0,100,0,0,90,0,0,
- 100,96,0,90,1,0,100,4,0,100,5,0,132,0,0,90,
+ 0,64,0,0,0,115,210,2,0,0,100,0,0,90,0,0,
+ 100,92,0,90,1,0,100,4,0,100,5,0,132,0,0,90,
2,0,100,6,0,100,7,0,132,0,0,90,3,0,100,8,
0,100,9,0,132,0,0,90,4,0,100,10,0,100,11,0,
132,0,0,90,5,0,100,12,0,100,13,0,132,0,0,90,
@@ -20,563 +20,541 @@
1,1,90,26,0,100,37,0,100,38,0,132,0,0,90,27,
0,100,39,0,100,40,0,132,0,0,90,28,0,100,41,0,
100,42,0,132,0,0,90,29,0,100,43,0,100,44,0,132,
- 0,0,90,30,0,100,45,0,100,46,0,100,47,0,100,48,
- 0,132,0,1,90,31,0,100,49,0,100,50,0,132,0,0,
- 90,32,0,100,51,0,100,52,0,132,0,0,90,33,0,100,
- 33,0,100,33,0,100,33,0,100,53,0,100,54,0,132,3,
- 0,90,34,0,100,33,0,100,33,0,100,33,0,100,55,0,
- 100,56,0,132,3,0,90,35,0,100,57,0,100,57,0,100,
- 58,0,100,59,0,132,2,0,90,36,0,100,60,0,100,61,
- 0,132,0,0,90,37,0,101,38,0,131,0,0,90,39,0,
- 100,33,0,100,62,0,100,33,0,100,63,0,101,39,0,100,
- 64,0,100,65,0,132,1,2,90,40,0,71,100,66,0,100,
- 67,0,132,0,0,100,67,0,131,2,0,90,41,0,71,100,
- 68,0,100,69,0,132,0,0,100,69,0,131,2,0,90,42,
- 0,71,100,70,0,100,71,0,132,0,0,100,71,0,101,42,
- 0,131,3,0,90,43,0,71,100,72,0,100,73,0,132,0,
- 0,100,73,0,131,2,0,90,44,0,71,100,74,0,100,75,
- 0,132,0,0,100,75,0,101,44,0,101,43,0,131,4,0,
- 90,45,0,71,100,76,0,100,77,0,132,0,0,100,77,0,
- 101,44,0,101,42,0,131,4,0,90,46,0,103,0,0,90,
- 47,0,71,100,78,0,100,79,0,132,0,0,100,79,0,101,
- 44,0,101,42,0,131,4,0,90,48,0,71,100,80,0,100,
- 81,0,132,0,0,100,81,0,131,2,0,90,49,0,71,100,
- 82,0,100,83,0,132,0,0,100,83,0,131,2,0,90,50,
- 0,71,100,84,0,100,85,0,132,0,0,100,85,0,131,2,
- 0,90,51,0,71,100,86,0,100,87,0,132,0,0,100,87,
- 0,131,2,0,90,52,0,100,33,0,100,88,0,100,89,0,
- 132,1,0,90,53,0,100,90,0,100,91,0,132,0,0,90,
- 54,0,100,92,0,100,93,0,132,0,0,90,55,0,100,94,
- 0,100,95,0,132,0,0,90,56,0,100,33,0,83,41,97,
- 97,94,1,0,0,67,111,114,101,32,105,109,112,108,101,109,
- 101,110,116,97,116,105,111,110,32,111,102,32,112,97,116,104,
- 45,98,97,115,101,100,32,105,109,112,111,114,116,46,10,10,
- 84,104,105,115,32,109,111,100,117,108,101,32,105,115,32,78,
- 79,84,32,109,101,97,110,116,32,116,111,32,98,101,32,100,
- 105,114,101,99,116,108,121,32,105,109,112,111,114,116,101,100,
- 33,32,73,116,32,104,97,115,32,98,101,101,110,32,100,101,
- 115,105,103,110,101,100,32,115,117,99,104,10,116,104,97,116,
- 32,105,116,32,99,97,110,32,98,101,32,98,111,111,116,115,
- 116,114,97,112,112,101,100,32,105,110,116,111,32,80,121,116,
- 104,111,110,32,97,115,32,116,104,101,32,105,109,112,108,101,
- 109,101,110,116,97,116,105,111,110,32,111,102,32,105,109,112,
- 111,114,116,46,32,65,115,10,115,117,99,104,32,105,116,32,
- 114,101,113,117,105,114,101,115,32,116,104,101,32,105,110,106,
- 101,99,116,105,111,110,32,111,102,32,115,112,101,99,105,102,
- 105,99,32,109,111,100,117,108,101,115,32,97,110,100,32,97,
- 116,116,114,105,98,117,116,101,115,32,105,110,32,111,114,100,
- 101,114,32,116,111,10,119,111,114,107,46,32,79,110,101,32,
- 115,104,111,117,108,100,32,117,115,101,32,105,109,112,111,114,
- 116,108,105,98,32,97,115,32,116,104,101,32,112,117,98,108,
- 105,99,45,102,97,99,105,110,103,32,118,101,114,115,105,111,
- 110,32,111,102,32,116,104,105,115,32,109,111,100,117,108,101,
- 46,10,10,218,3,119,105,110,218,6,99,121,103,119,105,110,
- 218,6,100,97,114,119,105,110,99,0,0,0,0,0,0,0,
- 0,1,0,0,0,2,0,0,0,67,0,0,0,115,49,0,
- 0,0,116,0,0,106,1,0,106,2,0,116,3,0,131,1,
- 0,114,33,0,100,1,0,100,2,0,132,0,0,125,0,0,
- 110,12,0,100,3,0,100,2,0,132,0,0,125,0,0,124,
- 0,0,83,41,4,78,99,0,0,0,0,0,0,0,0,0,
- 0,0,0,2,0,0,0,83,0,0,0,115,13,0,0,0,
- 100,1,0,116,0,0,106,1,0,107,6,0,83,41,2,122,
- 53,84,114,117,101,32,105,102,32,102,105,108,101,110,97,109,
- 101,115,32,109,117,115,116,32,98,101,32,99,104,101,99,107,
- 101,100,32,99,97,115,101,45,105,110,115,101,110,115,105,116,
- 105,118,101,108,121,46,115,12,0,0,0,80,89,84,72,79,
- 78,67,65,83,69,79,75,41,2,218,3,95,111,115,90,7,
- 101,110,118,105,114,111,110,169,0,114,4,0,0,0,114,4,
- 0,0,0,250,38,60,102,114,111,122,101,110,32,105,109,112,
- 111,114,116,108,105,98,46,95,98,111,111,116,115,116,114,97,
- 112,95,101,120,116,101,114,110,97,108,62,218,11,95,114,101,
- 108,97,120,95,99,97,115,101,30,0,0,0,115,2,0,0,
- 0,0,2,122,37,95,109,97,107,101,95,114,101,108,97,120,
- 95,99,97,115,101,46,60,108,111,99,97,108,115,62,46,95,
- 114,101,108,97,120,95,99,97,115,101,99,0,0,0,0,0,
- 0,0,0,0,0,0,0,1,0,0,0,83,0,0,0,115,
- 4,0,0,0,100,1,0,83,41,2,122,53,84,114,117,101,
- 32,105,102,32,102,105,108,101,110,97,109,101,115,32,109,117,
- 115,116,32,98,101,32,99,104,101,99,107,101,100,32,99,97,
- 115,101,45,105,110,115,101,110,115,105,116,105,118,101,108,121,
- 46,70,114,4,0,0,0,114,4,0,0,0,114,4,0,0,
- 0,114,4,0,0,0,114,5,0,0,0,114,6,0,0,0,
- 34,0,0,0,115,2,0,0,0,0,2,41,4,218,3,115,
- 121,115,218,8,112,108,97,116,102,111,114,109,218,10,115,116,
- 97,114,116,115,119,105,116,104,218,27,95,67,65,83,69,95,
- 73,78,83,69,78,83,73,84,73,86,69,95,80,76,65,84,
- 70,79,82,77,83,41,1,114,6,0,0,0,114,4,0,0,
- 0,114,4,0,0,0,114,5,0,0,0,218,16,95,109,97,
- 107,101,95,114,101,108,97,120,95,99,97,115,101,28,0,0,
- 0,115,8,0,0,0,0,1,18,1,15,4,12,3,114,11,
+ 0,0,90,30,0,100,45,0,100,46,0,132,0,0,90,31,
+ 0,100,47,0,100,48,0,132,0,0,90,32,0,100,33,0,
+ 100,33,0,100,33,0,100,49,0,100,50,0,132,3,0,90,
+ 33,0,100,33,0,100,33,0,100,33,0,100,51,0,100,52,
+ 0,132,3,0,90,34,0,100,53,0,100,53,0,100,54,0,
+ 100,55,0,132,2,0,90,35,0,100,56,0,100,57,0,132,
+ 0,0,90,36,0,101,37,0,131,0,0,90,38,0,100,33,
+ 0,100,58,0,100,33,0,100,59,0,101,38,0,100,60,0,
+ 100,61,0,132,1,2,90,39,0,71,100,62,0,100,63,0,
+ 132,0,0,100,63,0,131,2,0,90,40,0,71,100,64,0,
+ 100,65,0,132,0,0,100,65,0,131,2,0,90,41,0,71,
+ 100,66,0,100,67,0,132,0,0,100,67,0,101,41,0,131,
+ 3,0,90,42,0,71,100,68,0,100,69,0,132,0,0,100,
+ 69,0,131,2,0,90,43,0,71,100,70,0,100,71,0,132,
+ 0,0,100,71,0,101,43,0,101,42,0,131,4,0,90,44,
+ 0,71,100,72,0,100,73,0,132,0,0,100,73,0,101,43,
+ 0,101,41,0,131,4,0,90,45,0,103,0,0,90,46,0,
+ 71,100,74,0,100,75,0,132,0,0,100,75,0,101,43,0,
+ 101,41,0,131,4,0,90,47,0,71,100,76,0,100,77,0,
+ 132,0,0,100,77,0,131,2,0,90,48,0,71,100,78,0,
+ 100,79,0,132,0,0,100,79,0,131,2,0,90,49,0,71,
+ 100,80,0,100,81,0,132,0,0,100,81,0,131,2,0,90,
+ 50,0,71,100,82,0,100,83,0,132,0,0,100,83,0,131,
+ 2,0,90,51,0,100,33,0,100,84,0,100,85,0,132,1,
+ 0,90,52,0,100,86,0,100,87,0,132,0,0,90,53,0,
+ 100,88,0,100,89,0,132,0,0,90,54,0,100,90,0,100,
+ 91,0,132,0,0,90,55,0,100,33,0,83,41,93,97,94,
+ 1,0,0,67,111,114,101,32,105,109,112,108,101,109,101,110,
+ 116,97,116,105,111,110,32,111,102,32,112,97,116,104,45,98,
+ 97,115,101,100,32,105,109,112,111,114,116,46,10,10,84,104,
+ 105,115,32,109,111,100,117,108,101,32,105,115,32,78,79,84,
+ 32,109,101,97,110,116,32,116,111,32,98,101,32,100,105,114,
+ 101,99,116,108,121,32,105,109,112,111,114,116,101,100,33,32,
+ 73,116,32,104,97,115,32,98,101,101,110,32,100,101,115,105,
+ 103,110,101,100,32,115,117,99,104,10,116,104,97,116,32,105,
+ 116,32,99,97,110,32,98,101,32,98,111,111,116,115,116,114,
+ 97,112,112,101,100,32,105,110,116,111,32,80,121,116,104,111,
+ 110,32,97,115,32,116,104,101,32,105,109,112,108,101,109,101,
+ 110,116,97,116,105,111,110,32,111,102,32,105,109,112,111,114,
+ 116,46,32,65,115,10,115,117,99,104,32,105,116,32,114,101,
+ 113,117,105,114,101,115,32,116,104,101,32,105,110,106,101,99,
+ 116,105,111,110,32,111,102,32,115,112,101,99,105,102,105,99,
+ 32,109,111,100,117,108,101,115,32,97,110,100,32,97,116,116,
+ 114,105,98,117,116,101,115,32,105,110,32,111,114,100,101,114,
+ 32,116,111,10,119,111,114,107,46,32,79,110,101,32,115,104,
+ 111,117,108,100,32,117,115,101,32,105,109,112,111,114,116,108,
+ 105,98,32,97,115,32,116,104,101,32,112,117,98,108,105,99,
+ 45,102,97,99,105,110,103,32,118,101,114,115,105,111,110,32,
+ 111,102,32,116,104,105,115,32,109,111,100,117,108,101,46,10,
+ 10,218,3,119,105,110,218,6,99,121,103,119,105,110,218,6,
+ 100,97,114,119,105,110,99,0,0,0,0,0,0,0,0,1,
+ 0,0,0,2,0,0,0,67,0,0,0,115,49,0,0,0,
+ 116,0,0,106,1,0,106,2,0,116,3,0,131,1,0,114,
+ 33,0,100,1,0,100,2,0,132,0,0,125,0,0,110,12,
+ 0,100,3,0,100,2,0,132,0,0,125,0,0,124,0,0,
+ 83,41,4,78,99,0,0,0,0,0,0,0,0,0,0,0,
+ 0,2,0,0,0,83,0,0,0,115,13,0,0,0,100,1,
+ 0,116,0,0,106,1,0,107,6,0,83,41,2,122,53,84,
+ 114,117,101,32,105,102,32,102,105,108,101,110,97,109,101,115,
+ 32,109,117,115,116,32,98,101,32,99,104,101,99,107,101,100,
+ 32,99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,
+ 101,108,121,46,115,12,0,0,0,80,89,84,72,79,78,67,
+ 65,83,69,79,75,41,2,218,3,95,111,115,90,7,101,110,
+ 118,105,114,111,110,169,0,114,4,0,0,0,114,4,0,0,
+ 0,250,38,60,102,114,111,122,101,110,32,105,109,112,111,114,
+ 116,108,105,98,46,95,98,111,111,116,115,116,114,97,112,95,
+ 101,120,116,101,114,110,97,108,62,218,11,95,114,101,108,97,
+ 120,95,99,97,115,101,30,0,0,0,115,2,0,0,0,0,
+ 2,122,37,95,109,97,107,101,95,114,101,108,97,120,95,99,
+ 97,115,101,46,60,108,111,99,97,108,115,62,46,95,114,101,
+ 108,97,120,95,99,97,115,101,99,0,0,0,0,0,0,0,
+ 0,0,0,0,0,1,0,0,0,83,0,0,0,115,4,0,
+ 0,0,100,1,0,83,41,2,122,53,84,114,117,101,32,105,
+ 102,32,102,105,108,101,110,97,109,101,115,32,109,117,115,116,
+ 32,98,101,32,99,104,101,99,107,101,100,32,99,97,115,101,
+ 45,105,110,115,101,110,115,105,116,105,118,101,108,121,46,70,
+ 114,4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
+ 4,0,0,0,114,5,0,0,0,114,6,0,0,0,34,0,
+ 0,0,115,2,0,0,0,0,2,41,4,218,3,115,121,115,
+ 218,8,112,108,97,116,102,111,114,109,218,10,115,116,97,114,
+ 116,115,119,105,116,104,218,27,95,67,65,83,69,95,73,78,
+ 83,69,78,83,73,84,73,86,69,95,80,76,65,84,70,79,
+ 82,77,83,41,1,114,6,0,0,0,114,4,0,0,0,114,
+ 4,0,0,0,114,5,0,0,0,218,16,95,109,97,107,101,
+ 95,114,101,108,97,120,95,99,97,115,101,28,0,0,0,115,
+ 8,0,0,0,0,1,18,1,15,4,12,3,114,11,0,0,
+ 0,99,1,0,0,0,0,0,0,0,1,0,0,0,3,0,
+ 0,0,67,0,0,0,115,26,0,0,0,116,0,0,124,0,
+ 0,131,1,0,100,1,0,64,106,1,0,100,2,0,100,3,
+ 0,131,2,0,83,41,4,122,42,67,111,110,118,101,114,116,
+ 32,97,32,51,50,45,98,105,116,32,105,110,116,101,103,101,
+ 114,32,116,111,32,108,105,116,116,108,101,45,101,110,100,105,
+ 97,110,46,108,3,0,0,0,255,127,255,127,3,0,233,4,
+ 0,0,0,218,6,108,105,116,116,108,101,41,2,218,3,105,
+ 110,116,218,8,116,111,95,98,121,116,101,115,41,1,218,1,
+ 120,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
+ 218,7,95,119,95,108,111,110,103,40,0,0,0,115,2,0,
+ 0,0,0,2,114,17,0,0,0,99,1,0,0,0,0,0,
+ 0,0,1,0,0,0,3,0,0,0,67,0,0,0,115,16,
+ 0,0,0,116,0,0,106,1,0,124,0,0,100,1,0,131,
+ 2,0,83,41,2,122,47,67,111,110,118,101,114,116,32,52,
+ 32,98,121,116,101,115,32,105,110,32,108,105,116,116,108,101,
+ 45,101,110,100,105,97,110,32,116,111,32,97,110,32,105,110,
+ 116,101,103,101,114,46,114,13,0,0,0,41,2,114,14,0,
+ 0,0,218,10,102,114,111,109,95,98,121,116,101,115,41,1,
+ 90,9,105,110,116,95,98,121,116,101,115,114,4,0,0,0,
+ 114,4,0,0,0,114,5,0,0,0,218,7,95,114,95,108,
+ 111,110,103,45,0,0,0,115,2,0,0,0,0,2,114,19,
+ 0,0,0,99,0,0,0,0,0,0,0,0,1,0,0,0,
+ 3,0,0,0,71,0,0,0,115,26,0,0,0,116,0,0,
+ 106,1,0,100,1,0,100,2,0,132,0,0,124,0,0,68,
+ 131,1,0,131,1,0,83,41,3,122,31,82,101,112,108,97,
+ 99,101,109,101,110,116,32,102,111,114,32,111,115,46,112,97,
+ 116,104,46,106,111,105,110,40,41,46,99,1,0,0,0,0,
+ 0,0,0,2,0,0,0,4,0,0,0,83,0,0,0,115,
+ 37,0,0,0,103,0,0,124,0,0,93,27,0,125,1,0,
+ 124,1,0,114,6,0,124,1,0,106,0,0,116,1,0,131,
+ 1,0,145,2,0,113,6,0,83,114,4,0,0,0,41,2,
+ 218,6,114,115,116,114,105,112,218,15,112,97,116,104,95,115,
+ 101,112,97,114,97,116,111,114,115,41,2,218,2,46,48,218,
+ 4,112,97,114,116,114,4,0,0,0,114,4,0,0,0,114,
+ 5,0,0,0,250,10,60,108,105,115,116,99,111,109,112,62,
+ 52,0,0,0,115,2,0,0,0,9,1,122,30,95,112,97,
+ 116,104,95,106,111,105,110,46,60,108,111,99,97,108,115,62,
+ 46,60,108,105,115,116,99,111,109,112,62,41,2,218,8,112,
+ 97,116,104,95,115,101,112,218,4,106,111,105,110,41,1,218,
+ 10,112,97,116,104,95,112,97,114,116,115,114,4,0,0,0,
+ 114,4,0,0,0,114,5,0,0,0,218,10,95,112,97,116,
+ 104,95,106,111,105,110,50,0,0,0,115,4,0,0,0,0,
+ 2,15,1,114,28,0,0,0,99,1,0,0,0,0,0,0,
+ 0,5,0,0,0,5,0,0,0,67,0,0,0,115,134,0,
+ 0,0,116,0,0,116,1,0,131,1,0,100,1,0,107,2,
+ 0,114,52,0,124,0,0,106,2,0,116,3,0,131,1,0,
+ 92,3,0,125,1,0,125,2,0,125,3,0,124,1,0,124,
+ 3,0,102,2,0,83,120,69,0,116,4,0,124,0,0,131,
+ 1,0,68,93,55,0,125,4,0,124,4,0,116,1,0,107,
+ 6,0,114,65,0,124,0,0,106,5,0,124,4,0,100,2,
+ 0,100,1,0,131,1,1,92,2,0,125,1,0,125,3,0,
+ 124,1,0,124,3,0,102,2,0,83,113,65,0,87,100,3,
+ 0,124,0,0,102,2,0,83,41,4,122,32,82,101,112,108,
+ 97,99,101,109,101,110,116,32,102,111,114,32,111,115,46,112,
+ 97,116,104,46,115,112,108,105,116,40,41,46,233,1,0,0,
+ 0,90,8,109,97,120,115,112,108,105,116,218,0,41,6,218,
+ 3,108,101,110,114,21,0,0,0,218,10,114,112,97,114,116,
+ 105,116,105,111,110,114,25,0,0,0,218,8,114,101,118,101,
+ 114,115,101,100,218,6,114,115,112,108,105,116,41,5,218,4,
+ 112,97,116,104,90,5,102,114,111,110,116,218,1,95,218,4,
+ 116,97,105,108,114,16,0,0,0,114,4,0,0,0,114,4,
+ 0,0,0,114,5,0,0,0,218,11,95,112,97,116,104,95,
+ 115,112,108,105,116,56,0,0,0,115,16,0,0,0,0,2,
+ 18,1,24,1,10,1,19,1,12,1,27,1,14,1,114,38,
0,0,0,99,1,0,0,0,0,0,0,0,1,0,0,0,
- 3,0,0,0,67,0,0,0,115,26,0,0,0,116,0,0,
- 124,0,0,131,1,0,100,1,0,64,106,1,0,100,2,0,
- 100,3,0,131,2,0,83,41,4,122,42,67,111,110,118,101,
- 114,116,32,97,32,51,50,45,98,105,116,32,105,110,116,101,
- 103,101,114,32,116,111,32,108,105,116,116,108,101,45,101,110,
- 100,105,97,110,46,108,3,0,0,0,255,127,255,127,3,0,
- 233,4,0,0,0,218,6,108,105,116,116,108,101,41,2,218,
- 3,105,110,116,218,8,116,111,95,98,121,116,101,115,41,1,
- 218,1,120,114,4,0,0,0,114,4,0,0,0,114,5,0,
- 0,0,218,7,95,119,95,108,111,110,103,40,0,0,0,115,
- 2,0,0,0,0,2,114,17,0,0,0,99,1,0,0,0,
- 0,0,0,0,1,0,0,0,3,0,0,0,67,0,0,0,
- 115,16,0,0,0,116,0,0,106,1,0,124,0,0,100,1,
- 0,131,2,0,83,41,2,122,47,67,111,110,118,101,114,116,
- 32,52,32,98,121,116,101,115,32,105,110,32,108,105,116,116,
- 108,101,45,101,110,100,105,97,110,32,116,111,32,97,110,32,
- 105,110,116,101,103,101,114,46,114,13,0,0,0,41,2,114,
- 14,0,0,0,218,10,102,114,111,109,95,98,121,116,101,115,
- 41,1,90,9,105,110,116,95,98,121,116,101,115,114,4,0,
- 0,0,114,4,0,0,0,114,5,0,0,0,218,7,95,114,
- 95,108,111,110,103,45,0,0,0,115,2,0,0,0,0,2,
- 114,19,0,0,0,99,0,0,0,0,0,0,0,0,1,0,
- 0,0,3,0,0,0,71,0,0,0,115,26,0,0,0,116,
- 0,0,106,1,0,100,1,0,100,2,0,132,0,0,124,0,
- 0,68,131,1,0,131,1,0,83,41,3,122,31,82,101,112,
+ 2,0,0,0,67,0,0,0,115,13,0,0,0,116,0,0,
+ 106,1,0,124,0,0,131,1,0,83,41,1,122,126,83,116,
+ 97,116,32,116,104,101,32,112,97,116,104,46,10,10,32,32,
+ 32,32,77,97,100,101,32,97,32,115,101,112,97,114,97,116,
+ 101,32,102,117,110,99,116,105,111,110,32,116,111,32,109,97,
+ 107,101,32,105,116,32,101,97,115,105,101,114,32,116,111,32,
+ 111,118,101,114,114,105,100,101,32,105,110,32,101,120,112,101,
+ 114,105,109,101,110,116,115,10,32,32,32,32,40,101,46,103,
+ 46,32,99,97,99,104,101,32,115,116,97,116,32,114,101,115,
+ 117,108,116,115,41,46,10,10,32,32,32,32,41,2,114,3,
+ 0,0,0,90,4,115,116,97,116,41,1,114,35,0,0,0,
+ 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,
+ 10,95,112,97,116,104,95,115,116,97,116,68,0,0,0,115,
+ 2,0,0,0,0,7,114,39,0,0,0,99,2,0,0,0,
+ 0,0,0,0,3,0,0,0,11,0,0,0,67,0,0,0,
+ 115,58,0,0,0,121,16,0,116,0,0,124,0,0,131,1,
+ 0,125,2,0,87,110,22,0,4,116,1,0,107,10,0,114,
+ 40,0,1,1,1,100,1,0,83,89,110,1,0,88,124,2,
+ 0,106,2,0,100,2,0,64,124,1,0,107,2,0,83,41,
+ 3,122,49,84,101,115,116,32,119,104,101,116,104,101,114,32,
+ 116,104,101,32,112,97,116,104,32,105,115,32,116,104,101,32,
+ 115,112,101,99,105,102,105,101,100,32,109,111,100,101,32,116,
+ 121,112,101,46,70,105,0,240,0,0,41,3,114,39,0,0,
+ 0,218,7,79,83,69,114,114,111,114,218,7,115,116,95,109,
+ 111,100,101,41,3,114,35,0,0,0,218,4,109,111,100,101,
+ 90,9,115,116,97,116,95,105,110,102,111,114,4,0,0,0,
+ 114,4,0,0,0,114,5,0,0,0,218,18,95,112,97,116,
+ 104,95,105,115,95,109,111,100,101,95,116,121,112,101,78,0,
+ 0,0,115,10,0,0,0,0,2,3,1,16,1,13,1,9,
+ 1,114,43,0,0,0,99,1,0,0,0,0,0,0,0,1,
+ 0,0,0,3,0,0,0,67,0,0,0,115,13,0,0,0,
+ 116,0,0,124,0,0,100,1,0,131,2,0,83,41,2,122,
+ 31,82,101,112,108,97,99,101,109,101,110,116,32,102,111,114,
+ 32,111,115,46,112,97,116,104,46,105,115,102,105,108,101,46,
+ 105,0,128,0,0,41,1,114,43,0,0,0,41,1,114,35,
+ 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,
+ 0,0,218,12,95,112,97,116,104,95,105,115,102,105,108,101,
+ 87,0,0,0,115,2,0,0,0,0,2,114,44,0,0,0,
+ 99,1,0,0,0,0,0,0,0,1,0,0,0,3,0,0,
+ 0,67,0,0,0,115,31,0,0,0,124,0,0,115,18,0,
+ 116,0,0,106,1,0,131,0,0,125,0,0,116,2,0,124,
+ 0,0,100,1,0,131,2,0,83,41,2,122,30,82,101,112,
108,97,99,101,109,101,110,116,32,102,111,114,32,111,115,46,
- 112,97,116,104,46,106,111,105,110,40,41,46,99,1,0,0,
- 0,0,0,0,0,2,0,0,0,4,0,0,0,83,0,0,
- 0,115,37,0,0,0,103,0,0,124,0,0,93,27,0,125,
- 1,0,124,1,0,114,6,0,124,1,0,106,0,0,116,1,
- 0,131,1,0,145,2,0,113,6,0,83,114,4,0,0,0,
- 41,2,218,6,114,115,116,114,105,112,218,15,112,97,116,104,
- 95,115,101,112,97,114,97,116,111,114,115,41,2,218,2,46,
- 48,218,4,112,97,114,116,114,4,0,0,0,114,4,0,0,
- 0,114,5,0,0,0,250,10,60,108,105,115,116,99,111,109,
- 112,62,52,0,0,0,115,2,0,0,0,9,1,122,30,95,
- 112,97,116,104,95,106,111,105,110,46,60,108,111,99,97,108,
- 115,62,46,60,108,105,115,116,99,111,109,112,62,41,2,218,
- 8,112,97,116,104,95,115,101,112,218,4,106,111,105,110,41,
- 1,218,10,112,97,116,104,95,112,97,114,116,115,114,4,0,
- 0,0,114,4,0,0,0,114,5,0,0,0,218,10,95,112,
- 97,116,104,95,106,111,105,110,50,0,0,0,115,4,0,0,
- 0,0,2,15,1,114,28,0,0,0,99,1,0,0,0,0,
- 0,0,0,5,0,0,0,5,0,0,0,67,0,0,0,115,
- 134,0,0,0,116,0,0,116,1,0,131,1,0,100,1,0,
- 107,2,0,114,52,0,124,0,0,106,2,0,116,3,0,131,
- 1,0,92,3,0,125,1,0,125,2,0,125,3,0,124,1,
- 0,124,3,0,102,2,0,83,120,69,0,116,4,0,124,0,
- 0,131,1,0,68,93,55,0,125,4,0,124,4,0,116,1,
- 0,107,6,0,114,65,0,124,0,0,106,5,0,124,4,0,
- 100,2,0,100,1,0,131,1,1,92,2,0,125,1,0,125,
- 3,0,124,1,0,124,3,0,102,2,0,83,113,65,0,87,
- 100,3,0,124,0,0,102,2,0,83,41,4,122,32,82,101,
- 112,108,97,99,101,109,101,110,116,32,102,111,114,32,111,115,
- 46,112,97,116,104,46,115,112,108,105,116,40,41,46,233,1,
- 0,0,0,90,8,109,97,120,115,112,108,105,116,218,0,41,
- 6,218,3,108,101,110,114,21,0,0,0,218,10,114,112,97,
- 114,116,105,116,105,111,110,114,25,0,0,0,218,8,114,101,
- 118,101,114,115,101,100,218,6,114,115,112,108,105,116,41,5,
- 218,4,112,97,116,104,90,5,102,114,111,110,116,218,1,95,
- 218,4,116,97,105,108,114,16,0,0,0,114,4,0,0,0,
+ 112,97,116,104,46,105,115,100,105,114,46,105,0,64,0,0,
+ 41,3,114,3,0,0,0,218,6,103,101,116,99,119,100,114,
+ 43,0,0,0,41,1,114,35,0,0,0,114,4,0,0,0,
114,4,0,0,0,114,5,0,0,0,218,11,95,112,97,116,
- 104,95,115,112,108,105,116,56,0,0,0,115,16,0,0,0,
- 0,2,18,1,24,1,10,1,19,1,12,1,27,1,14,1,
- 114,38,0,0,0,99,1,0,0,0,0,0,0,0,1,0,
- 0,0,2,0,0,0,67,0,0,0,115,13,0,0,0,116,
- 0,0,106,1,0,124,0,0,131,1,0,83,41,1,122,126,
- 83,116,97,116,32,116,104,101,32,112,97,116,104,46,10,10,
- 32,32,32,32,77,97,100,101,32,97,32,115,101,112,97,114,
- 97,116,101,32,102,117,110,99,116,105,111,110,32,116,111,32,
- 109,97,107,101,32,105,116,32,101,97,115,105,101,114,32,116,
- 111,32,111,118,101,114,114,105,100,101,32,105,110,32,101,120,
- 112,101,114,105,109,101,110,116,115,10,32,32,32,32,40,101,
- 46,103,46,32,99,97,99,104,101,32,115,116,97,116,32,114,
- 101,115,117,108,116,115,41,46,10,10,32,32,32,32,41,2,
- 114,3,0,0,0,90,4,115,116,97,116,41,1,114,35,0,
- 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,
- 0,218,10,95,112,97,116,104,95,115,116,97,116,68,0,0,
- 0,115,2,0,0,0,0,7,114,39,0,0,0,99,2,0,
- 0,0,0,0,0,0,3,0,0,0,11,0,0,0,67,0,
- 0,0,115,58,0,0,0,121,16,0,116,0,0,124,0,0,
- 131,1,0,125,2,0,87,110,22,0,4,116,1,0,107,10,
- 0,114,40,0,1,1,1,100,1,0,83,89,110,1,0,88,
- 124,2,0,106,2,0,100,2,0,64,124,1,0,107,2,0,
- 83,41,3,122,49,84,101,115,116,32,119,104,101,116,104,101,
- 114,32,116,104,101,32,112,97,116,104,32,105,115,32,116,104,
- 101,32,115,112,101,99,105,102,105,101,100,32,109,111,100,101,
- 32,116,121,112,101,46,70,105,0,240,0,0,41,3,114,39,
- 0,0,0,218,7,79,83,69,114,114,111,114,218,7,115,116,
- 95,109,111,100,101,41,3,114,35,0,0,0,218,4,109,111,
- 100,101,90,9,115,116,97,116,95,105,110,102,111,114,4,0,
- 0,0,114,4,0,0,0,114,5,0,0,0,218,18,95,112,
- 97,116,104,95,105,115,95,109,111,100,101,95,116,121,112,101,
- 78,0,0,0,115,10,0,0,0,0,2,3,1,16,1,13,
- 1,9,1,114,43,0,0,0,99,1,0,0,0,0,0,0,
- 0,1,0,0,0,3,0,0,0,67,0,0,0,115,13,0,
- 0,0,116,0,0,124,0,0,100,1,0,131,2,0,83,41,
- 2,122,31,82,101,112,108,97,99,101,109,101,110,116,32,102,
- 111,114,32,111,115,46,112,97,116,104,46,105,115,102,105,108,
- 101,46,105,0,128,0,0,41,1,114,43,0,0,0,41,1,
- 114,35,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,218,12,95,112,97,116,104,95,105,115,102,105,
- 108,101,87,0,0,0,115,2,0,0,0,0,2,114,44,0,
- 0,0,99,1,0,0,0,0,0,0,0,1,0,0,0,3,
- 0,0,0,67,0,0,0,115,31,0,0,0,124,0,0,115,
- 18,0,116,0,0,106,1,0,131,0,0,125,0,0,116,2,
- 0,124,0,0,100,1,0,131,2,0,83,41,2,122,30,82,
- 101,112,108,97,99,101,109,101,110,116,32,102,111,114,32,111,
- 115,46,112,97,116,104,46,105,115,100,105,114,46,105,0,64,
- 0,0,41,3,114,3,0,0,0,218,6,103,101,116,99,119,
- 100,114,43,0,0,0,41,1,114,35,0,0,0,114,4,0,
- 0,0,114,4,0,0,0,114,5,0,0,0,218,11,95,112,
- 97,116,104,95,105,115,100,105,114,92,0,0,0,115,6,0,
- 0,0,0,2,6,1,12,1,114,46,0,0,0,105,182,1,
- 0,0,99,3,0,0,0,0,0,0,0,6,0,0,0,17,
- 0,0,0,67,0,0,0,115,193,0,0,0,100,1,0,106,
- 0,0,124,0,0,116,1,0,124,0,0,131,1,0,131,2,
- 0,125,3,0,116,2,0,106,3,0,124,3,0,116,2,0,
- 106,4,0,116,2,0,106,5,0,66,116,2,0,106,6,0,
- 66,124,2,0,100,2,0,64,131,3,0,125,4,0,121,61,
- 0,116,7,0,106,8,0,124,4,0,100,3,0,131,2,0,
- 143,20,0,125,5,0,124,5,0,106,9,0,124,1,0,131,
- 1,0,1,87,100,4,0,81,82,88,116,2,0,106,10,0,
- 124,3,0,124,0,0,131,2,0,1,87,110,59,0,4,116,
- 11,0,107,10,0,114,188,0,1,1,1,121,17,0,116,2,
- 0,106,12,0,124,3,0,131,1,0,1,87,110,18,0,4,
- 116,11,0,107,10,0,114,180,0,1,1,1,89,110,1,0,
- 88,130,0,0,89,110,1,0,88,100,4,0,83,41,5,122,
- 162,66,101,115,116,45,101,102,102,111,114,116,32,102,117,110,
- 99,116,105,111,110,32,116,111,32,119,114,105,116,101,32,100,
- 97,116,97,32,116,111,32,97,32,112,97,116,104,32,97,116,
- 111,109,105,99,97,108,108,121,46,10,32,32,32,32,66,101,
- 32,112,114,101,112,97,114,101,100,32,116,111,32,104,97,110,
- 100,108,101,32,97,32,70,105,108,101,69,120,105,115,116,115,
- 69,114,114,111,114,32,105,102,32,99,111,110,99,117,114,114,
- 101,110,116,32,119,114,105,116,105,110,103,32,111,102,32,116,
- 104,101,10,32,32,32,32,116,101,109,112,111,114,97,114,121,
- 32,102,105,108,101,32,105,115,32,97,116,116,101,109,112,116,
- 101,100,46,122,5,123,125,46,123,125,105,182,1,0,0,90,
- 2,119,98,78,41,13,218,6,102,111,114,109,97,116,218,2,
- 105,100,114,3,0,0,0,90,4,111,112,101,110,90,6,79,
- 95,69,88,67,76,90,7,79,95,67,82,69,65,84,90,8,
- 79,95,87,82,79,78,76,89,218,3,95,105,111,218,6,70,
- 105,108,101,73,79,218,5,119,114,105,116,101,218,7,114,101,
- 112,108,97,99,101,114,40,0,0,0,90,6,117,110,108,105,
- 110,107,41,6,114,35,0,0,0,218,4,100,97,116,97,114,
- 42,0,0,0,90,8,112,97,116,104,95,116,109,112,90,2,
- 102,100,218,4,102,105,108,101,114,4,0,0,0,114,4,0,
- 0,0,114,5,0,0,0,218,13,95,119,114,105,116,101,95,
- 97,116,111,109,105,99,99,0,0,0,115,26,0,0,0,0,
- 5,24,1,9,1,33,1,3,3,21,1,20,1,20,1,13,
- 1,3,1,17,1,13,1,5,1,114,55,0,0,0,105,22,
- 13,0,0,233,2,0,0,0,114,13,0,0,0,115,2,0,
- 0,0,13,10,90,11,95,95,112,121,99,97,99,104,101,95,
- 95,122,4,111,112,116,45,122,3,46,112,121,122,4,46,112,
- 121,99,78,218,12,111,112,116,105,109,105,122,97,116,105,111,
- 110,99,2,0,0,0,1,0,0,0,11,0,0,0,6,0,
- 0,0,67,0,0,0,115,87,1,0,0,124,1,0,100,1,
- 0,107,9,0,114,76,0,116,0,0,106,1,0,100,2,0,
- 116,2,0,131,2,0,1,124,2,0,100,1,0,107,9,0,
- 114,58,0,100,3,0,125,3,0,116,3,0,124,3,0,131,
- 1,0,130,1,0,124,1,0,114,70,0,100,4,0,110,3,
- 0,100,5,0,125,2,0,116,4,0,124,0,0,131,1,0,
- 92,2,0,125,4,0,125,5,0,124,5,0,106,5,0,100,
- 6,0,131,1,0,92,3,0,125,6,0,125,7,0,125,8,
- 0,116,6,0,106,7,0,106,8,0,125,9,0,124,9,0,
- 100,1,0,107,8,0,114,154,0,116,9,0,100,7,0,131,
- 1,0,130,1,0,100,4,0,106,10,0,124,6,0,114,172,
- 0,124,6,0,110,3,0,124,8,0,124,7,0,124,9,0,
- 103,3,0,131,1,0,125,10,0,124,2,0,100,1,0,107,
- 8,0,114,241,0,116,6,0,106,11,0,106,12,0,100,8,
- 0,107,2,0,114,229,0,100,4,0,125,2,0,110,12,0,
- 116,6,0,106,11,0,106,12,0,125,2,0,116,13,0,124,
- 2,0,131,1,0,125,2,0,124,2,0,100,4,0,107,3,
- 0,114,63,1,124,2,0,106,14,0,131,0,0,115,42,1,
- 116,15,0,100,9,0,106,16,0,124,2,0,131,1,0,131,
- 1,0,130,1,0,100,10,0,106,16,0,124,10,0,116,17,
- 0,124,2,0,131,3,0,125,10,0,116,18,0,124,4,0,
- 116,19,0,124,10,0,116,20,0,100,8,0,25,23,131,3,
- 0,83,41,11,97,254,2,0,0,71,105,118,101,110,32,116,
- 104,101,32,112,97,116,104,32,116,111,32,97,32,46,112,121,
- 32,102,105,108,101,44,32,114,101,116,117,114,110,32,116,104,
- 101,32,112,97,116,104,32,116,111,32,105,116,115,32,46,112,
- 121,99,32,102,105,108,101,46,10,10,32,32,32,32,84,104,
- 101,32,46,112,121,32,102,105,108,101,32,100,111,101,115,32,
- 110,111,116,32,110,101,101,100,32,116,111,32,101,120,105,115,
- 116,59,32,116,104,105,115,32,115,105,109,112,108,121,32,114,
- 101,116,117,114,110,115,32,116,104,101,32,112,97,116,104,32,
- 116,111,32,116,104,101,10,32,32,32,32,46,112,121,99,32,
- 102,105,108,101,32,99,97,108,99,117,108,97,116,101,100,32,
- 97,115,32,105,102,32,116,104,101,32,46,112,121,32,102,105,
- 108,101,32,119,101,114,101,32,105,109,112,111,114,116,101,100,
- 46,10,10,32,32,32,32,84,104,101,32,39,111,112,116,105,
- 109,105,122,97,116,105,111,110,39,32,112,97,114,97,109,101,
- 116,101,114,32,99,111,110,116,114,111,108,115,32,116,104,101,
- 32,112,114,101,115,117,109,101,100,32,111,112,116,105,109,105,
- 122,97,116,105,111,110,32,108,101,118,101,108,32,111,102,10,
- 32,32,32,32,116,104,101,32,98,121,116,101,99,111,100,101,
- 32,102,105,108,101,46,32,73,102,32,39,111,112,116,105,109,
- 105,122,97,116,105,111,110,39,32,105,115,32,110,111,116,32,
- 78,111,110,101,44,32,116,104,101,32,115,116,114,105,110,103,
- 32,114,101,112,114,101,115,101,110,116,97,116,105,111,110,10,
- 32,32,32,32,111,102,32,116,104,101,32,97,114,103,117,109,
- 101,110,116,32,105,115,32,116,97,107,101,110,32,97,110,100,
- 32,118,101,114,105,102,105,101,100,32,116,111,32,98,101,32,
- 97,108,112,104,97,110,117,109,101,114,105,99,32,40,101,108,
- 115,101,32,86,97,108,117,101,69,114,114,111,114,10,32,32,
- 32,32,105,115,32,114,97,105,115,101,100,41,46,10,10,32,
- 32,32,32,84,104,101,32,100,101,98,117,103,95,111,118,101,
- 114,114,105,100,101,32,112,97,114,97,109,101,116,101,114,32,
- 105,115,32,100,101,112,114,101,99,97,116,101,100,46,32,73,
- 102,32,100,101,98,117,103,95,111,118,101,114,114,105,100,101,
- 32,105,115,32,110,111,116,32,78,111,110,101,44,10,32,32,
- 32,32,97,32,84,114,117,101,32,118,97,108,117,101,32,105,
- 115,32,116,104,101,32,115,97,109,101,32,97,115,32,115,101,
- 116,116,105,110,103,32,39,111,112,116,105,109,105,122,97,116,
- 105,111,110,39,32,116,111,32,116,104,101,32,101,109,112,116,
- 121,32,115,116,114,105,110,103,10,32,32,32,32,119,104,105,
- 108,101,32,97,32,70,97,108,115,101,32,118,97,108,117,101,
- 32,105,115,32,101,113,117,105,118,97,108,101,110,116,32,116,
- 111,32,115,101,116,116,105,110,103,32,39,111,112,116,105,109,
- 105,122,97,116,105,111,110,39,32,116,111,32,39,49,39,46,
- 10,10,32,32,32,32,73,102,32,115,121,115,46,105,109,112,
- 108,101,109,101,110,116,97,116,105,111,110,46,99,97,99,104,
- 101,95,116,97,103,32,105,115,32,78,111,110,101,32,116,104,
- 101,110,32,78,111,116,73,109,112,108,101,109,101,110,116,101,
- 100,69,114,114,111,114,32,105,115,32,114,97,105,115,101,100,
- 46,10,10,32,32,32,32,78,122,70,116,104,101,32,100,101,
- 98,117,103,95,111,118,101,114,114,105,100,101,32,112,97,114,
- 97,109,101,116,101,114,32,105,115,32,100,101,112,114,101,99,
- 97,116,101,100,59,32,117,115,101,32,39,111,112,116,105,109,
- 105,122,97,116,105,111,110,39,32,105,110,115,116,101,97,100,
- 122,50,100,101,98,117,103,95,111,118,101,114,114,105,100,101,
- 32,111,114,32,111,112,116,105,109,105,122,97,116,105,111,110,
- 32,109,117,115,116,32,98,101,32,115,101,116,32,116,111,32,
- 78,111,110,101,114,30,0,0,0,114,29,0,0,0,218,1,
- 46,122,36,115,121,115,46,105,109,112,108,101,109,101,110,116,
- 97,116,105,111,110,46,99,97,99,104,101,95,116,97,103,32,
- 105,115,32,78,111,110,101,233,0,0,0,0,122,24,123,33,
- 114,125,32,105,115,32,110,111,116,32,97,108,112,104,97,110,
- 117,109,101,114,105,99,122,7,123,125,46,123,125,123,125,41,
- 21,218,9,95,119,97,114,110,105,110,103,115,218,4,119,97,
- 114,110,218,18,68,101,112,114,101,99,97,116,105,111,110,87,
- 97,114,110,105,110,103,218,9,84,121,112,101,69,114,114,111,
- 114,114,38,0,0,0,114,32,0,0,0,114,7,0,0,0,
- 218,14,105,109,112,108,101,109,101,110,116,97,116,105,111,110,
- 218,9,99,97,99,104,101,95,116,97,103,218,19,78,111,116,
- 73,109,112,108,101,109,101,110,116,101,100,69,114,114,111,114,
- 114,26,0,0,0,218,5,102,108,97,103,115,218,8,111,112,
- 116,105,109,105,122,101,218,3,115,116,114,218,7,105,115,97,
- 108,110,117,109,218,10,86,97,108,117,101,69,114,114,111,114,
- 114,47,0,0,0,218,4,95,79,80,84,114,28,0,0,0,
- 218,8,95,80,89,67,65,67,72,69,218,17,66,89,84,69,
- 67,79,68,69,95,83,85,70,70,73,88,69,83,41,11,114,
- 35,0,0,0,90,14,100,101,98,117,103,95,111,118,101,114,
- 114,105,100,101,114,57,0,0,0,218,7,109,101,115,115,97,
- 103,101,218,4,104,101,97,100,114,37,0,0,0,90,4,98,
- 97,115,101,218,3,115,101,112,218,4,114,101,115,116,90,3,
- 116,97,103,90,15,97,108,109,111,115,116,95,102,105,108,101,
- 110,97,109,101,114,4,0,0,0,114,4,0,0,0,114,5,
- 0,0,0,218,17,99,97,99,104,101,95,102,114,111,109,95,
- 115,111,117,114,99,101,243,0,0,0,115,46,0,0,0,0,
- 18,12,1,9,1,7,1,12,1,6,1,12,1,18,1,18,
- 1,24,1,12,1,12,1,12,1,36,1,12,1,18,1,9,
- 2,12,1,12,1,12,1,12,1,21,1,21,1,114,79,0,
- 0,0,99,1,0,0,0,0,0,0,0,8,0,0,0,5,
- 0,0,0,67,0,0,0,115,62,1,0,0,116,0,0,106,
- 1,0,106,2,0,100,1,0,107,8,0,114,30,0,116,3,
- 0,100,2,0,131,1,0,130,1,0,116,4,0,124,0,0,
- 131,1,0,92,2,0,125,1,0,125,2,0,116,4,0,124,
- 1,0,131,1,0,92,2,0,125,1,0,125,3,0,124,3,
- 0,116,5,0,107,3,0,114,102,0,116,6,0,100,3,0,
- 106,7,0,116,5,0,124,0,0,131,2,0,131,1,0,130,
- 1,0,124,2,0,106,8,0,100,4,0,131,1,0,125,4,
- 0,124,4,0,100,11,0,107,7,0,114,153,0,116,6,0,
- 100,7,0,106,7,0,124,2,0,131,1,0,131,1,0,130,
- 1,0,110,125,0,124,4,0,100,6,0,107,2,0,114,22,
- 1,124,2,0,106,9,0,100,4,0,100,5,0,131,2,0,
- 100,12,0,25,125,5,0,124,5,0,106,10,0,116,11,0,
- 131,1,0,115,223,0,116,6,0,100,8,0,106,7,0,116,
- 11,0,131,1,0,131,1,0,130,1,0,124,5,0,116,12,
- 0,116,11,0,131,1,0,100,1,0,133,2,0,25,125,6,
- 0,124,6,0,106,13,0,131,0,0,115,22,1,116,6,0,
- 100,9,0,106,7,0,124,5,0,131,1,0,131,1,0,130,
- 1,0,124,2,0,106,14,0,100,4,0,131,1,0,100,10,
- 0,25,125,7,0,116,15,0,124,1,0,124,7,0,116,16,
- 0,100,10,0,25,23,131,2,0,83,41,13,97,110,1,0,
- 0,71,105,118,101,110,32,116,104,101,32,112,97,116,104,32,
- 116,111,32,97,32,46,112,121,99,46,32,102,105,108,101,44,
- 32,114,101,116,117,114,110,32,116,104,101,32,112,97,116,104,
- 32,116,111,32,105,116,115,32,46,112,121,32,102,105,108,101,
- 46,10,10,32,32,32,32,84,104,101,32,46,112,121,99,32,
- 102,105,108,101,32,100,111,101,115,32,110,111,116,32,110,101,
- 101,100,32,116,111,32,101,120,105,115,116,59,32,116,104,105,
- 115,32,115,105,109,112,108,121,32,114,101,116,117,114,110,115,
- 32,116,104,101,32,112,97,116,104,32,116,111,10,32,32,32,
- 32,116,104,101,32,46,112,121,32,102,105,108,101,32,99,97,
- 108,99,117,108,97,116,101,100,32,116,111,32,99,111,114,114,
- 101,115,112,111,110,100,32,116,111,32,116,104,101,32,46,112,
- 121,99,32,102,105,108,101,46,32,32,73,102,32,112,97,116,
- 104,32,100,111,101,115,10,32,32,32,32,110,111,116,32,99,
- 111,110,102,111,114,109,32,116,111,32,80,69,80,32,51,49,
- 52,55,47,52,56,56,32,102,111,114,109,97,116,44,32,86,
- 97,108,117,101,69,114,114,111,114,32,119,105,108,108,32,98,
- 101,32,114,97,105,115,101,100,46,32,73,102,10,32,32,32,
- 32,115,121,115,46,105,109,112,108,101,109,101,110,116,97,116,
+ 104,95,105,115,100,105,114,92,0,0,0,115,6,0,0,0,
+ 0,2,6,1,12,1,114,46,0,0,0,105,182,1,0,0,
+ 99,3,0,0,0,0,0,0,0,6,0,0,0,17,0,0,
+ 0,67,0,0,0,115,193,0,0,0,100,1,0,106,0,0,
+ 124,0,0,116,1,0,124,0,0,131,1,0,131,2,0,125,
+ 3,0,116,2,0,106,3,0,124,3,0,116,2,0,106,4,
+ 0,116,2,0,106,5,0,66,116,2,0,106,6,0,66,124,
+ 2,0,100,2,0,64,131,3,0,125,4,0,121,61,0,116,
+ 7,0,106,8,0,124,4,0,100,3,0,131,2,0,143,20,
+ 0,125,5,0,124,5,0,106,9,0,124,1,0,131,1,0,
+ 1,87,100,4,0,81,82,88,116,2,0,106,10,0,124,3,
+ 0,124,0,0,131,2,0,1,87,110,59,0,4,116,11,0,
+ 107,10,0,114,188,0,1,1,1,121,17,0,116,2,0,106,
+ 12,0,124,3,0,131,1,0,1,87,110,18,0,4,116,11,
+ 0,107,10,0,114,180,0,1,1,1,89,110,1,0,88,130,
+ 0,0,89,110,1,0,88,100,4,0,83,41,5,122,162,66,
+ 101,115,116,45,101,102,102,111,114,116,32,102,117,110,99,116,
+ 105,111,110,32,116,111,32,119,114,105,116,101,32,100,97,116,
+ 97,32,116,111,32,97,32,112,97,116,104,32,97,116,111,109,
+ 105,99,97,108,108,121,46,10,32,32,32,32,66,101,32,112,
+ 114,101,112,97,114,101,100,32,116,111,32,104,97,110,100,108,
+ 101,32,97,32,70,105,108,101,69,120,105,115,116,115,69,114,
+ 114,111,114,32,105,102,32,99,111,110,99,117,114,114,101,110,
+ 116,32,119,114,105,116,105,110,103,32,111,102,32,116,104,101,
+ 10,32,32,32,32,116,101,109,112,111,114,97,114,121,32,102,
+ 105,108,101,32,105,115,32,97,116,116,101,109,112,116,101,100,
+ 46,122,5,123,125,46,123,125,105,182,1,0,0,90,2,119,
+ 98,78,41,13,218,6,102,111,114,109,97,116,218,2,105,100,
+ 114,3,0,0,0,90,4,111,112,101,110,90,6,79,95,69,
+ 88,67,76,90,7,79,95,67,82,69,65,84,90,8,79,95,
+ 87,82,79,78,76,89,218,3,95,105,111,218,6,70,105,108,
+ 101,73,79,218,5,119,114,105,116,101,218,7,114,101,112,108,
+ 97,99,101,114,40,0,0,0,90,6,117,110,108,105,110,107,
+ 41,6,114,35,0,0,0,218,4,100,97,116,97,114,42,0,
+ 0,0,90,8,112,97,116,104,95,116,109,112,90,2,102,100,
+ 218,4,102,105,108,101,114,4,0,0,0,114,4,0,0,0,
+ 114,5,0,0,0,218,13,95,119,114,105,116,101,95,97,116,
+ 111,109,105,99,99,0,0,0,115,26,0,0,0,0,5,24,
+ 1,9,1,33,1,3,3,21,1,20,1,20,1,13,1,3,
+ 1,17,1,13,1,5,1,114,55,0,0,0,105,22,13,0,
+ 0,233,2,0,0,0,114,13,0,0,0,115,2,0,0,0,
+ 13,10,90,11,95,95,112,121,99,97,99,104,101,95,95,122,
+ 4,111,112,116,45,122,3,46,112,121,122,4,46,112,121,99,
+ 78,218,12,111,112,116,105,109,105,122,97,116,105,111,110,99,
+ 2,0,0,0,1,0,0,0,11,0,0,0,6,0,0,0,
+ 67,0,0,0,115,87,1,0,0,124,1,0,100,1,0,107,
+ 9,0,114,76,0,116,0,0,106,1,0,100,2,0,116,2,
+ 0,131,2,0,1,124,2,0,100,1,0,107,9,0,114,58,
+ 0,100,3,0,125,3,0,116,3,0,124,3,0,131,1,0,
+ 130,1,0,124,1,0,114,70,0,100,4,0,110,3,0,100,
+ 5,0,125,2,0,116,4,0,124,0,0,131,1,0,92,2,
+ 0,125,4,0,125,5,0,124,5,0,106,5,0,100,6,0,
+ 131,1,0,92,3,0,125,6,0,125,7,0,125,8,0,116,
+ 6,0,106,7,0,106,8,0,125,9,0,124,9,0,100,1,
+ 0,107,8,0,114,154,0,116,9,0,100,7,0,131,1,0,
+ 130,1,0,100,4,0,106,10,0,124,6,0,114,172,0,124,
+ 6,0,110,3,0,124,8,0,124,7,0,124,9,0,103,3,
+ 0,131,1,0,125,10,0,124,2,0,100,1,0,107,8,0,
+ 114,241,0,116,6,0,106,11,0,106,12,0,100,8,0,107,
+ 2,0,114,229,0,100,4,0,125,2,0,110,12,0,116,6,
+ 0,106,11,0,106,12,0,125,2,0,116,13,0,124,2,0,
+ 131,1,0,125,2,0,124,2,0,100,4,0,107,3,0,114,
+ 63,1,124,2,0,106,14,0,131,0,0,115,42,1,116,15,
+ 0,100,9,0,106,16,0,124,2,0,131,1,0,131,1,0,
+ 130,1,0,100,10,0,106,16,0,124,10,0,116,17,0,124,
+ 2,0,131,3,0,125,10,0,116,18,0,124,4,0,116,19,
+ 0,124,10,0,116,20,0,100,8,0,25,23,131,3,0,83,
+ 41,11,97,254,2,0,0,71,105,118,101,110,32,116,104,101,
+ 32,112,97,116,104,32,116,111,32,97,32,46,112,121,32,102,
+ 105,108,101,44,32,114,101,116,117,114,110,32,116,104,101,32,
+ 112,97,116,104,32,116,111,32,105,116,115,32,46,112,121,99,
+ 32,102,105,108,101,46,10,10,32,32,32,32,84,104,101,32,
+ 46,112,121,32,102,105,108,101,32,100,111,101,115,32,110,111,
+ 116,32,110,101,101,100,32,116,111,32,101,120,105,115,116,59,
+ 32,116,104,105,115,32,115,105,109,112,108,121,32,114,101,116,
+ 117,114,110,115,32,116,104,101,32,112,97,116,104,32,116,111,
+ 32,116,104,101,10,32,32,32,32,46,112,121,99,32,102,105,
+ 108,101,32,99,97,108,99,117,108,97,116,101,100,32,97,115,
+ 32,105,102,32,116,104,101,32,46,112,121,32,102,105,108,101,
+ 32,119,101,114,101,32,105,109,112,111,114,116,101,100,46,10,
+ 10,32,32,32,32,84,104,101,32,39,111,112,116,105,109,105,
+ 122,97,116,105,111,110,39,32,112,97,114,97,109,101,116,101,
+ 114,32,99,111,110,116,114,111,108,115,32,116,104,101,32,112,
+ 114,101,115,117,109,101,100,32,111,112,116,105,109,105,122,97,
+ 116,105,111,110,32,108,101,118,101,108,32,111,102,10,32,32,
+ 32,32,116,104,101,32,98,121,116,101,99,111,100,101,32,102,
+ 105,108,101,46,32,73,102,32,39,111,112,116,105,109,105,122,
+ 97,116,105,111,110,39,32,105,115,32,110,111,116,32,78,111,
+ 110,101,44,32,116,104,101,32,115,116,114,105,110,103,32,114,
+ 101,112,114,101,115,101,110,116,97,116,105,111,110,10,32,32,
+ 32,32,111,102,32,116,104,101,32,97,114,103,117,109,101,110,
+ 116,32,105,115,32,116,97,107,101,110,32,97,110,100,32,118,
+ 101,114,105,102,105,101,100,32,116,111,32,98,101,32,97,108,
+ 112,104,97,110,117,109,101,114,105,99,32,40,101,108,115,101,
+ 32,86,97,108,117,101,69,114,114,111,114,10,32,32,32,32,
+ 105,115,32,114,97,105,115,101,100,41,46,10,10,32,32,32,
+ 32,84,104,101,32,100,101,98,117,103,95,111,118,101,114,114,
+ 105,100,101,32,112,97,114,97,109,101,116,101,114,32,105,115,
+ 32,100,101,112,114,101,99,97,116,101,100,46,32,73,102,32,
+ 100,101,98,117,103,95,111,118,101,114,114,105,100,101,32,105,
+ 115,32,110,111,116,32,78,111,110,101,44,10,32,32,32,32,
+ 97,32,84,114,117,101,32,118,97,108,117,101,32,105,115,32,
+ 116,104,101,32,115,97,109,101,32,97,115,32,115,101,116,116,
+ 105,110,103,32,39,111,112,116,105,109,105,122,97,116,105,111,
+ 110,39,32,116,111,32,116,104,101,32,101,109,112,116,121,32,
+ 115,116,114,105,110,103,10,32,32,32,32,119,104,105,108,101,
+ 32,97,32,70,97,108,115,101,32,118,97,108,117,101,32,105,
+ 115,32,101,113,117,105,118,97,108,101,110,116,32,116,111,32,
+ 115,101,116,116,105,110,103,32,39,111,112,116,105,109,105,122,
+ 97,116,105,111,110,39,32,116,111,32,39,49,39,46,10,10,
+ 32,32,32,32,73,102,32,115,121,115,46,105,109,112,108,101,
+ 109,101,110,116,97,116,105,111,110,46,99,97,99,104,101,95,
+ 116,97,103,32,105,115,32,78,111,110,101,32,116,104,101,110,
+ 32,78,111,116,73,109,112,108,101,109,101,110,116,101,100,69,
+ 114,114,111,114,32,105,115,32,114,97,105,115,101,100,46,10,
+ 10,32,32,32,32,78,122,70,116,104,101,32,100,101,98,117,
+ 103,95,111,118,101,114,114,105,100,101,32,112,97,114,97,109,
+ 101,116,101,114,32,105,115,32,100,101,112,114,101,99,97,116,
+ 101,100,59,32,117,115,101,32,39,111,112,116,105,109,105,122,
+ 97,116,105,111,110,39,32,105,110,115,116,101,97,100,122,50,
+ 100,101,98,117,103,95,111,118,101,114,114,105,100,101,32,111,
+ 114,32,111,112,116,105,109,105,122,97,116,105,111,110,32,109,
+ 117,115,116,32,98,101,32,115,101,116,32,116,111,32,78,111,
+ 110,101,114,30,0,0,0,114,29,0,0,0,218,1,46,122,
+ 36,115,121,115,46,105,109,112,108,101,109,101,110,116,97,116,
105,111,110,46,99,97,99,104,101,95,116,97,103,32,105,115,
- 32,78,111,110,101,32,116,104,101,110,32,78,111,116,73,109,
- 112,108,101,109,101,110,116,101,100,69,114,114,111,114,32,105,
- 115,32,114,97,105,115,101,100,46,10,10,32,32,32,32,78,
- 122,36,115,121,115,46,105,109,112,108,101,109,101,110,116,97,
- 116,105,111,110,46,99,97,99,104,101,95,116,97,103,32,105,
- 115,32,78,111,110,101,122,37,123,125,32,110,111,116,32,98,
- 111,116,116,111,109,45,108,101,118,101,108,32,100,105,114,101,
- 99,116,111,114,121,32,105,110,32,123,33,114,125,114,58,0,
- 0,0,114,56,0,0,0,233,3,0,0,0,122,33,101,120,
- 112,101,99,116,101,100,32,111,110,108,121,32,50,32,111,114,
- 32,51,32,100,111,116,115,32,105,110,32,123,33,114,125,122,
- 57,111,112,116,105,109,105,122,97,116,105,111,110,32,112,111,
- 114,116,105,111,110,32,111,102,32,102,105,108,101,110,97,109,
- 101,32,100,111,101,115,32,110,111,116,32,115,116,97,114,116,
- 32,119,105,116,104,32,123,33,114,125,122,52,111,112,116,105,
- 109,105,122,97,116,105,111,110,32,108,101,118,101,108,32,123,
- 33,114,125,32,105,115,32,110,111,116,32,97,110,32,97,108,
- 112,104,97,110,117,109,101,114,105,99,32,118,97,108,117,101,
- 114,59,0,0,0,62,2,0,0,0,114,56,0,0,0,114,
- 80,0,0,0,233,254,255,255,255,41,17,114,7,0,0,0,
- 114,64,0,0,0,114,65,0,0,0,114,66,0,0,0,114,
- 38,0,0,0,114,73,0,0,0,114,71,0,0,0,114,47,
- 0,0,0,218,5,99,111,117,110,116,114,34,0,0,0,114,
- 9,0,0,0,114,72,0,0,0,114,31,0,0,0,114,70,
- 0,0,0,218,9,112,97,114,116,105,116,105,111,110,114,28,
- 0,0,0,218,15,83,79,85,82,67,69,95,83,85,70,70,
- 73,88,69,83,41,8,114,35,0,0,0,114,76,0,0,0,
- 90,16,112,121,99,97,99,104,101,95,102,105,108,101,110,97,
- 109,101,90,7,112,121,99,97,99,104,101,90,9,100,111,116,
- 95,99,111,117,110,116,114,57,0,0,0,90,9,111,112,116,
- 95,108,101,118,101,108,90,13,98,97,115,101,95,102,105,108,
- 101,110,97,109,101,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,218,17,115,111,117,114,99,101,95,102,114,111,
- 109,95,99,97,99,104,101,31,1,0,0,115,44,0,0,0,
- 0,9,18,1,12,1,18,1,18,1,12,1,9,1,15,1,
- 15,1,12,1,9,1,15,1,12,1,22,1,15,1,9,1,
- 12,1,22,1,12,1,9,1,12,1,19,1,114,85,0,0,
- 0,99,1,0,0,0,0,0,0,0,5,0,0,0,12,0,
- 0,0,67,0,0,0,115,164,0,0,0,116,0,0,124,0,
- 0,131,1,0,100,1,0,107,2,0,114,22,0,100,2,0,
- 83,124,0,0,106,1,0,100,3,0,131,1,0,92,3,0,
- 125,1,0,125,2,0,125,3,0,124,1,0,12,115,81,0,
- 124,3,0,106,2,0,131,0,0,100,7,0,100,8,0,133,
- 2,0,25,100,6,0,107,3,0,114,85,0,124,0,0,83,
- 121,16,0,116,3,0,124,0,0,131,1,0,125,4,0,87,
- 110,40,0,4,116,4,0,116,5,0,102,2,0,107,10,0,
- 114,143,0,1,1,1,124,0,0,100,2,0,100,9,0,133,
- 2,0,25,125,4,0,89,110,1,0,88,116,6,0,124,4,
- 0,131,1,0,114,160,0,124,4,0,83,124,0,0,83,41,
- 10,122,188,67,111,110,118,101,114,116,32,97,32,98,121,116,
- 101,99,111,100,101,32,102,105,108,101,32,112,97,116,104,32,
- 116,111,32,97,32,115,111,117,114,99,101,32,112,97,116,104,
- 32,40,105,102,32,112,111,115,115,105,98,108,101,41,46,10,
- 10,32,32,32,32,84,104,105,115,32,102,117,110,99,116,105,
- 111,110,32,101,120,105,115,116,115,32,112,117,114,101,108,121,
- 32,102,111,114,32,98,97,99,107,119,97,114,100,115,45,99,
- 111,109,112,97,116,105,98,105,108,105,116,121,32,102,111,114,
- 10,32,32,32,32,80,121,73,109,112,111,114,116,95,69,120,
- 101,99,67,111,100,101,77,111,100,117,108,101,87,105,116,104,
- 70,105,108,101,110,97,109,101,115,40,41,32,105,110,32,116,
- 104,101,32,67,32,65,80,73,46,10,10,32,32,32,32,114,
- 59,0,0,0,78,114,58,0,0,0,114,80,0,0,0,114,
- 29,0,0,0,90,2,112,121,233,253,255,255,255,233,255,255,
- 255,255,114,87,0,0,0,41,7,114,31,0,0,0,114,32,
- 0,0,0,218,5,108,111,119,101,114,114,85,0,0,0,114,
- 66,0,0,0,114,71,0,0,0,114,44,0,0,0,41,5,
- 218,13,98,121,116,101,99,111,100,101,95,112,97,116,104,114,
- 78,0,0,0,114,36,0,0,0,90,9,101,120,116,101,110,
- 115,105,111,110,218,11,115,111,117,114,99,101,95,112,97,116,
- 104,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
- 218,15,95,103,101,116,95,115,111,117,114,99,101,102,105,108,
- 101,64,1,0,0,115,20,0,0,0,0,7,18,1,4,1,
- 24,1,35,1,4,1,3,1,16,1,19,1,21,1,114,91,
- 0,0,0,99,1,0,0,0,0,0,0,0,1,0,0,0,
- 11,0,0,0,67,0,0,0,115,92,0,0,0,124,0,0,
- 106,0,0,116,1,0,116,2,0,131,1,0,131,1,0,114,
- 59,0,121,14,0,116,3,0,124,0,0,131,1,0,83,87,
- 113,88,0,4,116,4,0,107,10,0,114,55,0,1,1,1,
- 89,113,88,0,88,110,29,0,124,0,0,106,0,0,116,1,
- 0,116,5,0,131,1,0,131,1,0,114,84,0,124,0,0,
- 83,100,0,0,83,100,0,0,83,41,1,78,41,6,218,8,
- 101,110,100,115,119,105,116,104,218,5,116,117,112,108,101,114,
- 84,0,0,0,114,79,0,0,0,114,66,0,0,0,114,74,
- 0,0,0,41,1,218,8,102,105,108,101,110,97,109,101,114,
- 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,11,
- 95,103,101,116,95,99,97,99,104,101,100,83,1,0,0,115,
- 16,0,0,0,0,1,21,1,3,1,14,1,13,1,8,1,
- 21,1,4,2,114,95,0,0,0,99,1,0,0,0,0,0,
- 0,0,2,0,0,0,11,0,0,0,67,0,0,0,115,60,
- 0,0,0,121,19,0,116,0,0,124,0,0,131,1,0,106,
- 1,0,125,1,0,87,110,24,0,4,116,2,0,107,10,0,
- 114,45,0,1,1,1,100,1,0,125,1,0,89,110,1,0,
- 88,124,1,0,100,2,0,79,125,1,0,124,1,0,83,41,
- 3,122,51,67,97,108,99,117,108,97,116,101,32,116,104,101,
- 32,109,111,100,101,32,112,101,114,109,105,115,115,105,111,110,
- 115,32,102,111,114,32,97,32,98,121,116,101,99,111,100,101,
- 32,102,105,108,101,46,105,182,1,0,0,233,128,0,0,0,
- 41,3,114,39,0,0,0,114,41,0,0,0,114,40,0,0,
- 0,41,2,114,35,0,0,0,114,42,0,0,0,114,4,0,
- 0,0,114,4,0,0,0,114,5,0,0,0,218,10,95,99,
- 97,108,99,95,109,111,100,101,95,1,0,0,115,12,0,0,
- 0,0,2,3,1,19,1,13,1,11,3,10,1,114,97,0,
- 0,0,218,9,118,101,114,98,111,115,105,116,121,114,29,0,
- 0,0,99,1,0,0,0,1,0,0,0,3,0,0,0,4,
- 0,0,0,71,0,0,0,115,75,0,0,0,116,0,0,106,
- 1,0,106,2,0,124,1,0,107,5,0,114,71,0,124,0,
- 0,106,3,0,100,6,0,131,1,0,115,43,0,100,3,0,
- 124,0,0,23,125,0,0,116,4,0,124,0,0,106,5,0,
- 124,2,0,140,0,0,100,4,0,116,0,0,106,6,0,131,
- 1,1,1,100,5,0,83,41,7,122,61,80,114,105,110,116,
- 32,116,104,101,32,109,101,115,115,97,103,101,32,116,111,32,
- 115,116,100,101,114,114,32,105,102,32,45,118,47,80,89,84,
- 72,79,78,86,69,82,66,79,83,69,32,105,115,32,116,117,
- 114,110,101,100,32,111,110,46,250,1,35,250,7,105,109,112,
- 111,114,116,32,122,2,35,32,114,54,0,0,0,78,41,2,
- 114,99,0,0,0,114,100,0,0,0,41,7,114,7,0,0,
- 0,114,67,0,0,0,218,7,118,101,114,98,111,115,101,114,
- 9,0,0,0,218,5,112,114,105,110,116,114,47,0,0,0,
- 218,6,115,116,100,101,114,114,41,3,114,75,0,0,0,114,
- 98,0,0,0,218,4,97,114,103,115,114,4,0,0,0,114,
- 4,0,0,0,114,5,0,0,0,218,16,95,118,101,114,98,
- 111,115,101,95,109,101,115,115,97,103,101,107,1,0,0,115,
- 8,0,0,0,0,2,18,1,15,1,10,1,114,105,0,0,
- 0,99,1,0,0,0,0,0,0,0,3,0,0,0,11,0,
- 0,0,3,0,0,0,115,84,0,0,0,100,1,0,135,0,
- 0,102,1,0,100,2,0,100,3,0,134,1,0,125,1,0,
- 121,13,0,116,0,0,106,1,0,125,2,0,87,110,30,0,
- 4,116,2,0,107,10,0,114,66,0,1,1,1,100,4,0,
- 100,5,0,132,0,0,125,2,0,89,110,1,0,88,124,2,
- 0,124,1,0,136,0,0,131,2,0,1,124,1,0,83,41,
- 6,122,252,68,101,99,111,114,97,116,111,114,32,116,111,32,
- 118,101,114,105,102,121,32,116,104,97,116,32,116,104,101,32,
- 109,111,100,117,108,101,32,98,101,105,110,103,32,114,101,113,
- 117,101,115,116,101,100,32,109,97,116,99,104,101,115,32,116,
- 104,101,32,111,110,101,32,116,104,101,10,32,32,32,32,108,
- 111,97,100,101,114,32,99,97,110,32,104,97,110,100,108,101,
- 46,10,10,32,32,32,32,84,104,101,32,102,105,114,115,116,
- 32,97,114,103,117,109,101,110,116,32,40,115,101,108,102,41,
- 32,109,117,115,116,32,100,101,102,105,110,101,32,95,110,97,
- 109,101,32,119,104,105,99,104,32,116,104,101,32,115,101,99,
- 111,110,100,32,97,114,103,117,109,101,110,116,32,105,115,10,
- 32,32,32,32,99,111,109,112,97,114,101,100,32,97,103,97,
- 105,110,115,116,46,32,73,102,32,116,104,101,32,99,111,109,
- 112,97,114,105,115,111,110,32,102,97,105,108,115,32,116,104,
- 101,110,32,73,109,112,111,114,116,69,114,114,111,114,32,105,
- 115,32,114,97,105,115,101,100,46,10,10,32,32,32,32,78,
- 99,2,0,0,0,0,0,0,0,4,0,0,0,5,0,0,
- 0,31,0,0,0,115,89,0,0,0,124,1,0,100,0,0,
- 107,8,0,114,24,0,124,0,0,106,0,0,125,1,0,110,
- 46,0,124,0,0,106,0,0,124,1,0,107,3,0,114,70,
- 0,116,1,0,100,1,0,124,0,0,106,0,0,124,1,0,
- 102,2,0,22,100,2,0,124,1,0,131,1,1,130,1,0,
- 136,0,0,124,0,0,124,1,0,124,2,0,124,3,0,142,
- 2,0,83,41,3,78,122,30,108,111,97,100,101,114,32,102,
- 111,114,32,37,115,32,99,97,110,110,111,116,32,104,97,110,
- 100,108,101,32,37,115,218,4,110,97,109,101,41,2,114,106,
- 0,0,0,218,11,73,109,112,111,114,116,69,114,114,111,114,
- 41,4,218,4,115,101,108,102,114,106,0,0,0,114,104,0,
- 0,0,90,6,107,119,97,114,103,115,41,1,218,6,109,101,
+ 32,78,111,110,101,233,0,0,0,0,122,24,123,33,114,125,
+ 32,105,115,32,110,111,116,32,97,108,112,104,97,110,117,109,
+ 101,114,105,99,122,7,123,125,46,123,125,123,125,41,21,218,
+ 9,95,119,97,114,110,105,110,103,115,218,4,119,97,114,110,
+ 218,18,68,101,112,114,101,99,97,116,105,111,110,87,97,114,
+ 110,105,110,103,218,9,84,121,112,101,69,114,114,111,114,114,
+ 38,0,0,0,114,32,0,0,0,114,7,0,0,0,218,14,
+ 105,109,112,108,101,109,101,110,116,97,116,105,111,110,218,9,
+ 99,97,99,104,101,95,116,97,103,218,19,78,111,116,73,109,
+ 112,108,101,109,101,110,116,101,100,69,114,114,111,114,114,26,
+ 0,0,0,218,5,102,108,97,103,115,218,8,111,112,116,105,
+ 109,105,122,101,218,3,115,116,114,218,7,105,115,97,108,110,
+ 117,109,218,10,86,97,108,117,101,69,114,114,111,114,114,47,
+ 0,0,0,218,4,95,79,80,84,114,28,0,0,0,218,8,
+ 95,80,89,67,65,67,72,69,218,17,66,89,84,69,67,79,
+ 68,69,95,83,85,70,70,73,88,69,83,41,11,114,35,0,
+ 0,0,90,14,100,101,98,117,103,95,111,118,101,114,114,105,
+ 100,101,114,57,0,0,0,218,7,109,101,115,115,97,103,101,
+ 218,4,104,101,97,100,114,37,0,0,0,90,4,98,97,115,
+ 101,218,3,115,101,112,218,4,114,101,115,116,90,3,116,97,
+ 103,90,15,97,108,109,111,115,116,95,102,105,108,101,110,97,
+ 109,101,114,4,0,0,0,114,4,0,0,0,114,5,0,0,
+ 0,218,17,99,97,99,104,101,95,102,114,111,109,95,115,111,
+ 117,114,99,101,243,0,0,0,115,46,0,0,0,0,18,12,
+ 1,9,1,7,1,12,1,6,1,12,1,18,1,18,1,24,
+ 1,12,1,12,1,12,1,36,1,12,1,18,1,9,2,12,
+ 1,12,1,12,1,12,1,21,1,21,1,114,79,0,0,0,
+ 99,1,0,0,0,0,0,0,0,8,0,0,0,5,0,0,
+ 0,67,0,0,0,115,62,1,0,0,116,0,0,106,1,0,
+ 106,2,0,100,1,0,107,8,0,114,30,0,116,3,0,100,
+ 2,0,131,1,0,130,1,0,116,4,0,124,0,0,131,1,
+ 0,92,2,0,125,1,0,125,2,0,116,4,0,124,1,0,
+ 131,1,0,92,2,0,125,1,0,125,3,0,124,3,0,116,
+ 5,0,107,3,0,114,102,0,116,6,0,100,3,0,106,7,
+ 0,116,5,0,124,0,0,131,2,0,131,1,0,130,1,0,
+ 124,2,0,106,8,0,100,4,0,131,1,0,125,4,0,124,
+ 4,0,100,11,0,107,7,0,114,153,0,116,6,0,100,7,
+ 0,106,7,0,124,2,0,131,1,0,131,1,0,130,1,0,
+ 110,125,0,124,4,0,100,6,0,107,2,0,114,22,1,124,
+ 2,0,106,9,0,100,4,0,100,5,0,131,2,0,100,12,
+ 0,25,125,5,0,124,5,0,106,10,0,116,11,0,131,1,
+ 0,115,223,0,116,6,0,100,8,0,106,7,0,116,11,0,
+ 131,1,0,131,1,0,130,1,0,124,5,0,116,12,0,116,
+ 11,0,131,1,0,100,1,0,133,2,0,25,125,6,0,124,
+ 6,0,106,13,0,131,0,0,115,22,1,116,6,0,100,9,
+ 0,106,7,0,124,5,0,131,1,0,131,1,0,130,1,0,
+ 124,2,0,106,14,0,100,4,0,131,1,0,100,10,0,25,
+ 125,7,0,116,15,0,124,1,0,124,7,0,116,16,0,100,
+ 10,0,25,23,131,2,0,83,41,13,97,110,1,0,0,71,
+ 105,118,101,110,32,116,104,101,32,112,97,116,104,32,116,111,
+ 32,97,32,46,112,121,99,46,32,102,105,108,101,44,32,114,
+ 101,116,117,114,110,32,116,104,101,32,112,97,116,104,32,116,
+ 111,32,105,116,115,32,46,112,121,32,102,105,108,101,46,10,
+ 10,32,32,32,32,84,104,101,32,46,112,121,99,32,102,105,
+ 108,101,32,100,111,101,115,32,110,111,116,32,110,101,101,100,
+ 32,116,111,32,101,120,105,115,116,59,32,116,104,105,115,32,
+ 115,105,109,112,108,121,32,114,101,116,117,114,110,115,32,116,
+ 104,101,32,112,97,116,104,32,116,111,10,32,32,32,32,116,
+ 104,101,32,46,112,121,32,102,105,108,101,32,99,97,108,99,
+ 117,108,97,116,101,100,32,116,111,32,99,111,114,114,101,115,
+ 112,111,110,100,32,116,111,32,116,104,101,32,46,112,121,99,
+ 32,102,105,108,101,46,32,32,73,102,32,112,97,116,104,32,
+ 100,111,101,115,10,32,32,32,32,110,111,116,32,99,111,110,
+ 102,111,114,109,32,116,111,32,80,69,80,32,51,49,52,55,
+ 47,52,56,56,32,102,111,114,109,97,116,44,32,86,97,108,
+ 117,101,69,114,114,111,114,32,119,105,108,108,32,98,101,32,
+ 114,97,105,115,101,100,46,32,73,102,10,32,32,32,32,115,
+ 121,115,46,105,109,112,108,101,109,101,110,116,97,116,105,111,
+ 110,46,99,97,99,104,101,95,116,97,103,32,105,115,32,78,
+ 111,110,101,32,116,104,101,110,32,78,111,116,73,109,112,108,
+ 101,109,101,110,116,101,100,69,114,114,111,114,32,105,115,32,
+ 114,97,105,115,101,100,46,10,10,32,32,32,32,78,122,36,
+ 115,121,115,46,105,109,112,108,101,109,101,110,116,97,116,105,
+ 111,110,46,99,97,99,104,101,95,116,97,103,32,105,115,32,
+ 78,111,110,101,122,37,123,125,32,110,111,116,32,98,111,116,
+ 116,111,109,45,108,101,118,101,108,32,100,105,114,101,99,116,
+ 111,114,121,32,105,110,32,123,33,114,125,114,58,0,0,0,
+ 114,56,0,0,0,233,3,0,0,0,122,33,101,120,112,101,
+ 99,116,101,100,32,111,110,108,121,32,50,32,111,114,32,51,
+ 32,100,111,116,115,32,105,110,32,123,33,114,125,122,57,111,
+ 112,116,105,109,105,122,97,116,105,111,110,32,112,111,114,116,
+ 105,111,110,32,111,102,32,102,105,108,101,110,97,109,101,32,
+ 100,111,101,115,32,110,111,116,32,115,116,97,114,116,32,119,
+ 105,116,104,32,123,33,114,125,122,52,111,112,116,105,109,105,
+ 122,97,116,105,111,110,32,108,101,118,101,108,32,123,33,114,
+ 125,32,105,115,32,110,111,116,32,97,110,32,97,108,112,104,
+ 97,110,117,109,101,114,105,99,32,118,97,108,117,101,114,59,
+ 0,0,0,62,2,0,0,0,114,56,0,0,0,114,80,0,
+ 0,0,233,254,255,255,255,41,17,114,7,0,0,0,114,64,
+ 0,0,0,114,65,0,0,0,114,66,0,0,0,114,38,0,
+ 0,0,114,73,0,0,0,114,71,0,0,0,114,47,0,0,
+ 0,218,5,99,111,117,110,116,114,34,0,0,0,114,9,0,
+ 0,0,114,72,0,0,0,114,31,0,0,0,114,70,0,0,
+ 0,218,9,112,97,114,116,105,116,105,111,110,114,28,0,0,
+ 0,218,15,83,79,85,82,67,69,95,83,85,70,70,73,88,
+ 69,83,41,8,114,35,0,0,0,114,76,0,0,0,90,16,
+ 112,121,99,97,99,104,101,95,102,105,108,101,110,97,109,101,
+ 90,7,112,121,99,97,99,104,101,90,9,100,111,116,95,99,
+ 111,117,110,116,114,57,0,0,0,90,9,111,112,116,95,108,
+ 101,118,101,108,90,13,98,97,115,101,95,102,105,108,101,110,
+ 97,109,101,114,4,0,0,0,114,4,0,0,0,114,5,0,
+ 0,0,218,17,115,111,117,114,99,101,95,102,114,111,109,95,
+ 99,97,99,104,101,31,1,0,0,115,44,0,0,0,0,9,
+ 18,1,12,1,18,1,18,1,12,1,9,1,15,1,15,1,
+ 12,1,9,1,15,1,12,1,22,1,15,1,9,1,12,1,
+ 22,1,12,1,9,1,12,1,19,1,114,85,0,0,0,99,
+ 1,0,0,0,0,0,0,0,5,0,0,0,12,0,0,0,
+ 67,0,0,0,115,164,0,0,0,116,0,0,124,0,0,131,
+ 1,0,100,1,0,107,2,0,114,22,0,100,2,0,83,124,
+ 0,0,106,1,0,100,3,0,131,1,0,92,3,0,125,1,
+ 0,125,2,0,125,3,0,124,1,0,12,115,81,0,124,3,
+ 0,106,2,0,131,0,0,100,7,0,100,8,0,133,2,0,
+ 25,100,6,0,107,3,0,114,85,0,124,0,0,83,121,16,
+ 0,116,3,0,124,0,0,131,1,0,125,4,0,87,110,40,
+ 0,4,116,4,0,116,5,0,102,2,0,107,10,0,114,143,
+ 0,1,1,1,124,0,0,100,2,0,100,9,0,133,2,0,
+ 25,125,4,0,89,110,1,0,88,116,6,0,124,4,0,131,
+ 1,0,114,160,0,124,4,0,83,124,0,0,83,41,10,122,
+ 188,67,111,110,118,101,114,116,32,97,32,98,121,116,101,99,
+ 111,100,101,32,102,105,108,101,32,112,97,116,104,32,116,111,
+ 32,97,32,115,111,117,114,99,101,32,112,97,116,104,32,40,
+ 105,102,32,112,111,115,115,105,98,108,101,41,46,10,10,32,
+ 32,32,32,84,104,105,115,32,102,117,110,99,116,105,111,110,
+ 32,101,120,105,115,116,115,32,112,117,114,101,108,121,32,102,
+ 111,114,32,98,97,99,107,119,97,114,100,115,45,99,111,109,
+ 112,97,116,105,98,105,108,105,116,121,32,102,111,114,10,32,
+ 32,32,32,80,121,73,109,112,111,114,116,95,69,120,101,99,
+ 67,111,100,101,77,111,100,117,108,101,87,105,116,104,70,105,
+ 108,101,110,97,109,101,115,40,41,32,105,110,32,116,104,101,
+ 32,67,32,65,80,73,46,10,10,32,32,32,32,114,59,0,
+ 0,0,78,114,58,0,0,0,114,80,0,0,0,114,29,0,
+ 0,0,90,2,112,121,233,253,255,255,255,233,255,255,255,255,
+ 114,87,0,0,0,41,7,114,31,0,0,0,114,32,0,0,
+ 0,218,5,108,111,119,101,114,114,85,0,0,0,114,66,0,
+ 0,0,114,71,0,0,0,114,44,0,0,0,41,5,218,13,
+ 98,121,116,101,99,111,100,101,95,112,97,116,104,114,78,0,
+ 0,0,114,36,0,0,0,90,9,101,120,116,101,110,115,105,
+ 111,110,218,11,115,111,117,114,99,101,95,112,97,116,104,114,
+ 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,15,
+ 95,103,101,116,95,115,111,117,114,99,101,102,105,108,101,64,
+ 1,0,0,115,20,0,0,0,0,7,18,1,4,1,24,1,
+ 35,1,4,1,3,1,16,1,19,1,21,1,114,91,0,0,
+ 0,99,1,0,0,0,0,0,0,0,1,0,0,0,11,0,
+ 0,0,67,0,0,0,115,92,0,0,0,124,0,0,106,0,
+ 0,116,1,0,116,2,0,131,1,0,131,1,0,114,59,0,
+ 121,14,0,116,3,0,124,0,0,131,1,0,83,87,113,88,
+ 0,4,116,4,0,107,10,0,114,55,0,1,1,1,89,113,
+ 88,0,88,110,29,0,124,0,0,106,0,0,116,1,0,116,
+ 5,0,131,1,0,131,1,0,114,84,0,124,0,0,83,100,
+ 0,0,83,100,0,0,83,41,1,78,41,6,218,8,101,110,
+ 100,115,119,105,116,104,218,5,116,117,112,108,101,114,84,0,
+ 0,0,114,79,0,0,0,114,66,0,0,0,114,74,0,0,
+ 0,41,1,218,8,102,105,108,101,110,97,109,101,114,4,0,
+ 0,0,114,4,0,0,0,114,5,0,0,0,218,11,95,103,
+ 101,116,95,99,97,99,104,101,100,83,1,0,0,115,16,0,
+ 0,0,0,1,21,1,3,1,14,1,13,1,8,1,21,1,
+ 4,2,114,95,0,0,0,99,1,0,0,0,0,0,0,0,
+ 2,0,0,0,11,0,0,0,67,0,0,0,115,60,0,0,
+ 0,121,19,0,116,0,0,124,0,0,131,1,0,106,1,0,
+ 125,1,0,87,110,24,0,4,116,2,0,107,10,0,114,45,
+ 0,1,1,1,100,1,0,125,1,0,89,110,1,0,88,124,
+ 1,0,100,2,0,79,125,1,0,124,1,0,83,41,3,122,
+ 51,67,97,108,99,117,108,97,116,101,32,116,104,101,32,109,
+ 111,100,101,32,112,101,114,109,105,115,115,105,111,110,115,32,
+ 102,111,114,32,97,32,98,121,116,101,99,111,100,101,32,102,
+ 105,108,101,46,105,182,1,0,0,233,128,0,0,0,41,3,
+ 114,39,0,0,0,114,41,0,0,0,114,40,0,0,0,41,
+ 2,114,35,0,0,0,114,42,0,0,0,114,4,0,0,0,
+ 114,4,0,0,0,114,5,0,0,0,218,10,95,99,97,108,
+ 99,95,109,111,100,101,95,1,0,0,115,12,0,0,0,0,
+ 2,3,1,19,1,13,1,11,3,10,1,114,97,0,0,0,
+ 99,1,0,0,0,0,0,0,0,3,0,0,0,11,0,0,
+ 0,3,0,0,0,115,84,0,0,0,100,1,0,135,0,0,
+ 102,1,0,100,2,0,100,3,0,134,1,0,125,1,0,121,
+ 13,0,116,0,0,106,1,0,125,2,0,87,110,30,0,4,
+ 116,2,0,107,10,0,114,66,0,1,1,1,100,4,0,100,
+ 5,0,132,0,0,125,2,0,89,110,1,0,88,124,2,0,
+ 124,1,0,136,0,0,131,2,0,1,124,1,0,83,41,6,
+ 122,252,68,101,99,111,114,97,116,111,114,32,116,111,32,118,
+ 101,114,105,102,121,32,116,104,97,116,32,116,104,101,32,109,
+ 111,100,117,108,101,32,98,101,105,110,103,32,114,101,113,117,
+ 101,115,116,101,100,32,109,97,116,99,104,101,115,32,116,104,
+ 101,32,111,110,101,32,116,104,101,10,32,32,32,32,108,111,
+ 97,100,101,114,32,99,97,110,32,104,97,110,100,108,101,46,
+ 10,10,32,32,32,32,84,104,101,32,102,105,114,115,116,32,
+ 97,114,103,117,109,101,110,116,32,40,115,101,108,102,41,32,
+ 109,117,115,116,32,100,101,102,105,110,101,32,95,110,97,109,
+ 101,32,119,104,105,99,104,32,116,104,101,32,115,101,99,111,
+ 110,100,32,97,114,103,117,109,101,110,116,32,105,115,10,32,
+ 32,32,32,99,111,109,112,97,114,101,100,32,97,103,97,105,
+ 110,115,116,46,32,73,102,32,116,104,101,32,99,111,109,112,
+ 97,114,105,115,111,110,32,102,97,105,108,115,32,116,104,101,
+ 110,32,73,109,112,111,114,116,69,114,114,111,114,32,105,115,
+ 32,114,97,105,115,101,100,46,10,10,32,32,32,32,78,99,
+ 2,0,0,0,0,0,0,0,4,0,0,0,5,0,0,0,
+ 31,0,0,0,115,89,0,0,0,124,1,0,100,0,0,107,
+ 8,0,114,24,0,124,0,0,106,0,0,125,1,0,110,46,
+ 0,124,0,0,106,0,0,124,1,0,107,3,0,114,70,0,
+ 116,1,0,100,1,0,124,0,0,106,0,0,124,1,0,102,
+ 2,0,22,100,2,0,124,1,0,131,1,1,130,1,0,136,
+ 0,0,124,0,0,124,1,0,124,2,0,124,3,0,142,2,
+ 0,83,41,3,78,122,30,108,111,97,100,101,114,32,102,111,
+ 114,32,37,115,32,99,97,110,110,111,116,32,104,97,110,100,
+ 108,101,32,37,115,218,4,110,97,109,101,41,2,114,98,0,
+ 0,0,218,11,73,109,112,111,114,116,69,114,114,111,114,41,
+ 4,218,4,115,101,108,102,114,98,0,0,0,218,4,97,114,
+ 103,115,90,6,107,119,97,114,103,115,41,1,218,6,109,101,
116,104,111,100,114,4,0,0,0,114,5,0,0,0,218,19,
95,99,104,101,99,107,95,110,97,109,101,95,119,114,97,112,
- 112,101,114,123,1,0,0,115,12,0,0,0,0,1,12,1,
+ 112,101,114,115,1,0,0,115,12,0,0,0,0,1,12,1,
12,1,15,1,6,1,25,1,122,40,95,99,104,101,99,107,
95,110,97,109,101,46,60,108,111,99,97,108,115,62,46,95,
99,104,101,99,107,95,110,97,109,101,95,119,114,97,112,112,
@@ -595,17 +573,17 @@
116,97,116,116,114,218,8,95,95,100,105,99,116,95,95,218,
6,117,112,100,97,116,101,41,3,90,3,110,101,119,90,3,
111,108,100,114,52,0,0,0,114,4,0,0,0,114,4,0,
- 0,0,114,5,0,0,0,218,5,95,119,114,97,112,134,1,
+ 0,0,114,5,0,0,0,218,5,95,119,114,97,112,126,1,
0,0,115,8,0,0,0,0,1,25,1,15,1,29,1,122,
26,95,99,104,101,99,107,95,110,97,109,101,46,60,108,111,
99,97,108,115,62,46,95,119,114,97,112,41,3,218,10,95,
- 98,111,111,116,115,116,114,97,112,114,120,0,0,0,218,9,
- 78,97,109,101,69,114,114,111,114,41,3,114,109,0,0,0,
- 114,110,0,0,0,114,120,0,0,0,114,4,0,0,0,41,
- 1,114,109,0,0,0,114,5,0,0,0,218,11,95,99,104,
- 101,99,107,95,110,97,109,101,115,1,0,0,115,14,0,0,
+ 98,111,111,116,115,116,114,97,112,114,113,0,0,0,218,9,
+ 78,97,109,101,69,114,114,111,114,41,3,114,102,0,0,0,
+ 114,103,0,0,0,114,113,0,0,0,114,4,0,0,0,41,
+ 1,114,102,0,0,0,114,5,0,0,0,218,11,95,99,104,
+ 101,99,107,95,110,97,109,101,107,1,0,0,115,14,0,0,
0,0,8,21,7,3,1,13,1,13,2,17,5,13,1,114,
- 123,0,0,0,99,2,0,0,0,0,0,0,0,5,0,0,
+ 116,0,0,0,99,2,0,0,0,0,0,0,0,5,0,0,
0,4,0,0,0,67,0,0,0,115,84,0,0,0,124,0,
0,106,0,0,124,1,0,131,1,0,92,2,0,125,2,0,
125,3,0,124,2,0,100,1,0,107,8,0,114,80,0,116,
@@ -628,14 +606,14 @@
114,59,0,0,0,41,6,218,11,102,105,110,100,95,108,111,
97,100,101,114,114,31,0,0,0,114,60,0,0,0,114,61,
0,0,0,114,47,0,0,0,218,13,73,109,112,111,114,116,
- 87,97,114,110,105,110,103,41,5,114,108,0,0,0,218,8,
+ 87,97,114,110,105,110,103,41,5,114,100,0,0,0,218,8,
102,117,108,108,110,97,109,101,218,6,108,111,97,100,101,114,
218,8,112,111,114,116,105,111,110,115,218,3,109,115,103,114,
4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,17,
95,102,105,110,100,95,109,111,100,117,108,101,95,115,104,105,
- 109,143,1,0,0,115,10,0,0,0,0,10,21,1,24,1,
- 6,1,29,1,114,130,0,0,0,99,4,0,0,0,0,0,
- 0,0,11,0,0,0,19,0,0,0,67,0,0,0,115,240,
+ 109,135,1,0,0,115,10,0,0,0,0,10,21,1,24,1,
+ 6,1,29,1,114,123,0,0,0,99,4,0,0,0,0,0,
+ 0,0,11,0,0,0,19,0,0,0,67,0,0,0,115,252,
1,0,0,105,0,0,125,4,0,124,2,0,100,1,0,107,
9,0,114,31,0,124,2,0,124,4,0,100,2,0,60,110,
6,0,100,3,0,125,2,0,124,3,0,100,1,0,107,9,
@@ -643,1955 +621,1960 @@
0,100,1,0,100,5,0,133,2,0,25,125,5,0,124,0,
0,100,5,0,100,6,0,133,2,0,25,125,6,0,124,0,
0,100,6,0,100,7,0,133,2,0,25,125,7,0,124,5,
- 0,116,0,0,107,3,0,114,168,0,100,8,0,106,1,0,
- 124,2,0,124,5,0,131,2,0,125,8,0,116,2,0,100,
- 9,0,124,8,0,131,2,0,1,116,3,0,124,8,0,124,
- 4,0,141,1,0,130,1,0,110,119,0,116,4,0,124,6,
- 0,131,1,0,100,5,0,107,3,0,114,229,0,100,10,0,
- 106,1,0,124,2,0,131,1,0,125,8,0,116,2,0,100,
- 9,0,124,8,0,131,2,0,1,116,5,0,124,8,0,131,
- 1,0,130,1,0,110,58,0,116,4,0,124,7,0,131,1,
- 0,100,5,0,107,3,0,114,31,1,100,11,0,106,1,0,
- 124,2,0,131,1,0,125,8,0,116,2,0,100,9,0,124,
- 8,0,131,2,0,1,116,5,0,124,8,0,131,1,0,130,
- 1,0,124,1,0,100,1,0,107,9,0,114,226,1,121,20,
- 0,116,6,0,124,1,0,100,12,0,25,131,1,0,125,9,
- 0,87,110,18,0,4,116,7,0,107,10,0,114,83,1,1,
- 1,1,89,110,62,0,88,116,8,0,124,6,0,131,1,0,
- 124,9,0,107,3,0,114,145,1,100,13,0,106,1,0,124,
- 2,0,131,1,0,125,8,0,116,2,0,100,9,0,124,8,
- 0,131,2,0,1,116,3,0,124,8,0,124,4,0,141,1,
- 0,130,1,0,121,18,0,124,1,0,100,14,0,25,100,15,
- 0,64,125,10,0,87,110,18,0,4,116,7,0,107,10,0,
- 114,183,1,1,1,1,89,110,43,0,88,116,8,0,124,7,
- 0,131,1,0,124,10,0,107,3,0,114,226,1,116,3,0,
- 100,13,0,106,1,0,124,2,0,131,1,0,124,4,0,141,
- 1,0,130,1,0,124,0,0,100,7,0,100,1,0,133,2,
- 0,25,83,41,16,97,122,1,0,0,86,97,108,105,100,97,
- 116,101,32,116,104,101,32,104,101,97,100,101,114,32,111,102,
- 32,116,104,101,32,112,97,115,115,101,100,45,105,110,32,98,
- 121,116,101,99,111,100,101,32,97,103,97,105,110,115,116,32,
- 115,111,117,114,99,101,95,115,116,97,116,115,32,40,105,102,
- 10,32,32,32,32,103,105,118,101,110,41,32,97,110,100,32,
- 114,101,116,117,114,110,105,110,103,32,116,104,101,32,98,121,
- 116,101,99,111,100,101,32,116,104,97,116,32,99,97,110,32,
- 98,101,32,99,111,109,112,105,108,101,100,32,98,121,32,99,
- 111,109,112,105,108,101,40,41,46,10,10,32,32,32,32,65,
- 108,108,32,111,116,104,101,114,32,97,114,103,117,109,101,110,
- 116,115,32,97,114,101,32,117,115,101,100,32,116,111,32,101,
- 110,104,97,110,99,101,32,101,114,114,111,114,32,114,101,112,
- 111,114,116,105,110,103,46,10,10,32,32,32,32,73,109,112,
- 111,114,116,69,114,114,111,114,32,105,115,32,114,97,105,115,
- 101,100,32,119,104,101,110,32,116,104,101,32,109,97,103,105,
- 99,32,110,117,109,98,101,114,32,105,115,32,105,110,99,111,
- 114,114,101,99,116,32,111,114,32,116,104,101,32,98,121,116,
- 101,99,111,100,101,32,105,115,10,32,32,32,32,102,111,117,
- 110,100,32,116,111,32,98,101,32,115,116,97,108,101,46,32,
- 69,79,70,69,114,114,111,114,32,105,115,32,114,97,105,115,
- 101,100,32,119,104,101,110,32,116,104,101,32,100,97,116,97,
- 32,105,115,32,102,111,117,110,100,32,116,111,32,98,101,10,
- 32,32,32,32,116,114,117,110,99,97,116,101,100,46,10,10,
- 32,32,32,32,78,114,106,0,0,0,122,10,60,98,121,116,
- 101,99,111,100,101,62,114,35,0,0,0,114,12,0,0,0,
- 233,8,0,0,0,233,12,0,0,0,122,30,98,97,100,32,
- 109,97,103,105,99,32,110,117,109,98,101,114,32,105,110,32,
- 123,33,114,125,58,32,123,33,114,125,122,2,123,125,122,43,
- 114,101,97,99,104,101,100,32,69,79,70,32,119,104,105,108,
- 101,32,114,101,97,100,105,110,103,32,116,105,109,101,115,116,
- 97,109,112,32,105,110,32,123,33,114,125,122,48,114,101,97,
- 99,104,101,100,32,69,79,70,32,119,104,105,108,101,32,114,
- 101,97,100,105,110,103,32,115,105,122,101,32,111,102,32,115,
- 111,117,114,99,101,32,105,110,32,123,33,114,125,218,5,109,
- 116,105,109,101,122,26,98,121,116,101,99,111,100,101,32,105,
- 115,32,115,116,97,108,101,32,102,111,114,32,123,33,114,125,
- 218,4,115,105,122,101,108,3,0,0,0,255,127,255,127,3,
- 0,41,9,218,12,77,65,71,73,67,95,78,85,77,66,69,
- 82,114,47,0,0,0,114,105,0,0,0,114,107,0,0,0,
- 114,31,0,0,0,218,8,69,79,70,69,114,114,111,114,114,
- 14,0,0,0,218,8,75,101,121,69,114,114,111,114,114,19,
- 0,0,0,41,11,114,53,0,0,0,218,12,115,111,117,114,
- 99,101,95,115,116,97,116,115,114,106,0,0,0,114,35,0,
- 0,0,90,11,101,120,99,95,100,101,116,97,105,108,115,90,
- 5,109,97,103,105,99,90,13,114,97,119,95,116,105,109,101,
- 115,116,97,109,112,90,8,114,97,119,95,115,105,122,101,114,
- 75,0,0,0,218,12,115,111,117,114,99,101,95,109,116,105,
- 109,101,218,11,115,111,117,114,99,101,95,115,105,122,101,114,
- 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,25,
- 95,118,97,108,105,100,97,116,101,95,98,121,116,101,99,111,
- 100,101,95,104,101,97,100,101,114,160,1,0,0,115,76,0,
- 0,0,0,11,6,1,12,1,13,3,6,1,12,1,10,1,
- 16,1,16,1,16,1,12,1,18,1,13,1,18,1,18,1,
- 15,1,13,1,15,1,18,1,15,1,13,1,12,1,12,1,
- 3,1,20,1,13,1,5,2,18,1,15,1,13,1,15,1,
- 3,1,18,1,13,1,5,2,18,1,15,1,9,1,114,141,
- 0,0,0,99,4,0,0,0,0,0,0,0,5,0,0,0,
- 6,0,0,0,67,0,0,0,115,112,0,0,0,116,0,0,
- 106,1,0,124,0,0,131,1,0,125,4,0,116,2,0,124,
- 4,0,116,3,0,131,2,0,114,75,0,116,4,0,100,1,
- 0,124,2,0,131,2,0,1,124,3,0,100,2,0,107,9,
- 0,114,71,0,116,5,0,106,6,0,124,4,0,124,3,0,
- 131,2,0,1,124,4,0,83,116,7,0,100,3,0,106,8,
- 0,124,2,0,131,1,0,100,4,0,124,1,0,100,5,0,
- 124,2,0,131,1,2,130,1,0,100,2,0,83,41,6,122,
- 60,67,111,109,112,105,108,101,32,98,121,116,101,99,111,100,
- 101,32,97,115,32,114,101,116,117,114,110,101,100,32,98,121,
- 32,95,118,97,108,105,100,97,116,101,95,98,121,116,101,99,
- 111,100,101,95,104,101,97,100,101,114,40,41,46,122,21,99,
- 111,100,101,32,111,98,106,101,99,116,32,102,114,111,109,32,
- 123,33,114,125,78,122,23,78,111,110,45,99,111,100,101,32,
- 111,98,106,101,99,116,32,105,110,32,123,33,114,125,114,106,
- 0,0,0,114,35,0,0,0,41,9,218,7,109,97,114,115,
- 104,97,108,90,5,108,111,97,100,115,218,10,105,115,105,110,
- 115,116,97,110,99,101,218,10,95,99,111,100,101,95,116,121,
- 112,101,114,105,0,0,0,218,4,95,105,109,112,90,16,95,
- 102,105,120,95,99,111,95,102,105,108,101,110,97,109,101,114,
- 107,0,0,0,114,47,0,0,0,41,5,114,53,0,0,0,
- 114,106,0,0,0,114,89,0,0,0,114,90,0,0,0,218,
- 4,99,111,100,101,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,218,17,95,99,111,109,112,105,108,101,95,98,
- 121,116,101,99,111,100,101,215,1,0,0,115,16,0,0,0,
- 0,2,15,1,15,1,13,1,12,1,16,1,4,2,18,1,
- 114,147,0,0,0,114,59,0,0,0,99,3,0,0,0,0,
- 0,0,0,4,0,0,0,3,0,0,0,67,0,0,0,115,
- 76,0,0,0,116,0,0,116,1,0,131,1,0,125,3,0,
- 124,3,0,106,2,0,116,3,0,124,1,0,131,1,0,131,
- 1,0,1,124,3,0,106,2,0,116,3,0,124,2,0,131,
- 1,0,131,1,0,1,124,3,0,106,2,0,116,4,0,106,
- 5,0,124,0,0,131,1,0,131,1,0,1,124,3,0,83,
- 41,1,122,80,67,111,109,112,105,108,101,32,97,32,99,111,
- 100,101,32,111,98,106,101,99,116,32,105,110,116,111,32,98,
- 121,116,101,99,111,100,101,32,102,111,114,32,119,114,105,116,
- 105,110,103,32,111,117,116,32,116,111,32,97,32,98,121,116,
- 101,45,99,111,109,112,105,108,101,100,10,32,32,32,32,102,
- 105,108,101,46,41,6,218,9,98,121,116,101,97,114,114,97,
- 121,114,135,0,0,0,218,6,101,120,116,101,110,100,114,17,
- 0,0,0,114,142,0,0,0,90,5,100,117,109,112,115,41,
- 4,114,146,0,0,0,114,133,0,0,0,114,140,0,0,0,
- 114,53,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,218,17,95,99,111,100,101,95,116,111,95,98,
- 121,116,101,99,111,100,101,227,1,0,0,115,10,0,0,0,
- 0,3,12,1,19,1,19,1,22,1,114,150,0,0,0,99,
- 1,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,
- 67,0,0,0,115,89,0,0,0,100,1,0,100,2,0,108,
- 0,0,125,1,0,116,1,0,106,2,0,124,0,0,131,1,
- 0,106,3,0,125,2,0,124,1,0,106,4,0,124,2,0,
- 131,1,0,125,3,0,116,1,0,106,5,0,100,2,0,100,
- 3,0,131,2,0,125,4,0,124,4,0,106,6,0,124,0,
- 0,106,6,0,124,3,0,100,1,0,25,131,1,0,131,1,
- 0,83,41,4,122,121,68,101,99,111,100,101,32,98,121,116,
- 101,115,32,114,101,112,114,101,115,101,110,116,105,110,103,32,
- 115,111,117,114,99,101,32,99,111,100,101,32,97,110,100,32,
- 114,101,116,117,114,110,32,116,104,101,32,115,116,114,105,110,
- 103,46,10,10,32,32,32,32,85,110,105,118,101,114,115,97,
- 108,32,110,101,119,108,105,110,101,32,115,117,112,112,111,114,
- 116,32,105,115,32,117,115,101,100,32,105,110,32,116,104,101,
- 32,100,101,99,111,100,105,110,103,46,10,32,32,32,32,114,
- 59,0,0,0,78,84,41,7,218,8,116,111,107,101,110,105,
- 122,101,114,49,0,0,0,90,7,66,121,116,101,115,73,79,
- 90,8,114,101,97,100,108,105,110,101,90,15,100,101,116,101,
- 99,116,95,101,110,99,111,100,105,110,103,90,25,73,110,99,
- 114,101,109,101,110,116,97,108,78,101,119,108,105,110,101,68,
- 101,99,111,100,101,114,218,6,100,101,99,111,100,101,41,5,
- 218,12,115,111,117,114,99,101,95,98,121,116,101,115,114,151,
- 0,0,0,90,21,115,111,117,114,99,101,95,98,121,116,101,
- 115,95,114,101,97,100,108,105,110,101,218,8,101,110,99,111,
- 100,105,110,103,90,15,110,101,119,108,105,110,101,95,100,101,
- 99,111,100,101,114,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,218,13,100,101,99,111,100,101,95,115,111,117,
- 114,99,101,237,1,0,0,115,10,0,0,0,0,5,12,1,
- 18,1,15,1,18,1,114,155,0,0,0,114,127,0,0,0,
- 218,26,115,117,98,109,111,100,117,108,101,95,115,101,97,114,
- 99,104,95,108,111,99,97,116,105,111,110,115,99,2,0,0,
- 0,2,0,0,0,9,0,0,0,19,0,0,0,67,0,0,
- 0,115,89,1,0,0,124,1,0,100,1,0,107,8,0,114,
- 73,0,100,2,0,125,1,0,116,0,0,124,2,0,100,3,
- 0,131,2,0,114,73,0,121,19,0,124,2,0,106,1,0,
- 124,0,0,131,1,0,125,1,0,87,110,18,0,4,116,2,
- 0,107,10,0,114,72,0,1,1,1,89,110,1,0,88,116,
- 3,0,106,4,0,124,0,0,124,2,0,100,4,0,124,1,
- 0,131,2,1,125,4,0,100,5,0,124,4,0,95,5,0,
- 124,2,0,100,1,0,107,8,0,114,194,0,120,73,0,116,
- 6,0,131,0,0,68,93,58,0,92,2,0,125,5,0,125,
- 6,0,124,1,0,106,7,0,116,8,0,124,6,0,131,1,
- 0,131,1,0,114,128,0,124,5,0,124,0,0,124,1,0,
- 131,2,0,125,2,0,124,2,0,124,4,0,95,9,0,80,
- 113,128,0,87,100,1,0,83,124,3,0,116,10,0,107,8,
- 0,114,23,1,116,0,0,124,2,0,100,6,0,131,2,0,
- 114,32,1,121,19,0,124,2,0,106,11,0,124,0,0,131,
- 1,0,125,7,0,87,110,18,0,4,116,2,0,107,10,0,
- 114,4,1,1,1,1,89,113,32,1,88,124,7,0,114,32,
- 1,103,0,0,124,4,0,95,12,0,110,9,0,124,3,0,
- 124,4,0,95,12,0,124,4,0,106,12,0,103,0,0,107,
- 2,0,114,85,1,124,1,0,114,85,1,116,13,0,124,1,
- 0,131,1,0,100,7,0,25,125,8,0,124,4,0,106,12,
- 0,106,14,0,124,8,0,131,1,0,1,124,4,0,83,41,
- 8,97,61,1,0,0,82,101,116,117,114,110,32,97,32,109,
- 111,100,117,108,101,32,115,112,101,99,32,98,97,115,101,100,
- 32,111,110,32,97,32,102,105,108,101,32,108,111,99,97,116,
- 105,111,110,46,10,10,32,32,32,32,84,111,32,105,110,100,
- 105,99,97,116,101,32,116,104,97,116,32,116,104,101,32,109,
- 111,100,117,108,101,32,105,115,32,97,32,112,97,99,107,97,
- 103,101,44,32,115,101,116,10,32,32,32,32,115,117,98,109,
- 111,100,117,108,101,95,115,101,97,114,99,104,95,108,111,99,
- 97,116,105,111,110,115,32,116,111,32,97,32,108,105,115,116,
- 32,111,102,32,100,105,114,101,99,116,111,114,121,32,112,97,
- 116,104,115,46,32,32,65,110,10,32,32,32,32,101,109,112,
- 116,121,32,108,105,115,116,32,105,115,32,115,117,102,102,105,
- 99,105,101,110,116,44,32,116,104,111,117,103,104,32,105,116,
- 115,32,110,111,116,32,111,116,104,101,114,119,105,115,101,32,
- 117,115,101,102,117,108,32,116,111,32,116,104,101,10,32,32,
- 32,32,105,109,112,111,114,116,32,115,121,115,116,101,109,46,
- 10,10,32,32,32,32,84,104,101,32,108,111,97,100,101,114,
- 32,109,117,115,116,32,116,97,107,101,32,97,32,115,112,101,
- 99,32,97,115,32,105,116,115,32,111,110,108,121,32,95,95,
- 105,110,105,116,95,95,40,41,32,97,114,103,46,10,10,32,
- 32,32,32,78,122,9,60,117,110,107,110,111,119,110,62,218,
- 12,103,101,116,95,102,105,108,101,110,97,109,101,218,6,111,
- 114,105,103,105,110,84,218,10,105,115,95,112,97,99,107,97,
- 103,101,114,59,0,0,0,41,15,114,115,0,0,0,114,157,
- 0,0,0,114,107,0,0,0,114,121,0,0,0,218,10,77,
- 111,100,117,108,101,83,112,101,99,90,13,95,115,101,116,95,
- 102,105,108,101,97,116,116,114,218,27,95,103,101,116,95,115,
- 117,112,112,111,114,116,101,100,95,102,105,108,101,95,108,111,
- 97,100,101,114,115,114,92,0,0,0,114,93,0,0,0,114,
- 127,0,0,0,218,9,95,80,79,80,85,76,65,84,69,114,
- 159,0,0,0,114,156,0,0,0,114,38,0,0,0,218,6,
- 97,112,112,101,110,100,41,9,114,106,0,0,0,90,8,108,
- 111,99,97,116,105,111,110,114,127,0,0,0,114,156,0,0,
- 0,218,4,115,112,101,99,218,12,108,111,97,100,101,114,95,
- 99,108,97,115,115,218,8,115,117,102,102,105,120,101,115,114,
- 159,0,0,0,90,7,100,105,114,110,97,109,101,114,4,0,
- 0,0,114,4,0,0,0,114,5,0,0,0,218,23,115,112,
- 101,99,95,102,114,111,109,95,102,105,108,101,95,108,111,99,
- 97,116,105,111,110,254,1,0,0,115,60,0,0,0,0,12,
- 12,4,6,1,15,2,3,1,19,1,13,1,5,8,24,1,
- 9,3,12,1,22,1,21,1,15,1,9,1,5,2,4,3,
- 12,2,15,1,3,1,19,1,13,1,5,2,6,1,12,2,
- 9,1,15,1,6,1,16,1,16,2,114,167,0,0,0,99,
- 0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,
- 64,0,0,0,115,121,0,0,0,101,0,0,90,1,0,100,
- 0,0,90,2,0,100,1,0,90,3,0,100,2,0,90,4,
- 0,100,3,0,90,5,0,100,4,0,90,6,0,101,7,0,
- 100,5,0,100,6,0,132,0,0,131,1,0,90,8,0,101,
- 7,0,100,7,0,100,8,0,132,0,0,131,1,0,90,9,
- 0,101,7,0,100,9,0,100,9,0,100,10,0,100,11,0,
- 132,2,0,131,1,0,90,10,0,101,7,0,100,9,0,100,
- 12,0,100,13,0,132,1,0,131,1,0,90,11,0,100,9,
- 0,83,41,14,218,21,87,105,110,100,111,119,115,82,101,103,
- 105,115,116,114,121,70,105,110,100,101,114,122,62,77,101,116,
- 97,32,112,97,116,104,32,102,105,110,100,101,114,32,102,111,
- 114,32,109,111,100,117,108,101,115,32,100,101,99,108,97,114,
- 101,100,32,105,110,32,116,104,101,32,87,105,110,100,111,119,
- 115,32,114,101,103,105,115,116,114,121,46,122,59,83,111,102,
- 116,119,97,114,101,92,80,121,116,104,111,110,92,80,121,116,
- 104,111,110,67,111,114,101,92,123,115,121,115,95,118,101,114,
- 115,105,111,110,125,92,77,111,100,117,108,101,115,92,123,102,
- 117,108,108,110,97,109,101,125,122,65,83,111,102,116,119,97,
- 114,101,92,80,121,116,104,111,110,92,80,121,116,104,111,110,
- 67,111,114,101,92,123,115,121,115,95,118,101,114,115,105,111,
- 110,125,92,77,111,100,117,108,101,115,92,123,102,117,108,108,
- 110,97,109,101,125,92,68,101,98,117,103,70,99,2,0,0,
- 0,0,0,0,0,2,0,0,0,11,0,0,0,67,0,0,
- 0,115,67,0,0,0,121,23,0,116,0,0,106,1,0,116,
- 0,0,106,2,0,124,1,0,131,2,0,83,87,110,37,0,
- 4,116,3,0,107,10,0,114,62,0,1,1,1,116,0,0,
- 106,1,0,116,0,0,106,4,0,124,1,0,131,2,0,83,
- 89,110,1,0,88,100,0,0,83,41,1,78,41,5,218,7,
- 95,119,105,110,114,101,103,90,7,79,112,101,110,75,101,121,
- 90,17,72,75,69,89,95,67,85,82,82,69,78,84,95,85,
- 83,69,82,114,40,0,0,0,90,18,72,75,69,89,95,76,
- 79,67,65,76,95,77,65,67,72,73,78,69,41,2,218,3,
- 99,108,115,218,3,107,101,121,114,4,0,0,0,114,4,0,
- 0,0,114,5,0,0,0,218,14,95,111,112,101,110,95,114,
- 101,103,105,115,116,114,121,76,2,0,0,115,8,0,0,0,
- 0,2,3,1,23,1,13,1,122,36,87,105,110,100,111,119,
- 115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,46,
- 95,111,112,101,110,95,114,101,103,105,115,116,114,121,99,2,
- 0,0,0,0,0,0,0,6,0,0,0,16,0,0,0,67,
- 0,0,0,115,143,0,0,0,124,0,0,106,0,0,114,21,
- 0,124,0,0,106,1,0,125,2,0,110,9,0,124,0,0,
- 106,2,0,125,2,0,124,2,0,106,3,0,100,1,0,124,
- 1,0,100,2,0,116,4,0,106,5,0,100,0,0,100,3,
- 0,133,2,0,25,131,0,2,125,3,0,121,47,0,124,0,
- 0,106,6,0,124,3,0,131,1,0,143,25,0,125,4,0,
- 116,7,0,106,8,0,124,4,0,100,4,0,131,2,0,125,
- 5,0,87,100,0,0,81,82,88,87,110,22,0,4,116,9,
- 0,107,10,0,114,138,0,1,1,1,100,0,0,83,89,110,
- 1,0,88,124,5,0,83,41,5,78,114,126,0,0,0,90,
- 11,115,121,115,95,118,101,114,115,105,111,110,114,80,0,0,
- 0,114,30,0,0,0,41,10,218,11,68,69,66,85,71,95,
- 66,85,73,76,68,218,18,82,69,71,73,83,84,82,89,95,
- 75,69,89,95,68,69,66,85,71,218,12,82,69,71,73,83,
- 84,82,89,95,75,69,89,114,47,0,0,0,114,7,0,0,
- 0,218,7,118,101,114,115,105,111,110,114,172,0,0,0,114,
- 169,0,0,0,90,10,81,117,101,114,121,86,97,108,117,101,
- 114,40,0,0,0,41,6,114,170,0,0,0,114,126,0,0,
- 0,90,12,114,101,103,105,115,116,114,121,95,107,101,121,114,
- 171,0,0,0,90,4,104,107,101,121,218,8,102,105,108,101,
- 112,97,116,104,114,4,0,0,0,114,4,0,0,0,114,5,
- 0,0,0,218,16,95,115,101,97,114,99,104,95,114,101,103,
- 105,115,116,114,121,83,2,0,0,115,22,0,0,0,0,2,
- 9,1,12,2,9,1,15,1,22,1,3,1,18,1,29,1,
- 13,1,9,1,122,38,87,105,110,100,111,119,115,82,101,103,
- 105,115,116,114,121,70,105,110,100,101,114,46,95,115,101,97,
- 114,99,104,95,114,101,103,105,115,116,114,121,78,99,4,0,
- 0,0,0,0,0,0,8,0,0,0,14,0,0,0,67,0,
- 0,0,115,158,0,0,0,124,0,0,106,0,0,124,1,0,
- 131,1,0,125,4,0,124,4,0,100,0,0,107,8,0,114,
- 31,0,100,0,0,83,121,14,0,116,1,0,124,4,0,131,
- 1,0,1,87,110,22,0,4,116,2,0,107,10,0,114,69,
- 0,1,1,1,100,0,0,83,89,110,1,0,88,120,81,0,
- 116,3,0,131,0,0,68,93,70,0,92,2,0,125,5,0,
- 125,6,0,124,4,0,106,4,0,116,5,0,124,6,0,131,
- 1,0,131,1,0,114,80,0,116,6,0,106,7,0,124,1,
- 0,124,5,0,124,1,0,124,4,0,131,2,0,100,1,0,
- 124,4,0,131,2,1,125,7,0,124,7,0,83,113,80,0,
- 87,100,0,0,83,41,2,78,114,158,0,0,0,41,8,114,
- 178,0,0,0,114,39,0,0,0,114,40,0,0,0,114,161,
- 0,0,0,114,92,0,0,0,114,93,0,0,0,114,121,0,
- 0,0,218,16,115,112,101,99,95,102,114,111,109,95,108,111,
- 97,100,101,114,41,8,114,170,0,0,0,114,126,0,0,0,
- 114,35,0,0,0,218,6,116,97,114,103,101,116,114,177,0,
- 0,0,114,127,0,0,0,114,166,0,0,0,114,164,0,0,
- 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
- 218,9,102,105,110,100,95,115,112,101,99,98,2,0,0,115,
- 26,0,0,0,0,2,15,1,12,1,4,1,3,1,14,1,
- 13,1,9,1,22,1,21,1,9,1,15,1,9,1,122,31,
+ 0,116,0,0,107,3,0,114,171,0,100,8,0,106,1,0,
+ 124,2,0,124,5,0,131,2,0,125,8,0,116,2,0,106,
+ 3,0,100,9,0,124,8,0,131,2,0,1,116,4,0,124,
+ 8,0,124,4,0,141,1,0,130,1,0,110,125,0,116,5,
+ 0,124,6,0,131,1,0,100,5,0,107,3,0,114,235,0,
+ 100,10,0,106,1,0,124,2,0,131,1,0,125,8,0,116,
+ 2,0,106,3,0,100,9,0,124,8,0,131,2,0,1,116,
+ 6,0,124,8,0,131,1,0,130,1,0,110,61,0,116,5,
+ 0,124,7,0,131,1,0,100,5,0,107,3,0,114,40,1,
+ 100,11,0,106,1,0,124,2,0,131,1,0,125,8,0,116,
+ 2,0,106,3,0,100,9,0,124,8,0,131,2,0,1,116,
+ 6,0,124,8,0,131,1,0,130,1,0,124,1,0,100,1,
+ 0,107,9,0,114,238,1,121,20,0,116,7,0,124,1,0,
+ 100,12,0,25,131,1,0,125,9,0,87,110,18,0,4,116,
+ 8,0,107,10,0,114,92,1,1,1,1,89,110,65,0,88,
+ 116,9,0,124,6,0,131,1,0,124,9,0,107,3,0,114,
+ 157,1,100,13,0,106,1,0,124,2,0,131,1,0,125,8,
+ 0,116,2,0,106,3,0,100,9,0,124,8,0,131,2,0,
+ 1,116,4,0,124,8,0,124,4,0,141,1,0,130,1,0,
+ 121,18,0,124,1,0,100,14,0,25,100,15,0,64,125,10,
+ 0,87,110,18,0,4,116,8,0,107,10,0,114,195,1,1,
+ 1,1,89,110,43,0,88,116,9,0,124,7,0,131,1,0,
+ 124,10,0,107,3,0,114,238,1,116,4,0,100,13,0,106,
+ 1,0,124,2,0,131,1,0,124,4,0,141,1,0,130,1,
+ 0,124,0,0,100,7,0,100,1,0,133,2,0,25,83,41,
+ 16,97,122,1,0,0,86,97,108,105,100,97,116,101,32,116,
+ 104,101,32,104,101,97,100,101,114,32,111,102,32,116,104,101,
+ 32,112,97,115,115,101,100,45,105,110,32,98,121,116,101,99,
+ 111,100,101,32,97,103,97,105,110,115,116,32,115,111,117,114,
+ 99,101,95,115,116,97,116,115,32,40,105,102,10,32,32,32,
+ 32,103,105,118,101,110,41,32,97,110,100,32,114,101,116,117,
+ 114,110,105,110,103,32,116,104,101,32,98,121,116,101,99,111,
+ 100,101,32,116,104,97,116,32,99,97,110,32,98,101,32,99,
+ 111,109,112,105,108,101,100,32,98,121,32,99,111,109,112,105,
+ 108,101,40,41,46,10,10,32,32,32,32,65,108,108,32,111,
+ 116,104,101,114,32,97,114,103,117,109,101,110,116,115,32,97,
+ 114,101,32,117,115,101,100,32,116,111,32,101,110,104,97,110,
+ 99,101,32,101,114,114,111,114,32,114,101,112,111,114,116,105,
+ 110,103,46,10,10,32,32,32,32,73,109,112,111,114,116,69,
+ 114,114,111,114,32,105,115,32,114,97,105,115,101,100,32,119,
+ 104,101,110,32,116,104,101,32,109,97,103,105,99,32,110,117,
+ 109,98,101,114,32,105,115,32,105,110,99,111,114,114,101,99,
+ 116,32,111,114,32,116,104,101,32,98,121,116,101,99,111,100,
+ 101,32,105,115,10,32,32,32,32,102,111,117,110,100,32,116,
+ 111,32,98,101,32,115,116,97,108,101,46,32,69,79,70,69,
+ 114,114,111,114,32,105,115,32,114,97,105,115,101,100,32,119,
+ 104,101,110,32,116,104,101,32,100,97,116,97,32,105,115,32,
+ 102,111,117,110,100,32,116,111,32,98,101,10,32,32,32,32,
+ 116,114,117,110,99,97,116,101,100,46,10,10,32,32,32,32,
+ 78,114,98,0,0,0,122,10,60,98,121,116,101,99,111,100,
+ 101,62,114,35,0,0,0,114,12,0,0,0,233,8,0,0,
+ 0,233,12,0,0,0,122,30,98,97,100,32,109,97,103,105,
+ 99,32,110,117,109,98,101,114,32,105,110,32,123,33,114,125,
+ 58,32,123,33,114,125,122,2,123,125,122,43,114,101,97,99,
+ 104,101,100,32,69,79,70,32,119,104,105,108,101,32,114,101,
+ 97,100,105,110,103,32,116,105,109,101,115,116,97,109,112,32,
+ 105,110,32,123,33,114,125,122,48,114,101,97,99,104,101,100,
+ 32,69,79,70,32,119,104,105,108,101,32,114,101,97,100,105,
+ 110,103,32,115,105,122,101,32,111,102,32,115,111,117,114,99,
+ 101,32,105,110,32,123,33,114,125,218,5,109,116,105,109,101,
+ 122,26,98,121,116,101,99,111,100,101,32,105,115,32,115,116,
+ 97,108,101,32,102,111,114,32,123,33,114,125,218,4,115,105,
+ 122,101,108,3,0,0,0,255,127,255,127,3,0,41,10,218,
+ 12,77,65,71,73,67,95,78,85,77,66,69,82,114,47,0,
+ 0,0,114,114,0,0,0,218,16,95,118,101,114,98,111,115,
+ 101,95,109,101,115,115,97,103,101,114,99,0,0,0,114,31,
+ 0,0,0,218,8,69,79,70,69,114,114,111,114,114,14,0,
+ 0,0,218,8,75,101,121,69,114,114,111,114,114,19,0,0,
+ 0,41,11,114,53,0,0,0,218,12,115,111,117,114,99,101,
+ 95,115,116,97,116,115,114,98,0,0,0,114,35,0,0,0,
+ 90,11,101,120,99,95,100,101,116,97,105,108,115,90,5,109,
+ 97,103,105,99,90,13,114,97,119,95,116,105,109,101,115,116,
+ 97,109,112,90,8,114,97,119,95,115,105,122,101,114,75,0,
+ 0,0,218,12,115,111,117,114,99,101,95,109,116,105,109,101,
+ 218,11,115,111,117,114,99,101,95,115,105,122,101,114,4,0,
+ 0,0,114,4,0,0,0,114,5,0,0,0,218,25,95,118,
+ 97,108,105,100,97,116,101,95,98,121,116,101,99,111,100,101,
+ 95,104,101,97,100,101,114,152,1,0,0,115,76,0,0,0,
+ 0,11,6,1,12,1,13,3,6,1,12,1,10,1,16,1,
+ 16,1,16,1,12,1,18,1,16,1,18,1,18,1,15,1,
+ 16,1,15,1,18,1,15,1,16,1,12,1,12,1,3,1,
+ 20,1,13,1,5,2,18,1,15,1,16,1,15,1,3,1,
+ 18,1,13,1,5,2,18,1,15,1,9,1,114,135,0,0,
+ 0,99,4,0,0,0,0,0,0,0,5,0,0,0,6,0,
+ 0,0,67,0,0,0,115,115,0,0,0,116,0,0,106,1,
+ 0,124,0,0,131,1,0,125,4,0,116,2,0,124,4,0,
+ 116,3,0,131,2,0,114,78,0,116,4,0,106,5,0,100,
+ 1,0,124,2,0,131,2,0,1,124,3,0,100,2,0,107,
+ 9,0,114,74,0,116,6,0,106,7,0,124,4,0,124,3,
+ 0,131,2,0,1,124,4,0,83,116,8,0,100,3,0,106,
+ 9,0,124,2,0,131,1,0,100,4,0,124,1,0,100,5,
+ 0,124,2,0,131,1,2,130,1,0,100,2,0,83,41,6,
+ 122,60,67,111,109,112,105,108,101,32,98,121,116,101,99,111,
+ 100,101,32,97,115,32,114,101,116,117,114,110,101,100,32,98,
+ 121,32,95,118,97,108,105,100,97,116,101,95,98,121,116,101,
+ 99,111,100,101,95,104,101,97,100,101,114,40,41,46,122,21,
+ 99,111,100,101,32,111,98,106,101,99,116,32,102,114,111,109,
+ 32,123,33,114,125,78,122,23,78,111,110,45,99,111,100,101,
+ 32,111,98,106,101,99,116,32,105,110,32,123,33,114,125,114,
+ 98,0,0,0,114,35,0,0,0,41,10,218,7,109,97,114,
+ 115,104,97,108,90,5,108,111,97,100,115,218,10,105,115,105,
+ 110,115,116,97,110,99,101,218,10,95,99,111,100,101,95,116,
+ 121,112,101,114,114,0,0,0,114,129,0,0,0,218,4,95,
+ 105,109,112,90,16,95,102,105,120,95,99,111,95,102,105,108,
+ 101,110,97,109,101,114,99,0,0,0,114,47,0,0,0,41,
+ 5,114,53,0,0,0,114,98,0,0,0,114,89,0,0,0,
+ 114,90,0,0,0,218,4,99,111,100,101,114,4,0,0,0,
+ 114,4,0,0,0,114,5,0,0,0,218,17,95,99,111,109,
+ 112,105,108,101,95,98,121,116,101,99,111,100,101,207,1,0,
+ 0,115,16,0,0,0,0,2,15,1,15,1,16,1,12,1,
+ 16,1,4,2,18,1,114,141,0,0,0,114,59,0,0,0,
+ 99,3,0,0,0,0,0,0,0,4,0,0,0,3,0,0,
+ 0,67,0,0,0,115,76,0,0,0,116,0,0,116,1,0,
+ 131,1,0,125,3,0,124,3,0,106,2,0,116,3,0,124,
+ 1,0,131,1,0,131,1,0,1,124,3,0,106,2,0,116,
+ 3,0,124,2,0,131,1,0,131,1,0,1,124,3,0,106,
+ 2,0,116,4,0,106,5,0,124,0,0,131,1,0,131,1,
+ 0,1,124,3,0,83,41,1,122,80,67,111,109,112,105,108,
+ 101,32,97,32,99,111,100,101,32,111,98,106,101,99,116,32,
+ 105,110,116,111,32,98,121,116,101,99,111,100,101,32,102,111,
+ 114,32,119,114,105,116,105,110,103,32,111,117,116,32,116,111,
+ 32,97,32,98,121,116,101,45,99,111,109,112,105,108,101,100,
+ 10,32,32,32,32,102,105,108,101,46,41,6,218,9,98,121,
+ 116,101,97,114,114,97,121,114,128,0,0,0,218,6,101,120,
+ 116,101,110,100,114,17,0,0,0,114,136,0,0,0,90,5,
+ 100,117,109,112,115,41,4,114,140,0,0,0,114,126,0,0,
+ 0,114,134,0,0,0,114,53,0,0,0,114,4,0,0,0,
+ 114,4,0,0,0,114,5,0,0,0,218,17,95,99,111,100,
+ 101,95,116,111,95,98,121,116,101,99,111,100,101,219,1,0,
+ 0,115,10,0,0,0,0,3,12,1,19,1,19,1,22,1,
+ 114,144,0,0,0,99,1,0,0,0,0,0,0,0,5,0,
+ 0,0,4,0,0,0,67,0,0,0,115,89,0,0,0,100,
+ 1,0,100,2,0,108,0,0,125,1,0,116,1,0,106,2,
+ 0,124,0,0,131,1,0,106,3,0,125,2,0,124,1,0,
+ 106,4,0,124,2,0,131,1,0,125,3,0,116,1,0,106,
+ 5,0,100,2,0,100,3,0,131,2,0,125,4,0,124,4,
+ 0,106,6,0,124,0,0,106,6,0,124,3,0,100,1,0,
+ 25,131,1,0,131,1,0,83,41,4,122,121,68,101,99,111,
+ 100,101,32,98,121,116,101,115,32,114,101,112,114,101,115,101,
+ 110,116,105,110,103,32,115,111,117,114,99,101,32,99,111,100,
+ 101,32,97,110,100,32,114,101,116,117,114,110,32,116,104,101,
+ 32,115,116,114,105,110,103,46,10,10,32,32,32,32,85,110,
+ 105,118,101,114,115,97,108,32,110,101,119,108,105,110,101,32,
+ 115,117,112,112,111,114,116,32,105,115,32,117,115,101,100,32,
+ 105,110,32,116,104,101,32,100,101,99,111,100,105,110,103,46,
+ 10,32,32,32,32,114,59,0,0,0,78,84,41,7,218,8,
+ 116,111,107,101,110,105,122,101,114,49,0,0,0,90,7,66,
+ 121,116,101,115,73,79,90,8,114,101,97,100,108,105,110,101,
+ 90,15,100,101,116,101,99,116,95,101,110,99,111,100,105,110,
+ 103,90,25,73,110,99,114,101,109,101,110,116,97,108,78,101,
+ 119,108,105,110,101,68,101,99,111,100,101,114,218,6,100,101,
+ 99,111,100,101,41,5,218,12,115,111,117,114,99,101,95,98,
+ 121,116,101,115,114,145,0,0,0,90,21,115,111,117,114,99,
+ 101,95,98,121,116,101,115,95,114,101,97,100,108,105,110,101,
+ 218,8,101,110,99,111,100,105,110,103,90,15,110,101,119,108,
+ 105,110,101,95,100,101,99,111,100,101,114,114,4,0,0,0,
+ 114,4,0,0,0,114,5,0,0,0,218,13,100,101,99,111,
+ 100,101,95,115,111,117,114,99,101,229,1,0,0,115,10,0,
+ 0,0,0,5,12,1,18,1,15,1,18,1,114,149,0,0,
+ 0,114,120,0,0,0,218,26,115,117,98,109,111,100,117,108,
+ 101,95,115,101,97,114,99,104,95,108,111,99,97,116,105,111,
+ 110,115,99,2,0,0,0,2,0,0,0,9,0,0,0,19,
+ 0,0,0,67,0,0,0,115,89,1,0,0,124,1,0,100,
+ 1,0,107,8,0,114,73,0,100,2,0,125,1,0,116,0,
+ 0,124,2,0,100,3,0,131,2,0,114,73,0,121,19,0,
+ 124,2,0,106,1,0,124,0,0,131,1,0,125,1,0,87,
+ 110,18,0,4,116,2,0,107,10,0,114,72,0,1,1,1,
+ 89,110,1,0,88,116,3,0,106,4,0,124,0,0,124,2,
+ 0,100,4,0,124,1,0,131,2,1,125,4,0,100,5,0,
+ 124,4,0,95,5,0,124,2,0,100,1,0,107,8,0,114,
+ 194,0,120,73,0,116,6,0,131,0,0,68,93,58,0,92,
+ 2,0,125,5,0,125,6,0,124,1,0,106,7,0,116,8,
+ 0,124,6,0,131,1,0,131,1,0,114,128,0,124,5,0,
+ 124,0,0,124,1,0,131,2,0,125,2,0,124,2,0,124,
+ 4,0,95,9,0,80,113,128,0,87,100,1,0,83,124,3,
+ 0,116,10,0,107,8,0,114,23,1,116,0,0,124,2,0,
+ 100,6,0,131,2,0,114,32,1,121,19,0,124,2,0,106,
+ 11,0,124,0,0,131,1,0,125,7,0,87,110,18,0,4,
+ 116,2,0,107,10,0,114,4,1,1,1,1,89,113,32,1,
+ 88,124,7,0,114,32,1,103,0,0,124,4,0,95,12,0,
+ 110,9,0,124,3,0,124,4,0,95,12,0,124,4,0,106,
+ 12,0,103,0,0,107,2,0,114,85,1,124,1,0,114,85,
+ 1,116,13,0,124,1,0,131,1,0,100,7,0,25,125,8,
+ 0,124,4,0,106,12,0,106,14,0,124,8,0,131,1,0,
+ 1,124,4,0,83,41,8,97,61,1,0,0,82,101,116,117,
+ 114,110,32,97,32,109,111,100,117,108,101,32,115,112,101,99,
+ 32,98,97,115,101,100,32,111,110,32,97,32,102,105,108,101,
+ 32,108,111,99,97,116,105,111,110,46,10,10,32,32,32,32,
+ 84,111,32,105,110,100,105,99,97,116,101,32,116,104,97,116,
+ 32,116,104,101,32,109,111,100,117,108,101,32,105,115,32,97,
+ 32,112,97,99,107,97,103,101,44,32,115,101,116,10,32,32,
+ 32,32,115,117,98,109,111,100,117,108,101,95,115,101,97,114,
+ 99,104,95,108,111,99,97,116,105,111,110,115,32,116,111,32,
+ 97,32,108,105,115,116,32,111,102,32,100,105,114,101,99,116,
+ 111,114,121,32,112,97,116,104,115,46,32,32,65,110,10,32,
+ 32,32,32,101,109,112,116,121,32,108,105,115,116,32,105,115,
+ 32,115,117,102,102,105,99,105,101,110,116,44,32,116,104,111,
+ 117,103,104,32,105,116,115,32,110,111,116,32,111,116,104,101,
+ 114,119,105,115,101,32,117,115,101,102,117,108,32,116,111,32,
+ 116,104,101,10,32,32,32,32,105,109,112,111,114,116,32,115,
+ 121,115,116,101,109,46,10,10,32,32,32,32,84,104,101,32,
+ 108,111,97,100,101,114,32,109,117,115,116,32,116,97,107,101,
+ 32,97,32,115,112,101,99,32,97,115,32,105,116,115,32,111,
+ 110,108,121,32,95,95,105,110,105,116,95,95,40,41,32,97,
+ 114,103,46,10,10,32,32,32,32,78,122,9,60,117,110,107,
+ 110,111,119,110,62,218,12,103,101,116,95,102,105,108,101,110,
+ 97,109,101,218,6,111,114,105,103,105,110,84,218,10,105,115,
+ 95,112,97,99,107,97,103,101,114,59,0,0,0,41,15,114,
+ 108,0,0,0,114,151,0,0,0,114,99,0,0,0,114,114,
+ 0,0,0,218,10,77,111,100,117,108,101,83,112,101,99,90,
+ 13,95,115,101,116,95,102,105,108,101,97,116,116,114,218,27,
+ 95,103,101,116,95,115,117,112,112,111,114,116,101,100,95,102,
+ 105,108,101,95,108,111,97,100,101,114,115,114,92,0,0,0,
+ 114,93,0,0,0,114,120,0,0,0,218,9,95,80,79,80,
+ 85,76,65,84,69,114,153,0,0,0,114,150,0,0,0,114,
+ 38,0,0,0,218,6,97,112,112,101,110,100,41,9,114,98,
+ 0,0,0,90,8,108,111,99,97,116,105,111,110,114,120,0,
+ 0,0,114,150,0,0,0,218,4,115,112,101,99,218,12,108,
+ 111,97,100,101,114,95,99,108,97,115,115,218,8,115,117,102,
+ 102,105,120,101,115,114,153,0,0,0,90,7,100,105,114,110,
+ 97,109,101,114,4,0,0,0,114,4,0,0,0,114,5,0,
+ 0,0,218,23,115,112,101,99,95,102,114,111,109,95,102,105,
+ 108,101,95,108,111,99,97,116,105,111,110,246,1,0,0,115,
+ 60,0,0,0,0,12,12,4,6,1,15,2,3,1,19,1,
+ 13,1,5,8,24,1,9,3,12,1,22,1,21,1,15,1,
+ 9,1,5,2,4,3,12,2,15,1,3,1,19,1,13,1,
+ 5,2,6,1,12,2,9,1,15,1,6,1,16,1,16,2,
+ 114,161,0,0,0,99,0,0,0,0,0,0,0,0,0,0,
+ 0,0,5,0,0,0,64,0,0,0,115,121,0,0,0,101,
+ 0,0,90,1,0,100,0,0,90,2,0,100,1,0,90,3,
+ 0,100,2,0,90,4,0,100,3,0,90,5,0,100,4,0,
+ 90,6,0,101,7,0,100,5,0,100,6,0,132,0,0,131,
+ 1,0,90,8,0,101,7,0,100,7,0,100,8,0,132,0,
+ 0,131,1,0,90,9,0,101,7,0,100,9,0,100,9,0,
+ 100,10,0,100,11,0,132,2,0,131,1,0,90,10,0,101,
+ 7,0,100,9,0,100,12,0,100,13,0,132,1,0,131,1,
+ 0,90,11,0,100,9,0,83,41,14,218,21,87,105,110,100,
+ 111,119,115,82,101,103,105,115,116,114,121,70,105,110,100,101,
+ 114,122,62,77,101,116,97,32,112,97,116,104,32,102,105,110,
+ 100,101,114,32,102,111,114,32,109,111,100,117,108,101,115,32,
+ 100,101,99,108,97,114,101,100,32,105,110,32,116,104,101,32,
+ 87,105,110,100,111,119,115,32,114,101,103,105,115,116,114,121,
+ 46,122,59,83,111,102,116,119,97,114,101,92,80,121,116,104,
+ 111,110,92,80,121,116,104,111,110,67,111,114,101,92,123,115,
+ 121,115,95,118,101,114,115,105,111,110,125,92,77,111,100,117,
+ 108,101,115,92,123,102,117,108,108,110,97,109,101,125,122,65,
+ 83,111,102,116,119,97,114,101,92,80,121,116,104,111,110,92,
+ 80,121,116,104,111,110,67,111,114,101,92,123,115,121,115,95,
+ 118,101,114,115,105,111,110,125,92,77,111,100,117,108,101,115,
+ 92,123,102,117,108,108,110,97,109,101,125,92,68,101,98,117,
+ 103,70,99,2,0,0,0,0,0,0,0,2,0,0,0,11,
+ 0,0,0,67,0,0,0,115,67,0,0,0,121,23,0,116,
+ 0,0,106,1,0,116,0,0,106,2,0,124,1,0,131,2,
+ 0,83,87,110,37,0,4,116,3,0,107,10,0,114,62,0,
+ 1,1,1,116,0,0,106,1,0,116,0,0,106,4,0,124,
+ 1,0,131,2,0,83,89,110,1,0,88,100,0,0,83,41,
+ 1,78,41,5,218,7,95,119,105,110,114,101,103,90,7,79,
+ 112,101,110,75,101,121,90,17,72,75,69,89,95,67,85,82,
+ 82,69,78,84,95,85,83,69,82,114,40,0,0,0,90,18,
+ 72,75,69,89,95,76,79,67,65,76,95,77,65,67,72,73,
+ 78,69,41,2,218,3,99,108,115,218,3,107,101,121,114,4,
+ 0,0,0,114,4,0,0,0,114,5,0,0,0,218,14,95,
+ 111,112,101,110,95,114,101,103,105,115,116,114,121,68,2,0,
+ 0,115,8,0,0,0,0,2,3,1,23,1,13,1,122,36,
87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70,
- 105,110,100,101,114,46,102,105,110,100,95,115,112,101,99,99,
- 3,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,
- 67,0,0,0,115,45,0,0,0,124,0,0,106,0,0,124,
- 1,0,124,2,0,131,2,0,125,3,0,124,3,0,100,1,
- 0,107,9,0,114,37,0,124,3,0,106,1,0,83,100,1,
- 0,83,100,1,0,83,41,2,122,108,70,105,110,100,32,109,
- 111,100,117,108,101,32,110,97,109,101,100,32,105,110,32,116,
- 104,101,32,114,101,103,105,115,116,114,121,46,10,10,32,32,
- 32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111,
- 100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46,
- 32,32,85,115,101,32,101,120,101,99,95,109,111,100,117,108,
- 101,40,41,32,105,110,115,116,101,97,100,46,10,10,32,32,
- 32,32,32,32,32,32,78,41,2,114,181,0,0,0,114,127,
- 0,0,0,41,4,114,170,0,0,0,114,126,0,0,0,114,
- 35,0,0,0,114,164,0,0,0,114,4,0,0,0,114,4,
- 0,0,0,114,5,0,0,0,218,11,102,105,110,100,95,109,
- 111,100,117,108,101,114,2,0,0,115,8,0,0,0,0,7,
- 18,1,12,1,7,2,122,33,87,105,110,100,111,119,115,82,
- 101,103,105,115,116,114,121,70,105,110,100,101,114,46,102,105,
- 110,100,95,109,111,100,117,108,101,41,12,114,112,0,0,0,
- 114,111,0,0,0,114,113,0,0,0,114,114,0,0,0,114,
- 175,0,0,0,114,174,0,0,0,114,173,0,0,0,218,11,
- 99,108,97,115,115,109,101,116,104,111,100,114,172,0,0,0,
- 114,178,0,0,0,114,181,0,0,0,114,182,0,0,0,114,
- 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,
- 0,0,0,114,168,0,0,0,64,2,0,0,115,20,0,0,
- 0,12,2,6,3,6,3,6,2,6,2,18,7,18,15,3,
- 1,21,15,3,1,114,168,0,0,0,99,0,0,0,0,0,
- 0,0,0,0,0,0,0,2,0,0,0,64,0,0,0,115,
- 70,0,0,0,101,0,0,90,1,0,100,0,0,90,2,0,
- 100,1,0,90,3,0,100,2,0,100,3,0,132,0,0,90,
- 4,0,100,4,0,100,5,0,132,0,0,90,5,0,100,6,
- 0,100,7,0,132,0,0,90,6,0,100,8,0,100,9,0,
- 132,0,0,90,7,0,100,10,0,83,41,11,218,13,95,76,
- 111,97,100,101,114,66,97,115,105,99,115,122,83,66,97,115,
- 101,32,99,108,97,115,115,32,111,102,32,99,111,109,109,111,
- 110,32,99,111,100,101,32,110,101,101,100,101,100,32,98,121,
- 32,98,111,116,104,32,83,111,117,114,99,101,76,111,97,100,
- 101,114,32,97,110,100,10,32,32,32,32,83,111,117,114,99,
- 101,108,101,115,115,70,105,108,101,76,111,97,100,101,114,46,
- 99,2,0,0,0,0,0,0,0,5,0,0,0,3,0,0,
- 0,67,0,0,0,115,88,0,0,0,116,0,0,124,0,0,
- 106,1,0,124,1,0,131,1,0,131,1,0,100,1,0,25,
- 125,2,0,124,2,0,106,2,0,100,2,0,100,1,0,131,
- 2,0,100,3,0,25,125,3,0,124,1,0,106,3,0,100,
- 2,0,131,1,0,100,4,0,25,125,4,0,124,3,0,100,
- 5,0,107,2,0,111,87,0,124,4,0,100,5,0,107,3,
- 0,83,41,6,122,141,67,111,110,99,114,101,116,101,32,105,
- 109,112,108,101,109,101,110,116,97,116,105,111,110,32,111,102,
- 32,73,110,115,112,101,99,116,76,111,97,100,101,114,46,105,
- 115,95,112,97,99,107,97,103,101,32,98,121,32,99,104,101,
- 99,107,105,110,103,32,105,102,10,32,32,32,32,32,32,32,
- 32,116,104,101,32,112,97,116,104,32,114,101,116,117,114,110,
- 101,100,32,98,121,32,103,101,116,95,102,105,108,101,110,97,
- 109,101,32,104,97,115,32,97,32,102,105,108,101,110,97,109,
- 101,32,111,102,32,39,95,95,105,110,105,116,95,95,46,112,
- 121,39,46,114,29,0,0,0,114,58,0,0,0,114,59,0,
- 0,0,114,56,0,0,0,218,8,95,95,105,110,105,116,95,
- 95,41,4,114,38,0,0,0,114,157,0,0,0,114,34,0,
- 0,0,114,32,0,0,0,41,5,114,108,0,0,0,114,126,
- 0,0,0,114,94,0,0,0,90,13,102,105,108,101,110,97,
- 109,101,95,98,97,115,101,90,9,116,97,105,108,95,110,97,
- 109,101,114,4,0,0,0,114,4,0,0,0,114,5,0,0,
- 0,114,159,0,0,0,133,2,0,0,115,8,0,0,0,0,
- 3,25,1,22,1,19,1,122,24,95,76,111,97,100,101,114,
- 66,97,115,105,99,115,46,105,115,95,112,97,99,107,97,103,
- 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,
- 0,0,67,0,0,0,115,4,0,0,0,100,1,0,83,41,
- 2,122,42,85,115,101,32,100,101,102,97,117,108,116,32,115,
- 101,109,97,110,116,105,99,115,32,102,111,114,32,109,111,100,
- 117,108,101,32,99,114,101,97,116,105,111,110,46,78,114,4,
- 0,0,0,41,2,114,108,0,0,0,114,164,0,0,0,114,
- 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,13,
- 99,114,101,97,116,101,95,109,111,100,117,108,101,141,2,0,
- 0,115,0,0,0,0,122,27,95,76,111,97,100,101,114,66,
- 97,115,105,99,115,46,99,114,101,97,116,101,95,109,111,100,
- 117,108,101,99,2,0,0,0,0,0,0,0,3,0,0,0,
- 4,0,0,0,67,0,0,0,115,80,0,0,0,124,0,0,
- 106,0,0,124,1,0,106,1,0,131,1,0,125,2,0,124,
- 2,0,100,1,0,107,8,0,114,54,0,116,2,0,100,2,
- 0,106,3,0,124,1,0,106,1,0,131,1,0,131,1,0,
- 130,1,0,116,4,0,106,5,0,116,6,0,124,2,0,124,
- 1,0,106,7,0,131,3,0,1,100,1,0,83,41,3,122,
- 19,69,120,101,99,117,116,101,32,116,104,101,32,109,111,100,
- 117,108,101,46,78,122,52,99,97,110,110,111,116,32,108,111,
- 97,100,32,109,111,100,117,108,101,32,123,33,114,125,32,119,
- 104,101,110,32,103,101,116,95,99,111,100,101,40,41,32,114,
- 101,116,117,114,110,115,32,78,111,110,101,41,8,218,8,103,
- 101,116,95,99,111,100,101,114,112,0,0,0,114,107,0,0,
- 0,114,47,0,0,0,114,121,0,0,0,218,25,95,99,97,
- 108,108,95,119,105,116,104,95,102,114,97,109,101,115,95,114,
- 101,109,111,118,101,100,218,4,101,120,101,99,114,118,0,0,
- 0,41,3,114,108,0,0,0,218,6,109,111,100,117,108,101,
- 114,146,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,218,11,101,120,101,99,95,109,111,100,117,108,
- 101,144,2,0,0,115,10,0,0,0,0,2,18,1,12,1,
- 9,1,15,1,122,25,95,76,111,97,100,101,114,66,97,115,
- 105,99,115,46,101,120,101,99,95,109,111,100,117,108,101,99,
- 2,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,
- 67,0,0,0,115,16,0,0,0,116,0,0,106,1,0,124,
- 0,0,124,1,0,131,2,0,83,41,1,78,41,2,114,121,
- 0,0,0,218,17,95,108,111,97,100,95,109,111,100,117,108,
- 101,95,115,104,105,109,41,2,114,108,0,0,0,114,126,0,
- 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,
- 0,218,11,108,111,97,100,95,109,111,100,117,108,101,152,2,
- 0,0,115,2,0,0,0,0,1,122,25,95,76,111,97,100,
- 101,114,66,97,115,105,99,115,46,108,111,97,100,95,109,111,
- 100,117,108,101,78,41,8,114,112,0,0,0,114,111,0,0,
- 0,114,113,0,0,0,114,114,0,0,0,114,159,0,0,0,
- 114,186,0,0,0,114,191,0,0,0,114,193,0,0,0,114,
- 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,
- 0,0,0,114,184,0,0,0,128,2,0,0,115,10,0,0,
- 0,12,3,6,2,12,8,12,3,12,8,114,184,0,0,0,
- 99,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,
- 0,64,0,0,0,115,106,0,0,0,101,0,0,90,1,0,
- 100,0,0,90,2,0,100,1,0,100,2,0,132,0,0,90,
- 3,0,100,3,0,100,4,0,132,0,0,90,4,0,100,5,
- 0,100,6,0,132,0,0,90,5,0,100,7,0,100,8,0,
- 132,0,0,90,6,0,100,9,0,100,10,0,132,0,0,90,
- 7,0,100,11,0,100,18,0,100,13,0,100,14,0,132,0,
- 1,90,8,0,100,15,0,100,16,0,132,0,0,90,9,0,
- 100,17,0,83,41,19,218,12,83,111,117,114,99,101,76,111,
- 97,100,101,114,99,2,0,0,0,0,0,0,0,2,0,0,
- 0,1,0,0,0,67,0,0,0,115,10,0,0,0,116,0,
- 0,130,1,0,100,1,0,83,41,2,122,178,79,112,116,105,
- 111,110,97,108,32,109,101,116,104,111,100,32,116,104,97,116,
- 32,114,101,116,117,114,110,115,32,116,104,101,32,109,111,100,
- 105,102,105,99,97,116,105,111,110,32,116,105,109,101,32,40,
- 97,110,32,105,110,116,41,32,102,111,114,32,116,104,101,10,
- 32,32,32,32,32,32,32,32,115,112,101,99,105,102,105,101,
- 100,32,112,97,116,104,44,32,119,104,101,114,101,32,112,97,
- 116,104,32,105,115,32,97,32,115,116,114,46,10,10,32,32,
- 32,32,32,32,32,32,82,97,105,115,101,115,32,73,79,69,
- 114,114,111,114,32,119,104,101,110,32,116,104,101,32,112,97,
- 116,104,32,99,97,110,110,111,116,32,98,101,32,104,97,110,
- 100,108,101,100,46,10,32,32,32,32,32,32,32,32,78,41,
- 1,218,7,73,79,69,114,114,111,114,41,2,114,108,0,0,
- 0,114,35,0,0,0,114,4,0,0,0,114,4,0,0,0,
- 114,5,0,0,0,218,10,112,97,116,104,95,109,116,105,109,
- 101,158,2,0,0,115,2,0,0,0,0,6,122,23,83,111,
- 117,114,99,101,76,111,97,100,101,114,46,112,97,116,104,95,
- 109,116,105,109,101,99,2,0,0,0,0,0,0,0,2,0,
- 0,0,3,0,0,0,67,0,0,0,115,19,0,0,0,100,
- 1,0,124,0,0,106,0,0,124,1,0,131,1,0,105,1,
- 0,83,41,2,97,170,1,0,0,79,112,116,105,111,110,97,
- 108,32,109,101,116,104,111,100,32,114,101,116,117,114,110,105,
- 110,103,32,97,32,109,101,116,97,100,97,116,97,32,100,105,
- 99,116,32,102,111,114,32,116,104,101,32,115,112,101,99,105,
- 102,105,101,100,32,112,97,116,104,10,32,32,32,32,32,32,
- 32,32,116,111,32,98,121,32,116,104,101,32,112,97,116,104,
- 32,40,115,116,114,41,46,10,32,32,32,32,32,32,32,32,
- 80,111,115,115,105,98,108,101,32,107,101,121,115,58,10,32,
- 32,32,32,32,32,32,32,45,32,39,109,116,105,109,101,39,
- 32,40,109,97,110,100,97,116,111,114,121,41,32,105,115,32,
- 116,104,101,32,110,117,109,101,114,105,99,32,116,105,109,101,
- 115,116,97,109,112,32,111,102,32,108,97,115,116,32,115,111,
- 117,114,99,101,10,32,32,32,32,32,32,32,32,32,32,99,
- 111,100,101,32,109,111,100,105,102,105,99,97,116,105,111,110,
- 59,10,32,32,32,32,32,32,32,32,45,32,39,115,105,122,
- 101,39,32,40,111,112,116,105,111,110,97,108,41,32,105,115,
- 32,116,104,101,32,115,105,122,101,32,105,110,32,98,121,116,
- 101,115,32,111,102,32,116,104,101,32,115,111,117,114,99,101,
- 32,99,111,100,101,46,10,10,32,32,32,32,32,32,32,32,
- 73,109,112,108,101,109,101,110,116,105,110,103,32,116,104,105,
- 115,32,109,101,116,104,111,100,32,97,108,108,111,119,115,32,
- 116,104,101,32,108,111,97,100,101,114,32,116,111,32,114,101,
- 97,100,32,98,121,116,101,99,111,100,101,32,102,105,108,101,
- 115,46,10,32,32,32,32,32,32,32,32,82,97,105,115,101,
- 115,32,73,79,69,114,114,111,114,32,119,104,101,110,32,116,
- 104,101,32,112,97,116,104,32,99,97,110,110,111,116,32,98,
- 101,32,104,97,110,100,108,101,100,46,10,32,32,32,32,32,
- 32,32,32,114,133,0,0,0,41,1,114,196,0,0,0,41,
- 2,114,108,0,0,0,114,35,0,0,0,114,4,0,0,0,
- 114,4,0,0,0,114,5,0,0,0,218,10,112,97,116,104,
- 95,115,116,97,116,115,166,2,0,0,115,2,0,0,0,0,
- 11,122,23,83,111,117,114,99,101,76,111,97,100,101,114,46,
- 112,97,116,104,95,115,116,97,116,115,99,4,0,0,0,0,
- 0,0,0,4,0,0,0,3,0,0,0,67,0,0,0,115,
- 16,0,0,0,124,0,0,106,0,0,124,2,0,124,3,0,
- 131,2,0,83,41,1,122,228,79,112,116,105,111,110,97,108,
- 32,109,101,116,104,111,100,32,119,104,105,99,104,32,119,114,
- 105,116,101,115,32,100,97,116,97,32,40,98,121,116,101,115,
- 41,32,116,111,32,97,32,102,105,108,101,32,112,97,116,104,
- 32,40,97,32,115,116,114,41,46,10,10,32,32,32,32,32,
- 32,32,32,73,109,112,108,101,109,101,110,116,105,110,103,32,
- 116,104,105,115,32,109,101,116,104,111,100,32,97,108,108,111,
- 119,115,32,102,111,114,32,116,104,101,32,119,114,105,116,105,
- 110,103,32,111,102,32,98,121,116,101,99,111,100,101,32,102,
- 105,108,101,115,46,10,10,32,32,32,32,32,32,32,32,84,
- 104,101,32,115,111,117,114,99,101,32,112,97,116,104,32,105,
- 115,32,110,101,101,100,101,100,32,105,110,32,111,114,100,101,
- 114,32,116,111,32,99,111,114,114,101,99,116,108,121,32,116,
- 114,97,110,115,102,101,114,32,112,101,114,109,105,115,115,105,
- 111,110,115,10,32,32,32,32,32,32,32,32,41,1,218,8,
- 115,101,116,95,100,97,116,97,41,4,114,108,0,0,0,114,
- 90,0,0,0,90,10,99,97,99,104,101,95,112,97,116,104,
- 114,53,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,218,15,95,99,97,99,104,101,95,98,121,116,
- 101,99,111,100,101,179,2,0,0,115,2,0,0,0,0,8,
- 122,28,83,111,117,114,99,101,76,111,97,100,101,114,46,95,
- 99,97,99,104,101,95,98,121,116,101,99,111,100,101,99,3,
- 0,0,0,0,0,0,0,3,0,0,0,1,0,0,0,67,
- 0,0,0,115,4,0,0,0,100,1,0,83,41,2,122,150,
- 79,112,116,105,111,110,97,108,32,109,101,116,104,111,100,32,
- 119,104,105,99,104,32,119,114,105,116,101,115,32,100,97,116,
- 97,32,40,98,121,116,101,115,41,32,116,111,32,97,32,102,
- 105,108,101,32,112,97,116,104,32,40,97,32,115,116,114,41,
- 46,10,10,32,32,32,32,32,32,32,32,73,109,112,108,101,
- 109,101,110,116,105,110,103,32,116,104,105,115,32,109,101,116,
- 104,111,100,32,97,108,108,111,119,115,32,102,111,114,32,116,
- 104,101,32,119,114,105,116,105,110,103,32,111,102,32,98,121,
- 116,101,99,111,100,101,32,102,105,108,101,115,46,10,32,32,
- 32,32,32,32,32,32,78,114,4,0,0,0,41,3,114,108,
- 0,0,0,114,35,0,0,0,114,53,0,0,0,114,4,0,
- 0,0,114,4,0,0,0,114,5,0,0,0,114,198,0,0,
- 0,189,2,0,0,115,0,0,0,0,122,21,83,111,117,114,
- 99,101,76,111,97,100,101,114,46,115,101,116,95,100,97,116,
- 97,99,2,0,0,0,0,0,0,0,5,0,0,0,16,0,
- 0,0,67,0,0,0,115,105,0,0,0,124,0,0,106,0,
- 0,124,1,0,131,1,0,125,2,0,121,19,0,124,0,0,
- 106,1,0,124,2,0,131,1,0,125,3,0,87,110,58,0,
- 4,116,2,0,107,10,0,114,94,0,1,125,4,0,1,122,
- 26,0,116,3,0,100,1,0,100,2,0,124,1,0,131,1,
- 1,124,4,0,130,2,0,87,89,100,3,0,100,3,0,125,
- 4,0,126,4,0,88,110,1,0,88,116,4,0,124,3,0,
- 131,1,0,83,41,4,122,52,67,111,110,99,114,101,116,101,
- 32,105,109,112,108,101,109,101,110,116,97,116,105,111,110,32,
- 111,102,32,73,110,115,112,101,99,116,76,111,97,100,101,114,
- 46,103,101,116,95,115,111,117,114,99,101,46,122,39,115,111,
- 117,114,99,101,32,110,111,116,32,97,118,97,105,108,97,98,
- 108,101,32,116,104,114,111,117,103,104,32,103,101,116,95,100,
- 97,116,97,40,41,114,106,0,0,0,78,41,5,114,157,0,
- 0,0,218,8,103,101,116,95,100,97,116,97,114,40,0,0,
- 0,114,107,0,0,0,114,155,0,0,0,41,5,114,108,0,
- 0,0,114,126,0,0,0,114,35,0,0,0,114,153,0,0,
- 0,218,3,101,120,99,114,4,0,0,0,114,4,0,0,0,
- 114,5,0,0,0,218,10,103,101,116,95,115,111,117,114,99,
- 101,196,2,0,0,115,14,0,0,0,0,2,15,1,3,1,
- 19,1,18,1,9,1,31,1,122,23,83,111,117,114,99,101,
- 76,111,97,100,101,114,46,103,101,116,95,115,111,117,114,99,
- 101,218,9,95,111,112,116,105,109,105,122,101,114,29,0,0,
- 0,99,3,0,0,0,1,0,0,0,4,0,0,0,9,0,
- 0,0,67,0,0,0,115,34,0,0,0,116,0,0,106,1,
- 0,116,2,0,124,1,0,124,2,0,100,1,0,100,2,0,
- 100,3,0,100,4,0,124,3,0,131,4,2,83,41,5,122,
- 130,82,101,116,117,114,110,32,116,104,101,32,99,111,100,101,
- 32,111,98,106,101,99,116,32,99,111,109,112,105,108,101,100,
- 32,102,114,111,109,32,115,111,117,114,99,101,46,10,10,32,
- 32,32,32,32,32,32,32,84,104,101,32,39,100,97,116,97,
- 39,32,97,114,103,117,109,101,110,116,32,99,97,110,32,98,
- 101,32,97,110,121,32,111,98,106,101,99,116,32,116,121,112,
- 101,32,116,104,97,116,32,99,111,109,112,105,108,101,40,41,
- 32,115,117,112,112,111,114,116,115,46,10,32,32,32,32,32,
- 32,32,32,114,189,0,0,0,218,12,100,111,110,116,95,105,
- 110,104,101,114,105,116,84,114,68,0,0,0,41,3,114,121,
- 0,0,0,114,188,0,0,0,218,7,99,111,109,112,105,108,
- 101,41,4,114,108,0,0,0,114,53,0,0,0,114,35,0,
- 0,0,114,203,0,0,0,114,4,0,0,0,114,4,0,0,
- 0,114,5,0,0,0,218,14,115,111,117,114,99,101,95,116,
- 111,95,99,111,100,101,206,2,0,0,115,4,0,0,0,0,
- 5,21,1,122,27,83,111,117,114,99,101,76,111,97,100,101,
- 114,46,115,111,117,114,99,101,95,116,111,95,99,111,100,101,
- 99,2,0,0,0,0,0,0,0,10,0,0,0,43,0,0,
- 0,67,0,0,0,115,174,1,0,0,124,0,0,106,0,0,
- 124,1,0,131,1,0,125,2,0,100,1,0,125,3,0,121,
- 16,0,116,1,0,124,2,0,131,1,0,125,4,0,87,110,
- 24,0,4,116,2,0,107,10,0,114,63,0,1,1,1,100,
- 1,0,125,4,0,89,110,202,0,88,121,19,0,124,0,0,
- 106,3,0,124,2,0,131,1,0,125,5,0,87,110,18,0,
- 4,116,4,0,107,10,0,114,103,0,1,1,1,89,110,162,
- 0,88,116,5,0,124,5,0,100,2,0,25,131,1,0,125,
- 3,0,121,19,0,124,0,0,106,6,0,124,4,0,131,1,
- 0,125,6,0,87,110,18,0,4,116,7,0,107,10,0,114,
- 159,0,1,1,1,89,110,106,0,88,121,34,0,116,8,0,
- 124,6,0,100,3,0,124,5,0,100,4,0,124,1,0,100,
- 5,0,124,4,0,131,1,3,125,7,0,87,110,24,0,4,
- 116,9,0,116,10,0,102,2,0,107,10,0,114,220,0,1,
- 1,1,89,110,45,0,88,116,11,0,100,6,0,124,4,0,
- 124,2,0,131,3,0,1,116,12,0,124,7,0,100,4,0,
- 124,1,0,100,7,0,124,4,0,100,8,0,124,2,0,131,
- 1,3,83,124,0,0,106,6,0,124,2,0,131,1,0,125,
- 8,0,124,0,0,106,13,0,124,8,0,124,2,0,131,2,
- 0,125,9,0,116,11,0,100,9,0,124,2,0,131,2,0,
- 1,116,14,0,106,15,0,12,114,170,1,124,4,0,100,1,
- 0,107,9,0,114,170,1,124,3,0,100,1,0,107,9,0,
- 114,170,1,116,16,0,124,9,0,124,3,0,116,17,0,124,
- 8,0,131,1,0,131,3,0,125,6,0,121,36,0,124,0,
- 0,106,18,0,124,2,0,124,4,0,124,6,0,131,3,0,
- 1,116,11,0,100,10,0,124,4,0,131,2,0,1,87,110,
- 18,0,4,116,2,0,107,10,0,114,169,1,1,1,1,89,
- 110,1,0,88,124,9,0,83,41,11,122,190,67,111,110,99,
+ 105,110,100,101,114,46,95,111,112,101,110,95,114,101,103,105,
+ 115,116,114,121,99,2,0,0,0,0,0,0,0,6,0,0,
+ 0,16,0,0,0,67,0,0,0,115,143,0,0,0,124,0,
+ 0,106,0,0,114,21,0,124,0,0,106,1,0,125,2,0,
+ 110,9,0,124,0,0,106,2,0,125,2,0,124,2,0,106,
+ 3,0,100,1,0,124,1,0,100,2,0,116,4,0,106,5,
+ 0,100,0,0,100,3,0,133,2,0,25,131,0,2,125,3,
+ 0,121,47,0,124,0,0,106,6,0,124,3,0,131,1,0,
+ 143,25,0,125,4,0,116,7,0,106,8,0,124,4,0,100,
+ 4,0,131,2,0,125,5,0,87,100,0,0,81,82,88,87,
+ 110,22,0,4,116,9,0,107,10,0,114,138,0,1,1,1,
+ 100,0,0,83,89,110,1,0,88,124,5,0,83,41,5,78,
+ 114,119,0,0,0,90,11,115,121,115,95,118,101,114,115,105,
+ 111,110,114,80,0,0,0,114,30,0,0,0,41,10,218,11,
+ 68,69,66,85,71,95,66,85,73,76,68,218,18,82,69,71,
+ 73,83,84,82,89,95,75,69,89,95,68,69,66,85,71,218,
+ 12,82,69,71,73,83,84,82,89,95,75,69,89,114,47,0,
+ 0,0,114,7,0,0,0,218,7,118,101,114,115,105,111,110,
+ 114,166,0,0,0,114,163,0,0,0,90,10,81,117,101,114,
+ 121,86,97,108,117,101,114,40,0,0,0,41,6,114,164,0,
+ 0,0,114,119,0,0,0,90,12,114,101,103,105,115,116,114,
+ 121,95,107,101,121,114,165,0,0,0,90,4,104,107,101,121,
+ 218,8,102,105,108,101,112,97,116,104,114,4,0,0,0,114,
+ 4,0,0,0,114,5,0,0,0,218,16,95,115,101,97,114,
+ 99,104,95,114,101,103,105,115,116,114,121,75,2,0,0,115,
+ 22,0,0,0,0,2,9,1,12,2,9,1,15,1,22,1,
+ 3,1,18,1,29,1,13,1,9,1,122,38,87,105,110,100,
+ 111,119,115,82,101,103,105,115,116,114,121,70,105,110,100,101,
+ 114,46,95,115,101,97,114,99,104,95,114,101,103,105,115,116,
+ 114,121,78,99,4,0,0,0,0,0,0,0,8,0,0,0,
+ 14,0,0,0,67,0,0,0,115,158,0,0,0,124,0,0,
+ 106,0,0,124,1,0,131,1,0,125,4,0,124,4,0,100,
+ 0,0,107,8,0,114,31,0,100,0,0,83,121,14,0,116,
+ 1,0,124,4,0,131,1,0,1,87,110,22,0,4,116,2,
+ 0,107,10,0,114,69,0,1,1,1,100,0,0,83,89,110,
+ 1,0,88,120,81,0,116,3,0,131,0,0,68,93,70,0,
+ 92,2,0,125,5,0,125,6,0,124,4,0,106,4,0,116,
+ 5,0,124,6,0,131,1,0,131,1,0,114,80,0,116,6,
+ 0,106,7,0,124,1,0,124,5,0,124,1,0,124,4,0,
+ 131,2,0,100,1,0,124,4,0,131,2,1,125,7,0,124,
+ 7,0,83,113,80,0,87,100,0,0,83,41,2,78,114,152,
+ 0,0,0,41,8,114,172,0,0,0,114,39,0,0,0,114,
+ 40,0,0,0,114,155,0,0,0,114,92,0,0,0,114,93,
+ 0,0,0,114,114,0,0,0,218,16,115,112,101,99,95,102,
+ 114,111,109,95,108,111,97,100,101,114,41,8,114,164,0,0,
+ 0,114,119,0,0,0,114,35,0,0,0,218,6,116,97,114,
+ 103,101,116,114,171,0,0,0,114,120,0,0,0,114,160,0,
+ 0,0,114,158,0,0,0,114,4,0,0,0,114,4,0,0,
+ 0,114,5,0,0,0,218,9,102,105,110,100,95,115,112,101,
+ 99,90,2,0,0,115,26,0,0,0,0,2,15,1,12,1,
+ 4,1,3,1,14,1,13,1,9,1,22,1,21,1,9,1,
+ 15,1,9,1,122,31,87,105,110,100,111,119,115,82,101,103,
+ 105,115,116,114,121,70,105,110,100,101,114,46,102,105,110,100,
+ 95,115,112,101,99,99,3,0,0,0,0,0,0,0,4,0,
+ 0,0,3,0,0,0,67,0,0,0,115,45,0,0,0,124,
+ 0,0,106,0,0,124,1,0,124,2,0,131,2,0,125,3,
+ 0,124,3,0,100,1,0,107,9,0,114,37,0,124,3,0,
+ 106,1,0,83,100,1,0,83,100,1,0,83,41,2,122,108,
+ 70,105,110,100,32,109,111,100,117,108,101,32,110,97,109,101,
+ 100,32,105,110,32,116,104,101,32,114,101,103,105,115,116,114,
+ 121,46,10,10,32,32,32,32,32,32,32,32,84,104,105,115,
+ 32,109,101,116,104,111,100,32,105,115,32,100,101,112,114,101,
+ 99,97,116,101,100,46,32,32,85,115,101,32,101,120,101,99,
+ 95,109,111,100,117,108,101,40,41,32,105,110,115,116,101,97,
+ 100,46,10,10,32,32,32,32,32,32,32,32,78,41,2,114,
+ 175,0,0,0,114,120,0,0,0,41,4,114,164,0,0,0,
+ 114,119,0,0,0,114,35,0,0,0,114,158,0,0,0,114,
+ 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,11,
+ 102,105,110,100,95,109,111,100,117,108,101,106,2,0,0,115,
+ 8,0,0,0,0,7,18,1,12,1,7,2,122,33,87,105,
+ 110,100,111,119,115,82,101,103,105,115,116,114,121,70,105,110,
+ 100,101,114,46,102,105,110,100,95,109,111,100,117,108,101,41,
+ 12,114,105,0,0,0,114,104,0,0,0,114,106,0,0,0,
+ 114,107,0,0,0,114,169,0,0,0,114,168,0,0,0,114,
+ 167,0,0,0,218,11,99,108,97,115,115,109,101,116,104,111,
+ 100,114,166,0,0,0,114,172,0,0,0,114,175,0,0,0,
+ 114,176,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
+ 4,0,0,0,114,5,0,0,0,114,162,0,0,0,56,2,
+ 0,0,115,20,0,0,0,12,2,6,3,6,3,6,2,6,
+ 2,18,7,18,15,3,1,21,15,3,1,114,162,0,0,0,
+ 99,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
+ 0,64,0,0,0,115,70,0,0,0,101,0,0,90,1,0,
+ 100,0,0,90,2,0,100,1,0,90,3,0,100,2,0,100,
+ 3,0,132,0,0,90,4,0,100,4,0,100,5,0,132,0,
+ 0,90,5,0,100,6,0,100,7,0,132,0,0,90,6,0,
+ 100,8,0,100,9,0,132,0,0,90,7,0,100,10,0,83,
+ 41,11,218,13,95,76,111,97,100,101,114,66,97,115,105,99,
+ 115,122,83,66,97,115,101,32,99,108,97,115,115,32,111,102,
+ 32,99,111,109,109,111,110,32,99,111,100,101,32,110,101,101,
+ 100,101,100,32,98,121,32,98,111,116,104,32,83,111,117,114,
+ 99,101,76,111,97,100,101,114,32,97,110,100,10,32,32,32,
+ 32,83,111,117,114,99,101,108,101,115,115,70,105,108,101,76,
+ 111,97,100,101,114,46,99,2,0,0,0,0,0,0,0,5,
+ 0,0,0,3,0,0,0,67,0,0,0,115,88,0,0,0,
+ 116,0,0,124,0,0,106,1,0,124,1,0,131,1,0,131,
+ 1,0,100,1,0,25,125,2,0,124,2,0,106,2,0,100,
+ 2,0,100,1,0,131,2,0,100,3,0,25,125,3,0,124,
+ 1,0,106,3,0,100,2,0,131,1,0,100,4,0,25,125,
+ 4,0,124,3,0,100,5,0,107,2,0,111,87,0,124,4,
+ 0,100,5,0,107,3,0,83,41,6,122,141,67,111,110,99,
114,101,116,101,32,105,109,112,108,101,109,101,110,116,97,116,
105,111,110,32,111,102,32,73,110,115,112,101,99,116,76,111,
- 97,100,101,114,46,103,101,116,95,99,111,100,101,46,10,10,
- 32,32,32,32,32,32,32,32,82,101,97,100,105,110,103,32,
- 111,102,32,98,121,116,101,99,111,100,101,32,114,101,113,117,
- 105,114,101,115,32,112,97,116,104,95,115,116,97,116,115,32,
- 116,111,32,98,101,32,105,109,112,108,101,109,101,110,116,101,
- 100,46,32,84,111,32,119,114,105,116,101,10,32,32,32,32,
- 32,32,32,32,98,121,116,101,99,111,100,101,44,32,115,101,
- 116,95,100,97,116,97,32,109,117,115,116,32,97,108,115,111,
- 32,98,101,32,105,109,112,108,101,109,101,110,116,101,100,46,
- 10,10,32,32,32,32,32,32,32,32,78,114,133,0,0,0,
- 114,138,0,0,0,114,106,0,0,0,114,35,0,0,0,122,
- 13,123,125,32,109,97,116,99,104,101,115,32,123,125,114,89,
- 0,0,0,114,90,0,0,0,122,19,99,111,100,101,32,111,
- 98,106,101,99,116,32,102,114,111,109,32,123,125,122,10,119,
- 114,111,116,101,32,123,33,114,125,41,19,114,157,0,0,0,
- 114,79,0,0,0,114,66,0,0,0,114,197,0,0,0,114,
- 195,0,0,0,114,14,0,0,0,114,200,0,0,0,114,40,
- 0,0,0,114,141,0,0,0,114,107,0,0,0,114,136,0,
- 0,0,114,105,0,0,0,114,147,0,0,0,114,206,0,0,
- 0,114,7,0,0,0,218,19,100,111,110,116,95,119,114,105,
- 116,101,95,98,121,116,101,99,111,100,101,114,150,0,0,0,
- 114,31,0,0,0,114,199,0,0,0,41,10,114,108,0,0,
- 0,114,126,0,0,0,114,90,0,0,0,114,139,0,0,0,
- 114,89,0,0,0,218,2,115,116,114,53,0,0,0,218,10,
- 98,121,116,101,115,95,100,97,116,97,114,153,0,0,0,90,
- 11,99,111,100,101,95,111,98,106,101,99,116,114,4,0,0,
- 0,114,4,0,0,0,114,5,0,0,0,114,187,0,0,0,
- 214,2,0,0,115,78,0,0,0,0,7,15,1,6,1,3,
- 1,16,1,13,1,11,2,3,1,19,1,13,1,5,2,16,
- 1,3,1,19,1,13,1,5,2,3,1,9,1,12,1,13,
- 1,19,1,5,2,9,1,7,1,15,1,6,1,7,1,15,
- 1,18,1,13,1,22,1,12,1,9,1,15,1,3,1,19,
- 1,17,1,13,1,5,1,122,21,83,111,117,114,99,101,76,
- 111,97,100,101,114,46,103,101,116,95,99,111,100,101,78,114,
- 87,0,0,0,41,10,114,112,0,0,0,114,111,0,0,0,
- 114,113,0,0,0,114,196,0,0,0,114,197,0,0,0,114,
- 199,0,0,0,114,198,0,0,0,114,202,0,0,0,114,206,
- 0,0,0,114,187,0,0,0,114,4,0,0,0,114,4,0,
- 0,0,114,4,0,0,0,114,5,0,0,0,114,194,0,0,
- 0,156,2,0,0,115,14,0,0,0,12,2,12,8,12,13,
- 12,10,12,7,12,10,18,8,114,194,0,0,0,99,0,0,
- 0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,
- 0,0,115,112,0,0,0,101,0,0,90,1,0,100,0,0,
- 90,2,0,100,1,0,90,3,0,100,2,0,100,3,0,132,
- 0,0,90,4,0,100,4,0,100,5,0,132,0,0,90,5,
- 0,100,6,0,100,7,0,132,0,0,90,6,0,101,7,0,
- 135,0,0,102,1,0,100,8,0,100,9,0,134,0,0,131,
- 1,0,90,8,0,101,7,0,100,10,0,100,11,0,132,0,
- 0,131,1,0,90,9,0,100,12,0,100,13,0,132,0,0,
- 90,10,0,135,0,0,83,41,14,218,10,70,105,108,101,76,
- 111,97,100,101,114,122,103,66,97,115,101,32,102,105,108,101,
- 32,108,111,97,100,101,114,32,99,108,97,115,115,32,119,104,
- 105,99,104,32,105,109,112,108,101,109,101,110,116,115,32,116,
- 104,101,32,108,111,97,100,101,114,32,112,114,111,116,111,99,
- 111,108,32,109,101,116,104,111,100,115,32,116,104,97,116,10,
- 32,32,32,32,114,101,113,117,105,114,101,32,102,105,108,101,
- 32,115,121,115,116,101,109,32,117,115,97,103,101,46,99,3,
- 0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,67,
- 0,0,0,115,22,0,0,0,124,1,0,124,0,0,95,0,
- 0,124,2,0,124,0,0,95,1,0,100,1,0,83,41,2,
- 122,75,67,97,99,104,101,32,116,104,101,32,109,111,100,117,
- 108,101,32,110,97,109,101,32,97,110,100,32,116,104,101,32,
- 112,97,116,104,32,116,111,32,116,104,101,32,102,105,108,101,
- 32,102,111,117,110,100,32,98,121,32,116,104,101,10,32,32,
- 32,32,32,32,32,32,102,105,110,100,101,114,46,78,41,2,
- 114,106,0,0,0,114,35,0,0,0,41,3,114,108,0,0,
- 0,114,126,0,0,0,114,35,0,0,0,114,4,0,0,0,
- 114,4,0,0,0,114,5,0,0,0,114,185,0,0,0,15,
- 3,0,0,115,4,0,0,0,0,3,9,1,122,19,70,105,
- 108,101,76,111,97,100,101,114,46,95,95,105,110,105,116,95,
- 95,99,2,0,0,0,0,0,0,0,2,0,0,0,2,0,
- 0,0,67,0,0,0,115,34,0,0,0,124,0,0,106,0,
- 0,124,1,0,106,0,0,107,2,0,111,33,0,124,0,0,
- 106,1,0,124,1,0,106,1,0,107,2,0,83,41,1,78,
- 41,2,218,9,95,95,99,108,97,115,115,95,95,114,118,0,
- 0,0,41,2,114,108,0,0,0,218,5,111,116,104,101,114,
- 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,
- 6,95,95,101,113,95,95,21,3,0,0,115,4,0,0,0,
- 0,1,18,1,122,17,70,105,108,101,76,111,97,100,101,114,
- 46,95,95,101,113,95,95,99,1,0,0,0,0,0,0,0,
- 1,0,0,0,3,0,0,0,67,0,0,0,115,26,0,0,
- 0,116,0,0,124,0,0,106,1,0,131,1,0,116,0,0,
- 124,0,0,106,2,0,131,1,0,65,83,41,1,78,41,3,
- 218,4,104,97,115,104,114,106,0,0,0,114,35,0,0,0,
- 41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,0,
- 0,114,5,0,0,0,218,8,95,95,104,97,115,104,95,95,
- 25,3,0,0,115,2,0,0,0,0,1,122,19,70,105,108,
- 101,76,111,97,100,101,114,46,95,95,104,97,115,104,95,95,
- 99,2,0,0,0,0,0,0,0,2,0,0,0,3,0,0,
- 0,3,0,0,0,115,22,0,0,0,116,0,0,116,1,0,
- 124,0,0,131,2,0,106,2,0,124,1,0,131,1,0,83,
- 41,1,122,100,76,111,97,100,32,97,32,109,111,100,117,108,
- 101,32,102,114,111,109,32,97,32,102,105,108,101,46,10,10,
- 32,32,32,32,32,32,32,32,84,104,105,115,32,109,101,116,
- 104,111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,
- 100,46,32,32,85,115,101,32,101,120,101,99,95,109,111,100,
- 117,108,101,40,41,32,105,110,115,116,101,97,100,46,10,10,
- 32,32,32,32,32,32,32,32,41,3,218,5,115,117,112,101,
- 114,114,210,0,0,0,114,193,0,0,0,41,2,114,108,0,
- 0,0,114,126,0,0,0,41,1,114,211,0,0,0,114,4,
- 0,0,0,114,5,0,0,0,114,193,0,0,0,28,3,0,
- 0,115,2,0,0,0,0,10,122,22,70,105,108,101,76,111,
- 97,100,101,114,46,108,111,97,100,95,109,111,100,117,108,101,
- 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,
- 0,67,0,0,0,115,7,0,0,0,124,0,0,106,0,0,
- 83,41,1,122,58,82,101,116,117,114,110,32,116,104,101,32,
- 112,97,116,104,32,116,111,32,116,104,101,32,115,111,117,114,
- 99,101,32,102,105,108,101,32,97,115,32,102,111,117,110,100,
- 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,41,
- 1,114,35,0,0,0,41,2,114,108,0,0,0,114,126,0,
- 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,
- 0,114,157,0,0,0,40,3,0,0,115,2,0,0,0,0,
- 3,122,23,70,105,108,101,76,111,97,100,101,114,46,103,101,
- 116,95,102,105,108,101,110,97,109,101,99,2,0,0,0,0,
- 0,0,0,3,0,0,0,9,0,0,0,67,0,0,0,115,
- 42,0,0,0,116,0,0,106,1,0,124,1,0,100,1,0,
- 131,2,0,143,17,0,125,2,0,124,2,0,106,2,0,131,
- 0,0,83,87,100,2,0,81,82,88,100,2,0,83,41,3,
- 122,39,82,101,116,117,114,110,32,116,104,101,32,100,97,116,
- 97,32,102,114,111,109,32,112,97,116,104,32,97,115,32,114,
- 97,119,32,98,121,116,101,115,46,218,1,114,78,41,3,114,
- 49,0,0,0,114,50,0,0,0,90,4,114,101,97,100,41,
- 3,114,108,0,0,0,114,35,0,0,0,114,54,0,0,0,
+ 97,100,101,114,46,105,115,95,112,97,99,107,97,103,101,32,
+ 98,121,32,99,104,101,99,107,105,110,103,32,105,102,10,32,
+ 32,32,32,32,32,32,32,116,104,101,32,112,97,116,104,32,
+ 114,101,116,117,114,110,101,100,32,98,121,32,103,101,116,95,
+ 102,105,108,101,110,97,109,101,32,104,97,115,32,97,32,102,
+ 105,108,101,110,97,109,101,32,111,102,32,39,95,95,105,110,
+ 105,116,95,95,46,112,121,39,46,114,29,0,0,0,114,58,
+ 0,0,0,114,59,0,0,0,114,56,0,0,0,218,8,95,
+ 95,105,110,105,116,95,95,41,4,114,38,0,0,0,114,151,
+ 0,0,0,114,34,0,0,0,114,32,0,0,0,41,5,114,
+ 100,0,0,0,114,119,0,0,0,114,94,0,0,0,90,13,
+ 102,105,108,101,110,97,109,101,95,98,97,115,101,90,9,116,
+ 97,105,108,95,110,97,109,101,114,4,0,0,0,114,4,0,
+ 0,0,114,5,0,0,0,114,153,0,0,0,125,2,0,0,
+ 115,8,0,0,0,0,3,25,1,22,1,19,1,122,24,95,
+ 76,111,97,100,101,114,66,97,115,105,99,115,46,105,115,95,
+ 112,97,99,107,97,103,101,99,2,0,0,0,0,0,0,0,
+ 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,
+ 0,100,1,0,83,41,2,122,42,85,115,101,32,100,101,102,
+ 97,117,108,116,32,115,101,109,97,110,116,105,99,115,32,102,
+ 111,114,32,109,111,100,117,108,101,32,99,114,101,97,116,105,
+ 111,110,46,78,114,4,0,0,0,41,2,114,100,0,0,0,
+ 114,158,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
+ 5,0,0,0,218,13,99,114,101,97,116,101,95,109,111,100,
+ 117,108,101,133,2,0,0,115,0,0,0,0,122,27,95,76,
+ 111,97,100,101,114,66,97,115,105,99,115,46,99,114,101,97,
+ 116,101,95,109,111,100,117,108,101,99,2,0,0,0,0,0,
+ 0,0,3,0,0,0,4,0,0,0,67,0,0,0,115,80,
+ 0,0,0,124,0,0,106,0,0,124,1,0,106,1,0,131,
+ 1,0,125,2,0,124,2,0,100,1,0,107,8,0,114,54,
+ 0,116,2,0,100,2,0,106,3,0,124,1,0,106,1,0,
+ 131,1,0,131,1,0,130,1,0,116,4,0,106,5,0,116,
+ 6,0,124,2,0,124,1,0,106,7,0,131,3,0,1,100,
+ 1,0,83,41,3,122,19,69,120,101,99,117,116,101,32,116,
+ 104,101,32,109,111,100,117,108,101,46,78,122,52,99,97,110,
+ 110,111,116,32,108,111,97,100,32,109,111,100,117,108,101,32,
+ 123,33,114,125,32,119,104,101,110,32,103,101,116,95,99,111,
+ 100,101,40,41,32,114,101,116,117,114,110,115,32,78,111,110,
+ 101,41,8,218,8,103,101,116,95,99,111,100,101,114,105,0,
+ 0,0,114,99,0,0,0,114,47,0,0,0,114,114,0,0,
+ 0,218,25,95,99,97,108,108,95,119,105,116,104,95,102,114,
+ 97,109,101,115,95,114,101,109,111,118,101,100,218,4,101,120,
+ 101,99,114,111,0,0,0,41,3,114,100,0,0,0,218,6,
+ 109,111,100,117,108,101,114,140,0,0,0,114,4,0,0,0,
+ 114,4,0,0,0,114,5,0,0,0,218,11,101,120,101,99,
+ 95,109,111,100,117,108,101,136,2,0,0,115,10,0,0,0,
+ 0,2,18,1,12,1,9,1,15,1,122,25,95,76,111,97,
+ 100,101,114,66,97,115,105,99,115,46,101,120,101,99,95,109,
+ 111,100,117,108,101,99,2,0,0,0,0,0,0,0,2,0,
+ 0,0,3,0,0,0,67,0,0,0,115,16,0,0,0,116,
+ 0,0,106,1,0,124,0,0,124,1,0,131,2,0,83,41,
+ 1,78,41,2,114,114,0,0,0,218,17,95,108,111,97,100,
+ 95,109,111,100,117,108,101,95,115,104,105,109,41,2,114,100,
+ 0,0,0,114,119,0,0,0,114,4,0,0,0,114,4,0,
+ 0,0,114,5,0,0,0,218,11,108,111,97,100,95,109,111,
+ 100,117,108,101,144,2,0,0,115,2,0,0,0,0,1,122,
+ 25,95,76,111,97,100,101,114,66,97,115,105,99,115,46,108,
+ 111,97,100,95,109,111,100,117,108,101,78,41,8,114,105,0,
+ 0,0,114,104,0,0,0,114,106,0,0,0,114,107,0,0,
+ 0,114,153,0,0,0,114,180,0,0,0,114,185,0,0,0,
+ 114,187,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
+ 4,0,0,0,114,5,0,0,0,114,178,0,0,0,120,2,
+ 0,0,115,10,0,0,0,12,3,6,2,12,8,12,3,12,
+ 8,114,178,0,0,0,99,0,0,0,0,0,0,0,0,0,
+ 0,0,0,4,0,0,0,64,0,0,0,115,106,0,0,0,
+ 101,0,0,90,1,0,100,0,0,90,2,0,100,1,0,100,
+ 2,0,132,0,0,90,3,0,100,3,0,100,4,0,132,0,
+ 0,90,4,0,100,5,0,100,6,0,132,0,0,90,5,0,
+ 100,7,0,100,8,0,132,0,0,90,6,0,100,9,0,100,
+ 10,0,132,0,0,90,7,0,100,11,0,100,18,0,100,13,
+ 0,100,14,0,132,0,1,90,8,0,100,15,0,100,16,0,
+ 132,0,0,90,9,0,100,17,0,83,41,19,218,12,83,111,
+ 117,114,99,101,76,111,97,100,101,114,99,2,0,0,0,0,
+ 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,
+ 10,0,0,0,116,0,0,130,1,0,100,1,0,83,41,2,
+ 122,178,79,112,116,105,111,110,97,108,32,109,101,116,104,111,
+ 100,32,116,104,97,116,32,114,101,116,117,114,110,115,32,116,
+ 104,101,32,109,111,100,105,102,105,99,97,116,105,111,110,32,
+ 116,105,109,101,32,40,97,110,32,105,110,116,41,32,102,111,
+ 114,32,116,104,101,10,32,32,32,32,32,32,32,32,115,112,
+ 101,99,105,102,105,101,100,32,112,97,116,104,44,32,119,104,
+ 101,114,101,32,112,97,116,104,32,105,115,32,97,32,115,116,
+ 114,46,10,10,32,32,32,32,32,32,32,32,82,97,105,115,
+ 101,115,32,73,79,69,114,114,111,114,32,119,104,101,110,32,
+ 116,104,101,32,112,97,116,104,32,99,97,110,110,111,116,32,
+ 98,101,32,104,97,110,100,108,101,100,46,10,32,32,32,32,
+ 32,32,32,32,78,41,1,218,7,73,79,69,114,114,111,114,
+ 41,2,114,100,0,0,0,114,35,0,0,0,114,4,0,0,
+ 0,114,4,0,0,0,114,5,0,0,0,218,10,112,97,116,
+ 104,95,109,116,105,109,101,150,2,0,0,115,2,0,0,0,
+ 0,6,122,23,83,111,117,114,99,101,76,111,97,100,101,114,
+ 46,112,97,116,104,95,109,116,105,109,101,99,2,0,0,0,
+ 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,
+ 115,19,0,0,0,100,1,0,124,0,0,106,0,0,124,1,
+ 0,131,1,0,105,1,0,83,41,2,97,170,1,0,0,79,
+ 112,116,105,111,110,97,108,32,109,101,116,104,111,100,32,114,
+ 101,116,117,114,110,105,110,103,32,97,32,109,101,116,97,100,
+ 97,116,97,32,100,105,99,116,32,102,111,114,32,116,104,101,
+ 32,115,112,101,99,105,102,105,101,100,32,112,97,116,104,10,
+ 32,32,32,32,32,32,32,32,116,111,32,98,121,32,116,104,
+ 101,32,112,97,116,104,32,40,115,116,114,41,46,10,32,32,
+ 32,32,32,32,32,32,80,111,115,115,105,98,108,101,32,107,
+ 101,121,115,58,10,32,32,32,32,32,32,32,32,45,32,39,
+ 109,116,105,109,101,39,32,40,109,97,110,100,97,116,111,114,
+ 121,41,32,105,115,32,116,104,101,32,110,117,109,101,114,105,
+ 99,32,116,105,109,101,115,116,97,109,112,32,111,102,32,108,
+ 97,115,116,32,115,111,117,114,99,101,10,32,32,32,32,32,
+ 32,32,32,32,32,99,111,100,101,32,109,111,100,105,102,105,
+ 99,97,116,105,111,110,59,10,32,32,32,32,32,32,32,32,
+ 45,32,39,115,105,122,101,39,32,40,111,112,116,105,111,110,
+ 97,108,41,32,105,115,32,116,104,101,32,115,105,122,101,32,
+ 105,110,32,98,121,116,101,115,32,111,102,32,116,104,101,32,
+ 115,111,117,114,99,101,32,99,111,100,101,46,10,10,32,32,
+ 32,32,32,32,32,32,73,109,112,108,101,109,101,110,116,105,
+ 110,103,32,116,104,105,115,32,109,101,116,104,111,100,32,97,
+ 108,108,111,119,115,32,116,104,101,32,108,111,97,100,101,114,
+ 32,116,111,32,114,101,97,100,32,98,121,116,101,99,111,100,
+ 101,32,102,105,108,101,115,46,10,32,32,32,32,32,32,32,
+ 32,82,97,105,115,101,115,32,73,79,69,114,114,111,114,32,
+ 119,104,101,110,32,116,104,101,32,112,97,116,104,32,99,97,
+ 110,110,111,116,32,98,101,32,104,97,110,100,108,101,100,46,
+ 10,32,32,32,32,32,32,32,32,114,126,0,0,0,41,1,
+ 114,190,0,0,0,41,2,114,100,0,0,0,114,35,0,0,
+ 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
+ 218,10,112,97,116,104,95,115,116,97,116,115,158,2,0,0,
+ 115,2,0,0,0,0,11,122,23,83,111,117,114,99,101,76,
+ 111,97,100,101,114,46,112,97,116,104,95,115,116,97,116,115,
+ 99,4,0,0,0,0,0,0,0,4,0,0,0,3,0,0,
+ 0,67,0,0,0,115,16,0,0,0,124,0,0,106,0,0,
+ 124,2,0,124,3,0,131,2,0,83,41,1,122,228,79,112,
+ 116,105,111,110,97,108,32,109,101,116,104,111,100,32,119,104,
+ 105,99,104,32,119,114,105,116,101,115,32,100,97,116,97,32,
+ 40,98,121,116,101,115,41,32,116,111,32,97,32,102,105,108,
+ 101,32,112,97,116,104,32,40,97,32,115,116,114,41,46,10,
+ 10,32,32,32,32,32,32,32,32,73,109,112,108,101,109,101,
+ 110,116,105,110,103,32,116,104,105,115,32,109,101,116,104,111,
+ 100,32,97,108,108,111,119,115,32,102,111,114,32,116,104,101,
+ 32,119,114,105,116,105,110,103,32,111,102,32,98,121,116,101,
+ 99,111,100,101,32,102,105,108,101,115,46,10,10,32,32,32,
+ 32,32,32,32,32,84,104,101,32,115,111,117,114,99,101,32,
+ 112,97,116,104,32,105,115,32,110,101,101,100,101,100,32,105,
+ 110,32,111,114,100,101,114,32,116,111,32,99,111,114,114,101,
+ 99,116,108,121,32,116,114,97,110,115,102,101,114,32,112,101,
+ 114,109,105,115,115,105,111,110,115,10,32,32,32,32,32,32,
+ 32,32,41,1,218,8,115,101,116,95,100,97,116,97,41,4,
+ 114,100,0,0,0,114,90,0,0,0,90,10,99,97,99,104,
+ 101,95,112,97,116,104,114,53,0,0,0,114,4,0,0,0,
+ 114,4,0,0,0,114,5,0,0,0,218,15,95,99,97,99,
+ 104,101,95,98,121,116,101,99,111,100,101,171,2,0,0,115,
+ 2,0,0,0,0,8,122,28,83,111,117,114,99,101,76,111,
+ 97,100,101,114,46,95,99,97,99,104,101,95,98,121,116,101,
+ 99,111,100,101,99,3,0,0,0,0,0,0,0,3,0,0,
+ 0,1,0,0,0,67,0,0,0,115,4,0,0,0,100,1,
+ 0,83,41,2,122,150,79,112,116,105,111,110,97,108,32,109,
+ 101,116,104,111,100,32,119,104,105,99,104,32,119,114,105,116,
+ 101,115,32,100,97,116,97,32,40,98,121,116,101,115,41,32,
+ 116,111,32,97,32,102,105,108,101,32,112,97,116,104,32,40,
+ 97,32,115,116,114,41,46,10,10,32,32,32,32,32,32,32,
+ 32,73,109,112,108,101,109,101,110,116,105,110,103,32,116,104,
+ 105,115,32,109,101,116,104,111,100,32,97,108,108,111,119,115,
+ 32,102,111,114,32,116,104,101,32,119,114,105,116,105,110,103,
+ 32,111,102,32,98,121,116,101,99,111,100,101,32,102,105,108,
+ 101,115,46,10,32,32,32,32,32,32,32,32,78,114,4,0,
+ 0,0,41,3,114,100,0,0,0,114,35,0,0,0,114,53,
+ 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,
+ 0,0,114,192,0,0,0,181,2,0,0,115,0,0,0,0,
+ 122,21,83,111,117,114,99,101,76,111,97,100,101,114,46,115,
+ 101,116,95,100,97,116,97,99,2,0,0,0,0,0,0,0,
+ 5,0,0,0,16,0,0,0,67,0,0,0,115,105,0,0,
+ 0,124,0,0,106,0,0,124,1,0,131,1,0,125,2,0,
+ 121,19,0,124,0,0,106,1,0,124,2,0,131,1,0,125,
+ 3,0,87,110,58,0,4,116,2,0,107,10,0,114,94,0,
+ 1,125,4,0,1,122,26,0,116,3,0,100,1,0,100,2,
+ 0,124,1,0,131,1,1,124,4,0,130,2,0,87,89,100,
+ 3,0,100,3,0,125,4,0,126,4,0,88,110,1,0,88,
+ 116,4,0,124,3,0,131,1,0,83,41,4,122,52,67,111,
+ 110,99,114,101,116,101,32,105,109,112,108,101,109,101,110,116,
+ 97,116,105,111,110,32,111,102,32,73,110,115,112,101,99,116,
+ 76,111,97,100,101,114,46,103,101,116,95,115,111,117,114,99,
+ 101,46,122,39,115,111,117,114,99,101,32,110,111,116,32,97,
+ 118,97,105,108,97,98,108,101,32,116,104,114,111,117,103,104,
+ 32,103,101,116,95,100,97,116,97,40,41,114,98,0,0,0,
+ 78,41,5,114,151,0,0,0,218,8,103,101,116,95,100,97,
+ 116,97,114,40,0,0,0,114,99,0,0,0,114,149,0,0,
+ 0,41,5,114,100,0,0,0,114,119,0,0,0,114,35,0,
+ 0,0,114,147,0,0,0,218,3,101,120,99,114,4,0,0,
+ 0,114,4,0,0,0,114,5,0,0,0,218,10,103,101,116,
+ 95,115,111,117,114,99,101,188,2,0,0,115,14,0,0,0,
+ 0,2,15,1,3,1,19,1,18,1,9,1,31,1,122,23,
+ 83,111,117,114,99,101,76,111,97,100,101,114,46,103,101,116,
+ 95,115,111,117,114,99,101,218,9,95,111,112,116,105,109,105,
+ 122,101,114,29,0,0,0,99,3,0,0,0,1,0,0,0,
+ 4,0,0,0,9,0,0,0,67,0,0,0,115,34,0,0,
+ 0,116,0,0,106,1,0,116,2,0,124,1,0,124,2,0,
+ 100,1,0,100,2,0,100,3,0,100,4,0,124,3,0,131,
+ 4,2,83,41,5,122,130,82,101,116,117,114,110,32,116,104,
+ 101,32,99,111,100,101,32,111,98,106,101,99,116,32,99,111,
+ 109,112,105,108,101,100,32,102,114,111,109,32,115,111,117,114,
+ 99,101,46,10,10,32,32,32,32,32,32,32,32,84,104,101,
+ 32,39,100,97,116,97,39,32,97,114,103,117,109,101,110,116,
+ 32,99,97,110,32,98,101,32,97,110,121,32,111,98,106,101,
+ 99,116,32,116,121,112,101,32,116,104,97,116,32,99,111,109,
+ 112,105,108,101,40,41,32,115,117,112,112,111,114,116,115,46,
+ 10,32,32,32,32,32,32,32,32,114,183,0,0,0,218,12,
+ 100,111,110,116,95,105,110,104,101,114,105,116,84,114,68,0,
+ 0,0,41,3,114,114,0,0,0,114,182,0,0,0,218,7,
+ 99,111,109,112,105,108,101,41,4,114,100,0,0,0,114,53,
+ 0,0,0,114,35,0,0,0,114,197,0,0,0,114,4,0,
+ 0,0,114,4,0,0,0,114,5,0,0,0,218,14,115,111,
+ 117,114,99,101,95,116,111,95,99,111,100,101,198,2,0,0,
+ 115,4,0,0,0,0,5,21,1,122,27,83,111,117,114,99,
+ 101,76,111,97,100,101,114,46,115,111,117,114,99,101,95,116,
+ 111,95,99,111,100,101,99,2,0,0,0,0,0,0,0,10,
+ 0,0,0,43,0,0,0,67,0,0,0,115,183,1,0,0,
+ 124,0,0,106,0,0,124,1,0,131,1,0,125,2,0,100,
+ 1,0,125,3,0,121,16,0,116,1,0,124,2,0,131,1,
+ 0,125,4,0,87,110,24,0,4,116,2,0,107,10,0,114,
+ 63,0,1,1,1,100,1,0,125,4,0,89,110,205,0,88,
+ 121,19,0,124,0,0,106,3,0,124,2,0,131,1,0,125,
+ 5,0,87,110,18,0,4,116,4,0,107,10,0,114,103,0,
+ 1,1,1,89,110,165,0,88,116,5,0,124,5,0,100,2,
+ 0,25,131,1,0,125,3,0,121,19,0,124,0,0,106,6,
+ 0,124,4,0,131,1,0,125,6,0,87,110,18,0,4,116,
+ 7,0,107,10,0,114,159,0,1,1,1,89,110,109,0,88,
+ 121,34,0,116,8,0,124,6,0,100,3,0,124,5,0,100,
+ 4,0,124,1,0,100,5,0,124,4,0,131,1,3,125,7,
+ 0,87,110,24,0,4,116,9,0,116,10,0,102,2,0,107,
+ 10,0,114,220,0,1,1,1,89,110,48,0,88,116,11,0,
+ 106,12,0,100,6,0,124,4,0,124,2,0,131,3,0,1,
+ 116,13,0,124,7,0,100,4,0,124,1,0,100,7,0,124,
+ 4,0,100,8,0,124,2,0,131,1,3,83,124,0,0,106,
+ 6,0,124,2,0,131,1,0,125,8,0,124,0,0,106,14,
+ 0,124,8,0,124,2,0,131,2,0,125,9,0,116,11,0,
+ 106,12,0,100,9,0,124,2,0,131,2,0,1,116,15,0,
+ 106,16,0,12,114,179,1,124,4,0,100,1,0,107,9,0,
+ 114,179,1,124,3,0,100,1,0,107,9,0,114,179,1,116,
+ 17,0,124,9,0,124,3,0,116,18,0,124,8,0,131,1,
+ 0,131,3,0,125,6,0,121,39,0,124,0,0,106,19,0,
+ 124,2,0,124,4,0,124,6,0,131,3,0,1,116,11,0,
+ 106,12,0,100,10,0,124,4,0,131,2,0,1,87,110,18,
+ 0,4,116,2,0,107,10,0,114,178,1,1,1,1,89,110,
+ 1,0,88,124,9,0,83,41,11,122,190,67,111,110,99,114,
+ 101,116,101,32,105,109,112,108,101,109,101,110,116,97,116,105,
+ 111,110,32,111,102,32,73,110,115,112,101,99,116,76,111,97,
+ 100,101,114,46,103,101,116,95,99,111,100,101,46,10,10,32,
+ 32,32,32,32,32,32,32,82,101,97,100,105,110,103,32,111,
+ 102,32,98,121,116,101,99,111,100,101,32,114,101,113,117,105,
+ 114,101,115,32,112,97,116,104,95,115,116,97,116,115,32,116,
+ 111,32,98,101,32,105,109,112,108,101,109,101,110,116,101,100,
+ 46,32,84,111,32,119,114,105,116,101,10,32,32,32,32,32,
+ 32,32,32,98,121,116,101,99,111,100,101,44,32,115,101,116,
+ 95,100,97,116,97,32,109,117,115,116,32,97,108,115,111,32,
+ 98,101,32,105,109,112,108,101,109,101,110,116,101,100,46,10,
+ 10,32,32,32,32,32,32,32,32,78,114,126,0,0,0,114,
+ 132,0,0,0,114,98,0,0,0,114,35,0,0,0,122,13,
+ 123,125,32,109,97,116,99,104,101,115,32,123,125,114,89,0,
+ 0,0,114,90,0,0,0,122,19,99,111,100,101,32,111,98,
+ 106,101,99,116,32,102,114,111,109,32,123,125,122,10,119,114,
+ 111,116,101,32,123,33,114,125,41,20,114,151,0,0,0,114,
+ 79,0,0,0,114,66,0,0,0,114,191,0,0,0,114,189,
+ 0,0,0,114,14,0,0,0,114,194,0,0,0,114,40,0,
+ 0,0,114,135,0,0,0,114,99,0,0,0,114,130,0,0,
+ 0,114,114,0,0,0,114,129,0,0,0,114,141,0,0,0,
+ 114,200,0,0,0,114,7,0,0,0,218,19,100,111,110,116,
+ 95,119,114,105,116,101,95,98,121,116,101,99,111,100,101,114,
+ 144,0,0,0,114,31,0,0,0,114,193,0,0,0,41,10,
+ 114,100,0,0,0,114,119,0,0,0,114,90,0,0,0,114,
+ 133,0,0,0,114,89,0,0,0,218,2,115,116,114,53,0,
+ 0,0,218,10,98,121,116,101,115,95,100,97,116,97,114,147,
+ 0,0,0,90,11,99,111,100,101,95,111,98,106,101,99,116,
114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,
- 200,0,0,0,45,3,0,0,115,4,0,0,0,0,2,21,
- 1,122,19,70,105,108,101,76,111,97,100,101,114,46,103,101,
- 116,95,100,97,116,97,41,11,114,112,0,0,0,114,111,0,
- 0,0,114,113,0,0,0,114,114,0,0,0,114,185,0,0,
- 0,114,213,0,0,0,114,215,0,0,0,114,123,0,0,0,
- 114,193,0,0,0,114,157,0,0,0,114,200,0,0,0,114,
- 4,0,0,0,114,4,0,0,0,41,1,114,211,0,0,0,
- 114,5,0,0,0,114,210,0,0,0,10,3,0,0,115,14,
- 0,0,0,12,3,6,2,12,6,12,4,12,3,24,12,18,
- 5,114,210,0,0,0,99,0,0,0,0,0,0,0,0,0,
- 0,0,0,4,0,0,0,64,0,0,0,115,64,0,0,0,
+ 181,0,0,0,206,2,0,0,115,78,0,0,0,0,7,15,
+ 1,6,1,3,1,16,1,13,1,11,2,3,1,19,1,13,
+ 1,5,2,16,1,3,1,19,1,13,1,5,2,3,1,9,
+ 1,12,1,13,1,19,1,5,2,12,1,7,1,15,1,6,
+ 1,7,1,15,1,18,1,16,1,22,1,12,1,9,1,15,
+ 1,3,1,19,1,20,1,13,1,5,1,122,21,83,111,117,
+ 114,99,101,76,111,97,100,101,114,46,103,101,116,95,99,111,
+ 100,101,78,114,87,0,0,0,41,10,114,105,0,0,0,114,
+ 104,0,0,0,114,106,0,0,0,114,190,0,0,0,114,191,
+ 0,0,0,114,193,0,0,0,114,192,0,0,0,114,196,0,
+ 0,0,114,200,0,0,0,114,181,0,0,0,114,4,0,0,
+ 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
+ 114,188,0,0,0,148,2,0,0,115,14,0,0,0,12,2,
+ 12,8,12,13,12,10,12,7,12,10,18,8,114,188,0,0,
+ 0,99,0,0,0,0,0,0,0,0,0,0,0,0,4,0,
+ 0,0,0,0,0,0,115,112,0,0,0,101,0,0,90,1,
+ 0,100,0,0,90,2,0,100,1,0,90,3,0,100,2,0,
+ 100,3,0,132,0,0,90,4,0,100,4,0,100,5,0,132,
+ 0,0,90,5,0,100,6,0,100,7,0,132,0,0,90,6,
+ 0,101,7,0,135,0,0,102,1,0,100,8,0,100,9,0,
+ 134,0,0,131,1,0,90,8,0,101,7,0,100,10,0,100,
+ 11,0,132,0,0,131,1,0,90,9,0,100,12,0,100,13,
+ 0,132,0,0,90,10,0,135,0,0,83,41,14,218,10,70,
+ 105,108,101,76,111,97,100,101,114,122,103,66,97,115,101,32,
+ 102,105,108,101,32,108,111,97,100,101,114,32,99,108,97,115,
+ 115,32,119,104,105,99,104,32,105,109,112,108,101,109,101,110,
+ 116,115,32,116,104,101,32,108,111,97,100,101,114,32,112,114,
+ 111,116,111,99,111,108,32,109,101,116,104,111,100,115,32,116,
+ 104,97,116,10,32,32,32,32,114,101,113,117,105,114,101,32,
+ 102,105,108,101,32,115,121,115,116,101,109,32,117,115,97,103,
+ 101,46,99,3,0,0,0,0,0,0,0,3,0,0,0,2,
+ 0,0,0,67,0,0,0,115,22,0,0,0,124,1,0,124,
+ 0,0,95,0,0,124,2,0,124,0,0,95,1,0,100,1,
+ 0,83,41,2,122,75,67,97,99,104,101,32,116,104,101,32,
+ 109,111,100,117,108,101,32,110,97,109,101,32,97,110,100,32,
+ 116,104,101,32,112,97,116,104,32,116,111,32,116,104,101,32,
+ 102,105,108,101,32,102,111,117,110,100,32,98,121,32,116,104,
+ 101,10,32,32,32,32,32,32,32,32,102,105,110,100,101,114,
+ 46,78,41,2,114,98,0,0,0,114,35,0,0,0,41,3,
+ 114,100,0,0,0,114,119,0,0,0,114,35,0,0,0,114,
+ 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,179,
+ 0,0,0,7,3,0,0,115,4,0,0,0,0,3,9,1,
+ 122,19,70,105,108,101,76,111,97,100,101,114,46,95,95,105,
+ 110,105,116,95,95,99,2,0,0,0,0,0,0,0,2,0,
+ 0,0,2,0,0,0,67,0,0,0,115,34,0,0,0,124,
+ 0,0,106,0,0,124,1,0,106,0,0,107,2,0,111,33,
+ 0,124,0,0,106,1,0,124,1,0,106,1,0,107,2,0,
+ 83,41,1,78,41,2,218,9,95,95,99,108,97,115,115,95,
+ 95,114,111,0,0,0,41,2,114,100,0,0,0,218,5,111,
+ 116,104,101,114,114,4,0,0,0,114,4,0,0,0,114,5,
+ 0,0,0,218,6,95,95,101,113,95,95,13,3,0,0,115,
+ 4,0,0,0,0,1,18,1,122,17,70,105,108,101,76,111,
+ 97,100,101,114,46,95,95,101,113,95,95,99,1,0,0,0,
+ 0,0,0,0,1,0,0,0,3,0,0,0,67,0,0,0,
+ 115,26,0,0,0,116,0,0,124,0,0,106,1,0,131,1,
+ 0,116,0,0,124,0,0,106,2,0,131,1,0,65,83,41,
+ 1,78,41,3,218,4,104,97,115,104,114,98,0,0,0,114,
+ 35,0,0,0,41,1,114,100,0,0,0,114,4,0,0,0,
+ 114,4,0,0,0,114,5,0,0,0,218,8,95,95,104,97,
+ 115,104,95,95,17,3,0,0,115,2,0,0,0,0,1,122,
+ 19,70,105,108,101,76,111,97,100,101,114,46,95,95,104,97,
+ 115,104,95,95,99,2,0,0,0,0,0,0,0,2,0,0,
+ 0,3,0,0,0,3,0,0,0,115,22,0,0,0,116,0,
+ 0,116,1,0,124,0,0,131,2,0,106,2,0,124,1,0,
+ 131,1,0,83,41,1,122,100,76,111,97,100,32,97,32,109,
+ 111,100,117,108,101,32,102,114,111,109,32,97,32,102,105,108,
+ 101,46,10,10,32,32,32,32,32,32,32,32,84,104,105,115,
+ 32,109,101,116,104,111,100,32,105,115,32,100,101,112,114,101,
+ 99,97,116,101,100,46,32,32,85,115,101,32,101,120,101,99,
+ 95,109,111,100,117,108,101,40,41,32,105,110,115,116,101,97,
+ 100,46,10,10,32,32,32,32,32,32,32,32,41,3,218,5,
+ 115,117,112,101,114,114,204,0,0,0,114,187,0,0,0,41,
+ 2,114,100,0,0,0,114,119,0,0,0,41,1,114,205,0,
+ 0,0,114,4,0,0,0,114,5,0,0,0,114,187,0,0,
+ 0,20,3,0,0,115,2,0,0,0,0,10,122,22,70,105,
+ 108,101,76,111,97,100,101,114,46,108,111,97,100,95,109,111,
+ 100,117,108,101,99,2,0,0,0,0,0,0,0,2,0,0,
+ 0,1,0,0,0,67,0,0,0,115,7,0,0,0,124,0,
+ 0,106,0,0,83,41,1,122,58,82,101,116,117,114,110,32,
+ 116,104,101,32,112,97,116,104,32,116,111,32,116,104,101,32,
+ 115,111,117,114,99,101,32,102,105,108,101,32,97,115,32,102,
+ 111,117,110,100,32,98,121,32,116,104,101,32,102,105,110,100,
+ 101,114,46,41,1,114,35,0,0,0,41,2,114,100,0,0,
+ 0,114,119,0,0,0,114,4,0,0,0,114,4,0,0,0,
+ 114,5,0,0,0,114,151,0,0,0,32,3,0,0,115,2,
+ 0,0,0,0,3,122,23,70,105,108,101,76,111,97,100,101,
+ 114,46,103,101,116,95,102,105,108,101,110,97,109,101,99,2,
+ 0,0,0,0,0,0,0,3,0,0,0,9,0,0,0,67,
+ 0,0,0,115,42,0,0,0,116,0,0,106,1,0,124,1,
+ 0,100,1,0,131,2,0,143,17,0,125,2,0,124,2,0,
+ 106,2,0,131,0,0,83,87,100,2,0,81,82,88,100,2,
+ 0,83,41,3,122,39,82,101,116,117,114,110,32,116,104,101,
+ 32,100,97,116,97,32,102,114,111,109,32,112,97,116,104,32,
+ 97,115,32,114,97,119,32,98,121,116,101,115,46,218,1,114,
+ 78,41,3,114,49,0,0,0,114,50,0,0,0,90,4,114,
+ 101,97,100,41,3,114,100,0,0,0,114,35,0,0,0,114,
+ 54,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,
+ 0,0,0,114,194,0,0,0,37,3,0,0,115,4,0,0,
+ 0,0,2,21,1,122,19,70,105,108,101,76,111,97,100,101,
+ 114,46,103,101,116,95,100,97,116,97,41,11,114,105,0,0,
+ 0,114,104,0,0,0,114,106,0,0,0,114,107,0,0,0,
+ 114,179,0,0,0,114,207,0,0,0,114,209,0,0,0,114,
+ 116,0,0,0,114,187,0,0,0,114,151,0,0,0,114,194,
+ 0,0,0,114,4,0,0,0,114,4,0,0,0,41,1,114,
+ 205,0,0,0,114,5,0,0,0,114,204,0,0,0,2,3,
+ 0,0,115,14,0,0,0,12,3,6,2,12,6,12,4,12,
+ 3,24,12,18,5,114,204,0,0,0,99,0,0,0,0,0,
+ 0,0,0,0,0,0,0,4,0,0,0,64,0,0,0,115,
+ 64,0,0,0,101,0,0,90,1,0,100,0,0,90,2,0,
+ 100,1,0,90,3,0,100,2,0,100,3,0,132,0,0,90,
+ 4,0,100,4,0,100,5,0,132,0,0,90,5,0,100,6,
+ 0,100,7,0,100,8,0,100,9,0,132,0,1,90,6,0,
+ 100,10,0,83,41,11,218,16,83,111,117,114,99,101,70,105,
+ 108,101,76,111,97,100,101,114,122,62,67,111,110,99,114,101,
+ 116,101,32,105,109,112,108,101,109,101,110,116,97,116,105,111,
+ 110,32,111,102,32,83,111,117,114,99,101,76,111,97,100,101,
+ 114,32,117,115,105,110,103,32,116,104,101,32,102,105,108,101,
+ 32,115,121,115,116,101,109,46,99,2,0,0,0,0,0,0,
+ 0,3,0,0,0,4,0,0,0,67,0,0,0,115,34,0,
+ 0,0,116,0,0,124,1,0,131,1,0,125,2,0,100,1,
+ 0,124,2,0,106,1,0,100,2,0,124,2,0,106,2,0,
+ 105,2,0,83,41,3,122,33,82,101,116,117,114,110,32,116,
+ 104,101,32,109,101,116,97,100,97,116,97,32,102,111,114,32,
+ 116,104,101,32,112,97,116,104,46,114,126,0,0,0,114,127,
+ 0,0,0,41,3,114,39,0,0,0,218,8,115,116,95,109,
+ 116,105,109,101,90,7,115,116,95,115,105,122,101,41,3,114,
+ 100,0,0,0,114,35,0,0,0,114,202,0,0,0,114,4,
+ 0,0,0,114,4,0,0,0,114,5,0,0,0,114,191,0,
+ 0,0,47,3,0,0,115,4,0,0,0,0,2,12,1,122,
+ 27,83,111,117,114,99,101,70,105,108,101,76,111,97,100,101,
+ 114,46,112,97,116,104,95,115,116,97,116,115,99,4,0,0,
+ 0,0,0,0,0,5,0,0,0,5,0,0,0,67,0,0,
+ 0,115,34,0,0,0,116,0,0,124,1,0,131,1,0,125,
+ 4,0,124,0,0,106,1,0,124,2,0,124,3,0,100,1,
+ 0,124,4,0,131,2,1,83,41,2,78,218,5,95,109,111,
+ 100,101,41,2,114,97,0,0,0,114,192,0,0,0,41,5,
+ 114,100,0,0,0,114,90,0,0,0,114,89,0,0,0,114,
+ 53,0,0,0,114,42,0,0,0,114,4,0,0,0,114,4,
+ 0,0,0,114,5,0,0,0,114,193,0,0,0,52,3,0,
+ 0,115,4,0,0,0,0,2,12,1,122,32,83,111,117,114,
+ 99,101,70,105,108,101,76,111,97,100,101,114,46,95,99,97,
+ 99,104,101,95,98,121,116,101,99,111,100,101,114,214,0,0,
+ 0,105,182,1,0,0,99,3,0,0,0,1,0,0,0,9,
+ 0,0,0,17,0,0,0,67,0,0,0,115,62,1,0,0,
+ 116,0,0,124,1,0,131,1,0,92,2,0,125,4,0,125,
+ 5,0,103,0,0,125,6,0,120,54,0,124,4,0,114,80,
+ 0,116,1,0,124,4,0,131,1,0,12,114,80,0,116,0,
+ 0,124,4,0,131,1,0,92,2,0,125,4,0,125,7,0,
+ 124,6,0,106,2,0,124,7,0,131,1,0,1,113,27,0,
+ 87,120,135,0,116,3,0,124,6,0,131,1,0,68,93,121,
+ 0,125,7,0,116,4,0,124,4,0,124,7,0,131,2,0,
+ 125,4,0,121,17,0,116,5,0,106,6,0,124,4,0,131,
+ 1,0,1,87,113,94,0,4,116,7,0,107,10,0,114,155,
+ 0,1,1,1,119,94,0,89,113,94,0,4,116,8,0,107,
+ 10,0,114,214,0,1,125,8,0,1,122,28,0,116,9,0,
+ 106,10,0,100,1,0,124,4,0,124,8,0,131,3,0,1,
+ 100,2,0,83,87,89,100,2,0,100,2,0,125,8,0,126,
+ 8,0,88,113,94,0,88,113,94,0,87,121,36,0,116,11,
+ 0,124,1,0,124,2,0,124,3,0,131,3,0,1,116,9,
+ 0,106,10,0,100,3,0,124,1,0,131,2,0,1,87,110,
+ 56,0,4,116,8,0,107,10,0,114,57,1,1,125,8,0,
+ 1,122,24,0,116,9,0,106,10,0,100,1,0,124,1,0,
+ 124,8,0,131,3,0,1,87,89,100,2,0,100,2,0,125,
+ 8,0,126,8,0,88,110,1,0,88,100,2,0,83,41,4,
+ 122,27,87,114,105,116,101,32,98,121,116,101,115,32,100,97,
+ 116,97,32,116,111,32,97,32,102,105,108,101,46,122,27,99,
+ 111,117,108,100,32,110,111,116,32,99,114,101,97,116,101,32,
+ 123,33,114,125,58,32,123,33,114,125,78,122,12,99,114,101,
+ 97,116,101,100,32,123,33,114,125,41,12,114,38,0,0,0,
+ 114,46,0,0,0,114,157,0,0,0,114,33,0,0,0,114,
+ 28,0,0,0,114,3,0,0,0,90,5,109,107,100,105,114,
+ 218,15,70,105,108,101,69,120,105,115,116,115,69,114,114,111,
+ 114,114,40,0,0,0,114,114,0,0,0,114,129,0,0,0,
+ 114,55,0,0,0,41,9,114,100,0,0,0,114,35,0,0,
+ 0,114,53,0,0,0,114,214,0,0,0,218,6,112,97,114,
+ 101,110,116,114,94,0,0,0,114,27,0,0,0,114,23,0,
+ 0,0,114,195,0,0,0,114,4,0,0,0,114,4,0,0,
+ 0,114,5,0,0,0,114,192,0,0,0,57,3,0,0,115,
+ 42,0,0,0,0,2,18,1,6,2,22,1,18,1,17,2,
+ 19,1,15,1,3,1,17,1,13,2,7,1,18,3,9,1,
+ 10,1,27,1,3,1,16,1,20,1,18,2,12,1,122,25,
+ 83,111,117,114,99,101,70,105,108,101,76,111,97,100,101,114,
+ 46,115,101,116,95,100,97,116,97,78,41,7,114,105,0,0,
+ 0,114,104,0,0,0,114,106,0,0,0,114,107,0,0,0,
+ 114,191,0,0,0,114,193,0,0,0,114,192,0,0,0,114,
+ 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,
+ 0,0,0,114,212,0,0,0,43,3,0,0,115,8,0,0,
+ 0,12,2,6,2,12,5,12,5,114,212,0,0,0,99,0,
+ 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64,
+ 0,0,0,115,46,0,0,0,101,0,0,90,1,0,100,0,
+ 0,90,2,0,100,1,0,90,3,0,100,2,0,100,3,0,
+ 132,0,0,90,4,0,100,4,0,100,5,0,132,0,0,90,
+ 5,0,100,6,0,83,41,7,218,20,83,111,117,114,99,101,
+ 108,101,115,115,70,105,108,101,76,111,97,100,101,114,122,45,
+ 76,111,97,100,101,114,32,119,104,105,99,104,32,104,97,110,
+ 100,108,101,115,32,115,111,117,114,99,101,108,101,115,115,32,
+ 102,105,108,101,32,105,109,112,111,114,116,115,46,99,2,0,
+ 0,0,0,0,0,0,5,0,0,0,6,0,0,0,67,0,
+ 0,0,115,76,0,0,0,124,0,0,106,0,0,124,1,0,
+ 131,1,0,125,2,0,124,0,0,106,1,0,124,2,0,131,
+ 1,0,125,3,0,116,2,0,124,3,0,100,1,0,124,1,
+ 0,100,2,0,124,2,0,131,1,2,125,4,0,116,3,0,
+ 124,4,0,100,1,0,124,1,0,100,3,0,124,2,0,131,
+ 1,2,83,41,4,78,114,98,0,0,0,114,35,0,0,0,
+ 114,89,0,0,0,41,4,114,151,0,0,0,114,194,0,0,
+ 0,114,135,0,0,0,114,141,0,0,0,41,5,114,100,0,
+ 0,0,114,119,0,0,0,114,35,0,0,0,114,53,0,0,
+ 0,114,203,0,0,0,114,4,0,0,0,114,4,0,0,0,
+ 114,5,0,0,0,114,181,0,0,0,92,3,0,0,115,8,
+ 0,0,0,0,1,15,1,15,1,24,1,122,29,83,111,117,
+ 114,99,101,108,101,115,115,70,105,108,101,76,111,97,100,101,
+ 114,46,103,101,116,95,99,111,100,101,99,2,0,0,0,0,
+ 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,
+ 4,0,0,0,100,1,0,83,41,2,122,39,82,101,116,117,
+ 114,110,32,78,111,110,101,32,97,115,32,116,104,101,114,101,
+ 32,105,115,32,110,111,32,115,111,117,114,99,101,32,99,111,
+ 100,101,46,78,114,4,0,0,0,41,2,114,100,0,0,0,
+ 114,119,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
+ 5,0,0,0,114,196,0,0,0,98,3,0,0,115,2,0,
+ 0,0,0,2,122,31,83,111,117,114,99,101,108,101,115,115,
+ 70,105,108,101,76,111,97,100,101,114,46,103,101,116,95,115,
+ 111,117,114,99,101,78,41,6,114,105,0,0,0,114,104,0,
+ 0,0,114,106,0,0,0,114,107,0,0,0,114,181,0,0,
+ 0,114,196,0,0,0,114,4,0,0,0,114,4,0,0,0,
+ 114,4,0,0,0,114,5,0,0,0,114,217,0,0,0,88,
+ 3,0,0,115,6,0,0,0,12,2,6,2,12,6,114,217,
+ 0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,
+ 3,0,0,0,64,0,0,0,115,136,0,0,0,101,0,0,
+ 90,1,0,100,0,0,90,2,0,100,1,0,90,3,0,100,
+ 2,0,100,3,0,132,0,0,90,4,0,100,4,0,100,5,
+ 0,132,0,0,90,5,0,100,6,0,100,7,0,132,0,0,
+ 90,6,0,100,8,0,100,9,0,132,0,0,90,7,0,100,
+ 10,0,100,11,0,132,0,0,90,8,0,100,12,0,100,13,
+ 0,132,0,0,90,9,0,100,14,0,100,15,0,132,0,0,
+ 90,10,0,100,16,0,100,17,0,132,0,0,90,11,0,101,
+ 12,0,100,18,0,100,19,0,132,0,0,131,1,0,90,13,
+ 0,100,20,0,83,41,21,218,19,69,120,116,101,110,115,105,
+ 111,110,70,105,108,101,76,111,97,100,101,114,122,93,76,111,
+ 97,100,101,114,32,102,111,114,32,101,120,116,101,110,115,105,
+ 111,110,32,109,111,100,117,108,101,115,46,10,10,32,32,32,
+ 32,84,104,101,32,99,111,110,115,116,114,117,99,116,111,114,
+ 32,105,115,32,100,101,115,105,103,110,101,100,32,116,111,32,
+ 119,111,114,107,32,119,105,116,104,32,70,105,108,101,70,105,
+ 110,100,101,114,46,10,10,32,32,32,32,99,3,0,0,0,
+ 0,0,0,0,3,0,0,0,2,0,0,0,67,0,0,0,
+ 115,22,0,0,0,124,1,0,124,0,0,95,0,0,124,2,
+ 0,124,0,0,95,1,0,100,0,0,83,41,1,78,41,2,
+ 114,98,0,0,0,114,35,0,0,0,41,3,114,100,0,0,
+ 0,114,98,0,0,0,114,35,0,0,0,114,4,0,0,0,
+ 114,4,0,0,0,114,5,0,0,0,114,179,0,0,0,115,
+ 3,0,0,115,4,0,0,0,0,1,9,1,122,28,69,120,
+ 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,
+ 114,46,95,95,105,110,105,116,95,95,99,2,0,0,0,0,
+ 0,0,0,2,0,0,0,2,0,0,0,67,0,0,0,115,
+ 34,0,0,0,124,0,0,106,0,0,124,1,0,106,0,0,
+ 107,2,0,111,33,0,124,0,0,106,1,0,124,1,0,106,
+ 1,0,107,2,0,83,41,1,78,41,2,114,205,0,0,0,
+ 114,111,0,0,0,41,2,114,100,0,0,0,114,206,0,0,
+ 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
+ 114,207,0,0,0,119,3,0,0,115,4,0,0,0,0,1,
+ 18,1,122,26,69,120,116,101,110,115,105,111,110,70,105,108,
+ 101,76,111,97,100,101,114,46,95,95,101,113,95,95,99,1,
+ 0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,
+ 0,0,0,115,26,0,0,0,116,0,0,124,0,0,106,1,
+ 0,131,1,0,116,0,0,124,0,0,106,2,0,131,1,0,
+ 65,83,41,1,78,41,3,114,208,0,0,0,114,98,0,0,
+ 0,114,35,0,0,0,41,1,114,100,0,0,0,114,4,0,
+ 0,0,114,4,0,0,0,114,5,0,0,0,114,209,0,0,
+ 0,123,3,0,0,115,2,0,0,0,0,1,122,28,69,120,
+ 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,
+ 114,46,95,95,104,97,115,104,95,95,99,2,0,0,0,0,
+ 0,0,0,3,0,0,0,4,0,0,0,67,0,0,0,115,
+ 50,0,0,0,116,0,0,106,1,0,116,2,0,106,3,0,
+ 124,1,0,131,2,0,125,2,0,116,0,0,106,4,0,100,
+ 1,0,124,1,0,106,5,0,124,0,0,106,6,0,131,3,
+ 0,1,124,2,0,83,41,2,122,38,67,114,101,97,116,101,
+ 32,97,110,32,117,110,105,116,105,97,108,105,122,101,100,32,
+ 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101,
+ 122,38,101,120,116,101,110,115,105,111,110,32,109,111,100,117,
+ 108,101,32,123,33,114,125,32,108,111,97,100,101,100,32,102,
+ 114,111,109,32,123,33,114,125,41,7,114,114,0,0,0,114,
+ 182,0,0,0,114,139,0,0,0,90,14,99,114,101,97,116,
+ 101,95,100,121,110,97,109,105,99,114,129,0,0,0,114,98,
+ 0,0,0,114,35,0,0,0,41,3,114,100,0,0,0,114,
+ 158,0,0,0,114,184,0,0,0,114,4,0,0,0,114,4,
+ 0,0,0,114,5,0,0,0,114,180,0,0,0,126,3,0,
+ 0,115,10,0,0,0,0,2,6,1,15,1,9,1,16,1,
+ 122,33,69,120,116,101,110,115,105,111,110,70,105,108,101,76,
+ 111,97,100,101,114,46,99,114,101,97,116,101,95,109,111,100,
+ 117,108,101,99,2,0,0,0,0,0,0,0,2,0,0,0,
+ 4,0,0,0,67,0,0,0,115,48,0,0,0,116,0,0,
+ 106,1,0,116,2,0,106,3,0,124,1,0,131,2,0,1,
+ 116,0,0,106,4,0,100,1,0,124,0,0,106,5,0,124,
+ 0,0,106,6,0,131,3,0,1,100,2,0,83,41,3,122,
+ 30,73,110,105,116,105,97,108,105,122,101,32,97,110,32,101,
+ 120,116,101,110,115,105,111,110,32,109,111,100,117,108,101,122,
+ 40,101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,
+ 101,32,123,33,114,125,32,101,120,101,99,117,116,101,100,32,
+ 102,114,111,109,32,123,33,114,125,78,41,7,114,114,0,0,
+ 0,114,182,0,0,0,114,139,0,0,0,90,12,101,120,101,
+ 99,95,100,121,110,97,109,105,99,114,129,0,0,0,114,98,
+ 0,0,0,114,35,0,0,0,41,2,114,100,0,0,0,114,
+ 184,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,
+ 0,0,0,114,185,0,0,0,134,3,0,0,115,6,0,0,
+ 0,0,2,19,1,9,1,122,31,69,120,116,101,110,115,105,
+ 111,110,70,105,108,101,76,111,97,100,101,114,46,101,120,101,
+ 99,95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,
+ 0,2,0,0,0,4,0,0,0,3,0,0,0,115,48,0,
+ 0,0,116,0,0,124,0,0,106,1,0,131,1,0,100,1,
+ 0,25,137,0,0,116,2,0,135,0,0,102,1,0,100,2,
+ 0,100,3,0,134,0,0,116,3,0,68,131,1,0,131,1,
+ 0,83,41,4,122,49,82,101,116,117,114,110,32,84,114,117,
+ 101,32,105,102,32,116,104,101,32,101,120,116,101,110,115,105,
+ 111,110,32,109,111,100,117,108,101,32,105,115,32,97,32,112,
+ 97,99,107,97,103,101,46,114,29,0,0,0,99,1,0,0,
+ 0,0,0,0,0,2,0,0,0,4,0,0,0,51,0,0,
+ 0,115,31,0,0,0,124,0,0,93,21,0,125,1,0,136,
+ 0,0,100,0,0,124,1,0,23,107,2,0,86,1,113,3,
+ 0,100,1,0,83,41,2,114,179,0,0,0,78,114,4,0,
+ 0,0,41,2,114,22,0,0,0,218,6,115,117,102,102,105,
+ 120,41,1,218,9,102,105,108,101,95,110,97,109,101,114,4,
+ 0,0,0,114,5,0,0,0,250,9,60,103,101,110,101,120,
+ 112,114,62,143,3,0,0,115,2,0,0,0,6,1,122,49,
+ 69,120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,
+ 100,101,114,46,105,115,95,112,97,99,107,97,103,101,46,60,
+ 108,111,99,97,108,115,62,46,60,103,101,110,101,120,112,114,
+ 62,41,4,114,38,0,0,0,114,35,0,0,0,218,3,97,
+ 110,121,218,18,69,88,84,69,78,83,73,79,78,95,83,85,
+ 70,70,73,88,69,83,41,2,114,100,0,0,0,114,119,0,
+ 0,0,114,4,0,0,0,41,1,114,220,0,0,0,114,5,
+ 0,0,0,114,153,0,0,0,140,3,0,0,115,6,0,0,
+ 0,0,2,19,1,18,1,122,30,69,120,116,101,110,115,105,
+ 111,110,70,105,108,101,76,111,97,100,101,114,46,105,115,95,
+ 112,97,99,107,97,103,101,99,2,0,0,0,0,0,0,0,
+ 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,
+ 0,100,1,0,83,41,2,122,63,82,101,116,117,114,110,32,
+ 78,111,110,101,32,97,115,32,97,110,32,101,120,116,101,110,
+ 115,105,111,110,32,109,111,100,117,108,101,32,99,97,110,110,
+ 111,116,32,99,114,101,97,116,101,32,97,32,99,111,100,101,
+ 32,111,98,106,101,99,116,46,78,114,4,0,0,0,41,2,
+ 114,100,0,0,0,114,119,0,0,0,114,4,0,0,0,114,
+ 4,0,0,0,114,5,0,0,0,114,181,0,0,0,146,3,
+ 0,0,115,2,0,0,0,0,2,122,28,69,120,116,101,110,
+ 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,103,
+ 101,116,95,99,111,100,101,99,2,0,0,0,0,0,0,0,
+ 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,
+ 0,100,1,0,83,41,2,122,53,82,101,116,117,114,110,32,
+ 78,111,110,101,32,97,115,32,101,120,116,101,110,115,105,111,
+ 110,32,109,111,100,117,108,101,115,32,104,97,118,101,32,110,
+ 111,32,115,111,117,114,99,101,32,99,111,100,101,46,78,114,
+ 4,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0,
+ 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,
+ 196,0,0,0,150,3,0,0,115,2,0,0,0,0,2,122,
+ 30,69,120,116,101,110,115,105,111,110,70,105,108,101,76,111,
+ 97,100,101,114,46,103,101,116,95,115,111,117,114,99,101,99,
+ 2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,
+ 67,0,0,0,115,7,0,0,0,124,0,0,106,0,0,83,
+ 41,1,122,58,82,101,116,117,114,110,32,116,104,101,32,112,
+ 97,116,104,32,116,111,32,116,104,101,32,115,111,117,114,99,
+ 101,32,102,105,108,101,32,97,115,32,102,111,117,110,100,32,
+ 98,121,32,116,104,101,32,102,105,110,100,101,114,46,41,1,
+ 114,35,0,0,0,41,2,114,100,0,0,0,114,119,0,0,
+ 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
+ 114,151,0,0,0,154,3,0,0,115,2,0,0,0,0,3,
+ 122,32,69,120,116,101,110,115,105,111,110,70,105,108,101,76,
+ 111,97,100,101,114,46,103,101,116,95,102,105,108,101,110,97,
+ 109,101,78,41,14,114,105,0,0,0,114,104,0,0,0,114,
+ 106,0,0,0,114,107,0,0,0,114,179,0,0,0,114,207,
+ 0,0,0,114,209,0,0,0,114,180,0,0,0,114,185,0,
+ 0,0,114,153,0,0,0,114,181,0,0,0,114,196,0,0,
+ 0,114,116,0,0,0,114,151,0,0,0,114,4,0,0,0,
+ 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,
+ 218,0,0,0,107,3,0,0,115,20,0,0,0,12,6,6,
+ 2,12,4,12,4,12,3,12,8,12,6,12,6,12,4,12,
+ 4,114,218,0,0,0,99,0,0,0,0,0,0,0,0,0,
+ 0,0,0,2,0,0,0,64,0,0,0,115,130,0,0,0,
101,0,0,90,1,0,100,0,0,90,2,0,100,1,0,90,
3,0,100,2,0,100,3,0,132,0,0,90,4,0,100,4,
0,100,5,0,132,0,0,90,5,0,100,6,0,100,7,0,
- 100,8,0,100,9,0,132,0,1,90,6,0,100,10,0,83,
- 41,11,218,16,83,111,117,114,99,101,70,105,108,101,76,111,
- 97,100,101,114,122,62,67,111,110,99,114,101,116,101,32,105,
- 109,112,108,101,109,101,110,116,97,116,105,111,110,32,111,102,
- 32,83,111,117,114,99,101,76,111,97,100,101,114,32,117,115,
- 105,110,103,32,116,104,101,32,102,105,108,101,32,115,121,115,
- 116,101,109,46,99,2,0,0,0,0,0,0,0,3,0,0,
- 0,4,0,0,0,67,0,0,0,115,34,0,0,0,116,0,
- 0,124,1,0,131,1,0,125,2,0,100,1,0,124,2,0,
- 106,1,0,100,2,0,124,2,0,106,2,0,105,2,0,83,
- 41,3,122,33,82,101,116,117,114,110,32,116,104,101,32,109,
- 101,116,97,100,97,116,97,32,102,111,114,32,116,104,101,32,
- 112,97,116,104,46,114,133,0,0,0,114,134,0,0,0,41,
- 3,114,39,0,0,0,218,8,115,116,95,109,116,105,109,101,
- 90,7,115,116,95,115,105,122,101,41,3,114,108,0,0,0,
- 114,35,0,0,0,114,208,0,0,0,114,4,0,0,0,114,
- 4,0,0,0,114,5,0,0,0,114,197,0,0,0,55,3,
- 0,0,115,4,0,0,0,0,2,12,1,122,27,83,111,117,
- 114,99,101,70,105,108,101,76,111,97,100,101,114,46,112,97,
- 116,104,95,115,116,97,116,115,99,4,0,0,0,0,0,0,
- 0,5,0,0,0,5,0,0,0,67,0,0,0,115,34,0,
- 0,0,116,0,0,124,1,0,131,1,0,125,4,0,124,0,
- 0,106,1,0,124,2,0,124,3,0,100,1,0,124,4,0,
- 131,2,1,83,41,2,78,218,5,95,109,111,100,101,41,2,
- 114,97,0,0,0,114,198,0,0,0,41,5,114,108,0,0,
- 0,114,90,0,0,0,114,89,0,0,0,114,53,0,0,0,
- 114,42,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,114,199,0,0,0,60,3,0,0,115,4,0,
- 0,0,0,2,12,1,122,32,83,111,117,114,99,101,70,105,
- 108,101,76,111,97,100,101,114,46,95,99,97,99,104,101,95,
- 98,121,116,101,99,111,100,101,114,220,0,0,0,105,182,1,
- 0,0,99,3,0,0,0,1,0,0,0,9,0,0,0,17,
- 0,0,0,67,0,0,0,115,53,1,0,0,116,0,0,124,
- 1,0,131,1,0,92,2,0,125,4,0,125,5,0,103,0,
- 0,125,6,0,120,54,0,124,4,0,114,80,0,116,1,0,
- 124,4,0,131,1,0,12,114,80,0,116,0,0,124,4,0,
- 131,1,0,92,2,0,125,4,0,125,7,0,124,6,0,106,
- 2,0,124,7,0,131,1,0,1,113,27,0,87,120,132,0,
- 116,3,0,124,6,0,131,1,0,68,93,118,0,125,7,0,
- 116,4,0,124,4,0,124,7,0,131,2,0,125,4,0,121,
- 17,0,116,5,0,106,6,0,124,4,0,131,1,0,1,87,
- 113,94,0,4,116,7,0,107,10,0,114,155,0,1,1,1,
- 119,94,0,89,113,94,0,4,116,8,0,107,10,0,114,211,
- 0,1,125,8,0,1,122,25,0,116,9,0,100,1,0,124,
- 4,0,124,8,0,131,3,0,1,100,2,0,83,87,89,100,
- 2,0,100,2,0,125,8,0,126,8,0,88,113,94,0,88,
- 113,94,0,87,121,33,0,116,10,0,124,1,0,124,2,0,
- 124,3,0,131,3,0,1,116,9,0,100,3,0,124,1,0,
- 131,2,0,1,87,110,53,0,4,116,8,0,107,10,0,114,
- 48,1,1,125,8,0,1,122,21,0,116,9,0,100,1,0,
- 124,1,0,124,8,0,131,3,0,1,87,89,100,2,0,100,
- 2,0,125,8,0,126,8,0,88,110,1,0,88,100,2,0,
- 83,41,4,122,27,87,114,105,116,101,32,98,121,116,101,115,
- 32,100,97,116,97,32,116,111,32,97,32,102,105,108,101,46,
- 122,27,99,111,117,108,100,32,110,111,116,32,99,114,101,97,
- 116,101,32,123,33,114,125,58,32,123,33,114,125,78,122,12,
- 99,114,101,97,116,101,100,32,123,33,114,125,41,11,114,38,
- 0,0,0,114,46,0,0,0,114,163,0,0,0,114,33,0,
- 0,0,114,28,0,0,0,114,3,0,0,0,90,5,109,107,
- 100,105,114,218,15,70,105,108,101,69,120,105,115,116,115,69,
- 114,114,111,114,114,40,0,0,0,114,105,0,0,0,114,55,
- 0,0,0,41,9,114,108,0,0,0,114,35,0,0,0,114,
- 53,0,0,0,114,220,0,0,0,218,6,112,97,114,101,110,
- 116,114,94,0,0,0,114,27,0,0,0,114,23,0,0,0,
- 114,201,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,114,198,0,0,0,65,3,0,0,115,38,0,
- 0,0,0,2,18,1,6,2,22,1,18,1,17,2,19,1,
- 15,1,3,1,17,1,13,2,7,1,18,3,16,1,27,1,
- 3,1,16,1,17,1,18,2,122,25,83,111,117,114,99,101,
- 70,105,108,101,76,111,97,100,101,114,46,115,101,116,95,100,
- 97,116,97,78,41,7,114,112,0,0,0,114,111,0,0,0,
- 114,113,0,0,0,114,114,0,0,0,114,197,0,0,0,114,
- 199,0,0,0,114,198,0,0,0,114,4,0,0,0,114,4,
- 0,0,0,114,4,0,0,0,114,5,0,0,0,114,218,0,
- 0,0,51,3,0,0,115,8,0,0,0,12,2,6,2,12,
- 5,12,5,114,218,0,0,0,99,0,0,0,0,0,0,0,
- 0,0,0,0,0,2,0,0,0,64,0,0,0,115,46,0,
- 0,0,101,0,0,90,1,0,100,0,0,90,2,0,100,1,
- 0,90,3,0,100,2,0,100,3,0,132,0,0,90,4,0,
- 100,4,0,100,5,0,132,0,0,90,5,0,100,6,0,83,
- 41,7,218,20,83,111,117,114,99,101,108,101,115,115,70,105,
- 108,101,76,111,97,100,101,114,122,45,76,111,97,100,101,114,
- 32,119,104,105,99,104,32,104,97,110,100,108,101,115,32,115,
- 111,117,114,99,101,108,101,115,115,32,102,105,108,101,32,105,
- 109,112,111,114,116,115,46,99,2,0,0,0,0,0,0,0,
- 5,0,0,0,6,0,0,0,67,0,0,0,115,76,0,0,
- 0,124,0,0,106,0,0,124,1,0,131,1,0,125,2,0,
- 124,0,0,106,1,0,124,2,0,131,1,0,125,3,0,116,
- 2,0,124,3,0,100,1,0,124,1,0,100,2,0,124,2,
- 0,131,1,2,125,4,0,116,3,0,124,4,0,100,1,0,
- 124,1,0,100,3,0,124,2,0,131,1,2,83,41,4,78,
- 114,106,0,0,0,114,35,0,0,0,114,89,0,0,0,41,
- 4,114,157,0,0,0,114,200,0,0,0,114,141,0,0,0,
- 114,147,0,0,0,41,5,114,108,0,0,0,114,126,0,0,
- 0,114,35,0,0,0,114,53,0,0,0,114,209,0,0,0,
- 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,
- 187,0,0,0,98,3,0,0,115,8,0,0,0,0,1,15,
- 1,15,1,24,1,122,29,83,111,117,114,99,101,108,101,115,
- 115,70,105,108,101,76,111,97,100,101,114,46,103,101,116,95,
- 99,111,100,101,99,2,0,0,0,0,0,0,0,2,0,0,
- 0,1,0,0,0,67,0,0,0,115,4,0,0,0,100,1,
- 0,83,41,2,122,39,82,101,116,117,114,110,32,78,111,110,
- 101,32,97,115,32,116,104,101,114,101,32,105,115,32,110,111,
- 32,115,111,117,114,99,101,32,99,111,100,101,46,78,114,4,
- 0,0,0,41,2,114,108,0,0,0,114,126,0,0,0,114,
- 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,202,
- 0,0,0,104,3,0,0,115,2,0,0,0,0,2,122,31,
- 83,111,117,114,99,101,108,101,115,115,70,105,108,101,76,111,
- 97,100,101,114,46,103,101,116,95,115,111,117,114,99,101,78,
- 41,6,114,112,0,0,0,114,111,0,0,0,114,113,0,0,
- 0,114,114,0,0,0,114,187,0,0,0,114,202,0,0,0,
- 114,4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,114,223,0,0,0,94,3,0,0,115,6,0,
- 0,0,12,2,6,2,12,6,114,223,0,0,0,99,0,0,
- 0,0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,
- 0,0,115,136,0,0,0,101,0,0,90,1,0,100,0,0,
- 90,2,0,100,1,0,90,3,0,100,2,0,100,3,0,132,
- 0,0,90,4,0,100,4,0,100,5,0,132,0,0,90,5,
- 0,100,6,0,100,7,0,132,0,0,90,6,0,100,8,0,
- 100,9,0,132,0,0,90,7,0,100,10,0,100,11,0,132,
- 0,0,90,8,0,100,12,0,100,13,0,132,0,0,90,9,
- 0,100,14,0,100,15,0,132,0,0,90,10,0,100,16,0,
- 100,17,0,132,0,0,90,11,0,101,12,0,100,18,0,100,
- 19,0,132,0,0,131,1,0,90,13,0,100,20,0,83,41,
- 21,218,19,69,120,116,101,110,115,105,111,110,70,105,108,101,
- 76,111,97,100,101,114,122,93,76,111,97,100,101,114,32,102,
- 111,114,32,101,120,116,101,110,115,105,111,110,32,109,111,100,
- 117,108,101,115,46,10,10,32,32,32,32,84,104,101,32,99,
- 111,110,115,116,114,117,99,116,111,114,32,105,115,32,100,101,
- 115,105,103,110,101,100,32,116,111,32,119,111,114,107,32,119,
- 105,116,104,32,70,105,108,101,70,105,110,100,101,114,46,10,
- 10,32,32,32,32,99,3,0,0,0,0,0,0,0,3,0,
- 0,0,2,0,0,0,67,0,0,0,115,22,0,0,0,124,
- 1,0,124,0,0,95,0,0,124,2,0,124,0,0,95,1,
- 0,100,0,0,83,41,1,78,41,2,114,106,0,0,0,114,
- 35,0,0,0,41,3,114,108,0,0,0,114,106,0,0,0,
- 114,35,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,114,185,0,0,0,121,3,0,0,115,4,0,
- 0,0,0,1,9,1,122,28,69,120,116,101,110,115,105,111,
- 110,70,105,108,101,76,111,97,100,101,114,46,95,95,105,110,
- 105,116,95,95,99,2,0,0,0,0,0,0,0,2,0,0,
- 0,2,0,0,0,67,0,0,0,115,34,0,0,0,124,0,
- 0,106,0,0,124,1,0,106,0,0,107,2,0,111,33,0,
- 124,0,0,106,1,0,124,1,0,106,1,0,107,2,0,83,
- 41,1,78,41,2,114,211,0,0,0,114,118,0,0,0,41,
- 2,114,108,0,0,0,114,212,0,0,0,114,4,0,0,0,
- 114,4,0,0,0,114,5,0,0,0,114,213,0,0,0,125,
- 3,0,0,115,4,0,0,0,0,1,18,1,122,26,69,120,
- 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,
- 114,46,95,95,101,113,95,95,99,1,0,0,0,0,0,0,
- 0,1,0,0,0,3,0,0,0,67,0,0,0,115,26,0,
- 0,0,116,0,0,124,0,0,106,1,0,131,1,0,116,0,
- 0,124,0,0,106,2,0,131,1,0,65,83,41,1,78,41,
- 3,114,214,0,0,0,114,106,0,0,0,114,35,0,0,0,
- 41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,0,
- 0,114,5,0,0,0,114,215,0,0,0,129,3,0,0,115,
- 2,0,0,0,0,1,122,28,69,120,116,101,110,115,105,111,
- 110,70,105,108,101,76,111,97,100,101,114,46,95,95,104,97,
- 115,104,95,95,99,2,0,0,0,0,0,0,0,3,0,0,
- 0,4,0,0,0,67,0,0,0,115,47,0,0,0,116,0,
- 0,106,1,0,116,2,0,106,3,0,124,1,0,131,2,0,
- 125,2,0,116,4,0,100,1,0,124,1,0,106,5,0,124,
- 0,0,106,6,0,131,3,0,1,124,2,0,83,41,2,122,
- 38,67,114,101,97,116,101,32,97,110,32,117,110,105,116,105,
- 97,108,105,122,101,100,32,101,120,116,101,110,115,105,111,110,
- 32,109,111,100,117,108,101,122,38,101,120,116,101,110,115,105,
- 111,110,32,109,111,100,117,108,101,32,123,33,114,125,32,108,
- 111,97,100,101,100,32,102,114,111,109,32,123,33,114,125,41,
- 7,114,121,0,0,0,114,188,0,0,0,114,145,0,0,0,
- 90,14,99,114,101,97,116,101,95,100,121,110,97,109,105,99,
- 114,105,0,0,0,114,106,0,0,0,114,35,0,0,0,41,
- 3,114,108,0,0,0,114,164,0,0,0,114,190,0,0,0,
- 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,
- 186,0,0,0,132,3,0,0,115,10,0,0,0,0,2,6,
- 1,15,1,6,1,16,1,122,33,69,120,116,101,110,115,105,
- 111,110,70,105,108,101,76,111,97,100,101,114,46,99,114,101,
- 97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,0,
- 0,0,0,2,0,0,0,4,0,0,0,67,0,0,0,115,
- 45,0,0,0,116,0,0,106,1,0,116,2,0,106,3,0,
- 124,1,0,131,2,0,1,116,4,0,100,1,0,124,0,0,
- 106,5,0,124,0,0,106,6,0,131,3,0,1,100,2,0,
- 83,41,3,122,30,73,110,105,116,105,97,108,105,122,101,32,
- 97,110,32,101,120,116,101,110,115,105,111,110,32,109,111,100,
- 117,108,101,122,40,101,120,116,101,110,115,105,111,110,32,109,
- 111,100,117,108,101,32,123,33,114,125,32,101,120,101,99,117,
- 116,101,100,32,102,114,111,109,32,123,33,114,125,78,41,7,
- 114,121,0,0,0,114,188,0,0,0,114,145,0,0,0,90,
- 12,101,120,101,99,95,100,121,110,97,109,105,99,114,105,0,
- 0,0,114,106,0,0,0,114,35,0,0,0,41,2,114,108,
- 0,0,0,114,190,0,0,0,114,4,0,0,0,114,4,0,
- 0,0,114,5,0,0,0,114,191,0,0,0,140,3,0,0,
- 115,6,0,0,0,0,2,19,1,6,1,122,31,69,120,116,
- 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,
- 46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0,
- 0,0,0,0,0,2,0,0,0,4,0,0,0,3,0,0,
- 0,115,48,0,0,0,116,0,0,124,0,0,106,1,0,131,
- 1,0,100,1,0,25,137,0,0,116,2,0,135,0,0,102,
- 1,0,100,2,0,100,3,0,134,0,0,116,3,0,68,131,
- 1,0,131,1,0,83,41,4,122,49,82,101,116,117,114,110,
- 32,84,114,117,101,32,105,102,32,116,104,101,32,101,120,116,
- 101,110,115,105,111,110,32,109,111,100,117,108,101,32,105,115,
- 32,97,32,112,97,99,107,97,103,101,46,114,29,0,0,0,
- 99,1,0,0,0,0,0,0,0,2,0,0,0,4,0,0,
- 0,51,0,0,0,115,31,0,0,0,124,0,0,93,21,0,
- 125,1,0,136,0,0,100,0,0,124,1,0,23,107,2,0,
- 86,1,113,3,0,100,1,0,83,41,2,114,185,0,0,0,
- 78,114,4,0,0,0,41,2,114,22,0,0,0,218,6,115,
- 117,102,102,105,120,41,1,218,9,102,105,108,101,95,110,97,
- 109,101,114,4,0,0,0,114,5,0,0,0,250,9,60,103,
- 101,110,101,120,112,114,62,149,3,0,0,115,2,0,0,0,
- 6,1,122,49,69,120,116,101,110,115,105,111,110,70,105,108,
- 101,76,111,97,100,101,114,46,105,115,95,112,97,99,107,97,
- 103,101,46,60,108,111,99,97,108,115,62,46,60,103,101,110,
- 101,120,112,114,62,41,4,114,38,0,0,0,114,35,0,0,
- 0,218,3,97,110,121,218,18,69,88,84,69,78,83,73,79,
- 78,95,83,85,70,70,73,88,69,83,41,2,114,108,0,0,
- 0,114,126,0,0,0,114,4,0,0,0,41,1,114,226,0,
- 0,0,114,5,0,0,0,114,159,0,0,0,146,3,0,0,
- 115,6,0,0,0,0,2,19,1,18,1,122,30,69,120,116,
- 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,
- 46,105,115,95,112,97,99,107,97,103,101,99,2,0,0,0,
- 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,
- 115,4,0,0,0,100,1,0,83,41,2,122,63,82,101,116,
- 117,114,110,32,78,111,110,101,32,97,115,32,97,110,32,101,
- 120,116,101,110,115,105,111,110,32,109,111,100,117,108,101,32,
- 99,97,110,110,111,116,32,99,114,101,97,116,101,32,97,32,
- 99,111,100,101,32,111,98,106,101,99,116,46,78,114,4,0,
- 0,0,41,2,114,108,0,0,0,114,126,0,0,0,114,4,
- 0,0,0,114,4,0,0,0,114,5,0,0,0,114,187,0,
- 0,0,152,3,0,0,115,2,0,0,0,0,2,122,28,69,
- 120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,
- 101,114,46,103,101,116,95,99,111,100,101,99,2,0,0,0,
- 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,
- 115,4,0,0,0,100,1,0,83,41,2,122,53,82,101,116,
- 117,114,110,32,78,111,110,101,32,97,115,32,101,120,116,101,
- 110,115,105,111,110,32,109,111,100,117,108,101,115,32,104,97,
- 118,101,32,110,111,32,115,111,117,114,99,101,32,99,111,100,
- 101,46,78,114,4,0,0,0,41,2,114,108,0,0,0,114,
- 126,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,
- 0,0,0,114,202,0,0,0,156,3,0,0,115,2,0,0,
- 0,0,2,122,30,69,120,116,101,110,115,105,111,110,70,105,
- 108,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117,
- 114,99,101,99,2,0,0,0,0,0,0,0,2,0,0,0,
- 1,0,0,0,67,0,0,0,115,7,0,0,0,124,0,0,
- 106,0,0,83,41,1,122,58,82,101,116,117,114,110,32,116,
- 104,101,32,112,97,116,104,32,116,111,32,116,104,101,32,115,
- 111,117,114,99,101,32,102,105,108,101,32,97,115,32,102,111,
- 117,110,100,32,98,121,32,116,104,101,32,102,105,110,100,101,
- 114,46,41,1,114,35,0,0,0,41,2,114,108,0,0,0,
- 114,126,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,114,157,0,0,0,160,3,0,0,115,2,0,
- 0,0,0,3,122,32,69,120,116,101,110,115,105,111,110,70,
- 105,108,101,76,111,97,100,101,114,46,103,101,116,95,102,105,
- 108,101,110,97,109,101,78,41,14,114,112,0,0,0,114,111,
- 0,0,0,114,113,0,0,0,114,114,0,0,0,114,185,0,
- 0,0,114,213,0,0,0,114,215,0,0,0,114,186,0,0,
- 0,114,191,0,0,0,114,159,0,0,0,114,187,0,0,0,
- 114,202,0,0,0,114,123,0,0,0,114,157,0,0,0,114,
- 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,
- 0,0,0,114,224,0,0,0,113,3,0,0,115,20,0,0,
- 0,12,6,6,2,12,4,12,4,12,3,12,8,12,6,12,
- 6,12,4,12,4,114,224,0,0,0,99,0,0,0,0,0,
- 0,0,0,0,0,0,0,2,0,0,0,64,0,0,0,115,
- 130,0,0,0,101,0,0,90,1,0,100,0,0,90,2,0,
- 100,1,0,90,3,0,100,2,0,100,3,0,132,0,0,90,
- 4,0,100,4,0,100,5,0,132,0,0,90,5,0,100,6,
- 0,100,7,0,132,0,0,90,6,0,100,8,0,100,9,0,
- 132,0,0,90,7,0,100,10,0,100,11,0,132,0,0,90,
- 8,0,100,12,0,100,13,0,132,0,0,90,9,0,100,14,
- 0,100,15,0,132,0,0,90,10,0,100,16,0,100,17,0,
- 132,0,0,90,11,0,100,18,0,100,19,0,132,0,0,90,
- 12,0,100,20,0,83,41,21,218,14,95,78,97,109,101,115,
- 112,97,99,101,80,97,116,104,97,38,1,0,0,82,101,112,
- 114,101,115,101,110,116,115,32,97,32,110,97,109,101,115,112,
- 97,99,101,32,112,97,99,107,97,103,101,39,115,32,112,97,
- 116,104,46,32,32,73,116,32,117,115,101,115,32,116,104,101,
- 32,109,111,100,117,108,101,32,110,97,109,101,10,32,32,32,
- 32,116,111,32,102,105,110,100,32,105,116,115,32,112,97,114,
- 101,110,116,32,109,111,100,117,108,101,44,32,97,110,100,32,
- 102,114,111,109,32,116,104,101,114,101,32,105,116,32,108,111,
- 111,107,115,32,117,112,32,116,104,101,32,112,97,114,101,110,
- 116,39,115,10,32,32,32,32,95,95,112,97,116,104,95,95,
- 46,32,32,87,104,101,110,32,116,104,105,115,32,99,104,97,
- 110,103,101,115,44,32,116,104,101,32,109,111,100,117,108,101,
- 39,115,32,111,119,110,32,112,97,116,104,32,105,115,32,114,
- 101,99,111,109,112,117,116,101,100,44,10,32,32,32,32,117,
- 115,105,110,103,32,112,97,116,104,95,102,105,110,100,101,114,
- 46,32,32,70,111,114,32,116,111,112,45,108,101,118,101,108,
- 32,109,111,100,117,108,101,115,44,32,116,104,101,32,112,97,
- 114,101,110,116,32,109,111,100,117,108,101,39,115,32,112,97,
- 116,104,10,32,32,32,32,105,115,32,115,121,115,46,112,97,
- 116,104,46,99,4,0,0,0,0,0,0,0,4,0,0,0,
- 2,0,0,0,67,0,0,0,115,52,0,0,0,124,1,0,
- 124,0,0,95,0,0,124,2,0,124,0,0,95,1,0,116,
- 2,0,124,0,0,106,3,0,131,0,0,131,1,0,124,0,
- 0,95,4,0,124,3,0,124,0,0,95,5,0,100,0,0,
- 83,41,1,78,41,6,218,5,95,110,97,109,101,218,5,95,
- 112,97,116,104,114,93,0,0,0,218,16,95,103,101,116,95,
- 112,97,114,101,110,116,95,112,97,116,104,218,17,95,108,97,
- 115,116,95,112,97,114,101,110,116,95,112,97,116,104,218,12,
- 95,112,97,116,104,95,102,105,110,100,101,114,41,4,114,108,
- 0,0,0,114,106,0,0,0,114,35,0,0,0,218,11,112,
- 97,116,104,95,102,105,110,100,101,114,114,4,0,0,0,114,
- 4,0,0,0,114,5,0,0,0,114,185,0,0,0,173,3,
- 0,0,115,8,0,0,0,0,1,9,1,9,1,21,1,122,
- 23,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,
- 95,95,105,110,105,116,95,95,99,1,0,0,0,0,0,0,
- 0,4,0,0,0,3,0,0,0,67,0,0,0,115,53,0,
- 0,0,124,0,0,106,0,0,106,1,0,100,1,0,131,1,
- 0,92,3,0,125,1,0,125,2,0,125,3,0,124,2,0,
- 100,2,0,107,2,0,114,43,0,100,6,0,83,124,1,0,
- 100,5,0,102,2,0,83,41,7,122,62,82,101,116,117,114,
- 110,115,32,97,32,116,117,112,108,101,32,111,102,32,40,112,
- 97,114,101,110,116,45,109,111,100,117,108,101,45,110,97,109,
- 101,44,32,112,97,114,101,110,116,45,112,97,116,104,45,97,
- 116,116,114,45,110,97,109,101,41,114,58,0,0,0,114,30,
- 0,0,0,114,7,0,0,0,114,35,0,0,0,90,8,95,
- 95,112,97,116,104,95,95,41,2,122,3,115,121,115,122,4,
- 112,97,116,104,41,2,114,231,0,0,0,114,32,0,0,0,
- 41,4,114,108,0,0,0,114,222,0,0,0,218,3,100,111,
- 116,90,2,109,101,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,218,23,95,102,105,110,100,95,112,97,114,101,
- 110,116,95,112,97,116,104,95,110,97,109,101,115,179,3,0,
- 0,115,8,0,0,0,0,2,27,1,12,2,4,3,122,38,
- 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,
- 102,105,110,100,95,112,97,114,101,110,116,95,112,97,116,104,
- 95,110,97,109,101,115,99,1,0,0,0,0,0,0,0,3,
- 0,0,0,3,0,0,0,67,0,0,0,115,38,0,0,0,
- 124,0,0,106,0,0,131,0,0,92,2,0,125,1,0,125,
- 2,0,116,1,0,116,2,0,106,3,0,124,1,0,25,124,
- 2,0,131,2,0,83,41,1,78,41,4,114,238,0,0,0,
- 114,117,0,0,0,114,7,0,0,0,218,7,109,111,100,117,
- 108,101,115,41,3,114,108,0,0,0,90,18,112,97,114,101,
- 110,116,95,109,111,100,117,108,101,95,110,97,109,101,90,14,
- 112,97,116,104,95,97,116,116,114,95,110,97,109,101,114,4,
- 0,0,0,114,4,0,0,0,114,5,0,0,0,114,233,0,
- 0,0,189,3,0,0,115,4,0,0,0,0,1,18,1,122,
- 31,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,
- 95,103,101,116,95,112,97,114,101,110,116,95,112,97,116,104,
- 99,1,0,0,0,0,0,0,0,3,0,0,0,3,0,0,
- 0,67,0,0,0,115,118,0,0,0,116,0,0,124,0,0,
- 106,1,0,131,0,0,131,1,0,125,1,0,124,1,0,124,
- 0,0,106,2,0,107,3,0,114,111,0,124,0,0,106,3,
- 0,124,0,0,106,4,0,124,1,0,131,2,0,125,2,0,
- 124,2,0,100,0,0,107,9,0,114,102,0,124,2,0,106,
- 5,0,100,0,0,107,8,0,114,102,0,124,2,0,106,6,
- 0,114,102,0,124,2,0,106,6,0,124,0,0,95,7,0,
- 124,1,0,124,0,0,95,2,0,124,0,0,106,7,0,83,
- 41,1,78,41,8,114,93,0,0,0,114,233,0,0,0,114,
- 234,0,0,0,114,235,0,0,0,114,231,0,0,0,114,127,
- 0,0,0,114,156,0,0,0,114,232,0,0,0,41,3,114,
- 108,0,0,0,90,11,112,97,114,101,110,116,95,112,97,116,
- 104,114,164,0,0,0,114,4,0,0,0,114,4,0,0,0,
- 114,5,0,0,0,218,12,95,114,101,99,97,108,99,117,108,
- 97,116,101,193,3,0,0,115,16,0,0,0,0,2,18,1,
- 15,1,21,3,27,1,9,1,12,1,9,1,122,27,95,78,
- 97,109,101,115,112,97,99,101,80,97,116,104,46,95,114,101,
- 99,97,108,99,117,108,97,116,101,99,1,0,0,0,0,0,
- 0,0,1,0,0,0,2,0,0,0,67,0,0,0,115,16,
- 0,0,0,116,0,0,124,0,0,106,1,0,131,0,0,131,
- 1,0,83,41,1,78,41,2,218,4,105,116,101,114,114,240,
- 0,0,0,41,1,114,108,0,0,0,114,4,0,0,0,114,
- 4,0,0,0,114,5,0,0,0,218,8,95,95,105,116,101,
- 114,95,95,206,3,0,0,115,2,0,0,0,0,1,122,23,
- 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,
- 95,105,116,101,114,95,95,99,1,0,0,0,0,0,0,0,
- 1,0,0,0,2,0,0,0,67,0,0,0,115,16,0,0,
- 0,116,0,0,124,0,0,106,1,0,131,0,0,131,1,0,
- 83,41,1,78,41,2,114,31,0,0,0,114,240,0,0,0,
- 41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,0,
- 0,114,5,0,0,0,218,7,95,95,108,101,110,95,95,209,
- 3,0,0,115,2,0,0,0,0,1,122,22,95,78,97,109,
- 101,115,112,97,99,101,80,97,116,104,46,95,95,108,101,110,
- 95,95,99,1,0,0,0,0,0,0,0,1,0,0,0,2,
- 0,0,0,67,0,0,0,115,16,0,0,0,100,1,0,106,
- 0,0,124,0,0,106,1,0,131,1,0,83,41,2,78,122,
- 20,95,78,97,109,101,115,112,97,99,101,80,97,116,104,40,
- 123,33,114,125,41,41,2,114,47,0,0,0,114,232,0,0,
- 0,41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,
- 0,0,114,5,0,0,0,218,8,95,95,114,101,112,114,95,
- 95,212,3,0,0,115,2,0,0,0,0,1,122,23,95,78,
- 97,109,101,115,112,97,99,101,80,97,116,104,46,95,95,114,
- 101,112,114,95,95,99,2,0,0,0,0,0,0,0,2,0,
- 0,0,2,0,0,0,67,0,0,0,115,16,0,0,0,124,
- 1,0,124,0,0,106,0,0,131,0,0,107,6,0,83,41,
- 1,78,41,1,114,240,0,0,0,41,2,114,108,0,0,0,
- 218,4,105,116,101,109,114,4,0,0,0,114,4,0,0,0,
- 114,5,0,0,0,218,12,95,95,99,111,110,116,97,105,110,
- 115,95,95,215,3,0,0,115,2,0,0,0,0,1,122,27,
- 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,
- 95,99,111,110,116,97,105,110,115,95,95,99,2,0,0,0,
- 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0,
- 115,20,0,0,0,124,0,0,106,0,0,106,1,0,124,1,
- 0,131,1,0,1,100,0,0,83,41,1,78,41,2,114,232,
- 0,0,0,114,163,0,0,0,41,2,114,108,0,0,0,114,
- 245,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,
- 0,0,0,114,163,0,0,0,218,3,0,0,115,2,0,0,
- 0,0,1,122,21,95,78,97,109,101,115,112,97,99,101,80,
- 97,116,104,46,97,112,112,101,110,100,78,41,13,114,112,0,
- 0,0,114,111,0,0,0,114,113,0,0,0,114,114,0,0,
- 0,114,185,0,0,0,114,238,0,0,0,114,233,0,0,0,
- 114,240,0,0,0,114,242,0,0,0,114,243,0,0,0,114,
- 244,0,0,0,114,246,0,0,0,114,163,0,0,0,114,4,
+ 132,0,0,90,6,0,100,8,0,100,9,0,132,0,0,90,
+ 7,0,100,10,0,100,11,0,132,0,0,90,8,0,100,12,
+ 0,100,13,0,132,0,0,90,9,0,100,14,0,100,15,0,
+ 132,0,0,90,10,0,100,16,0,100,17,0,132,0,0,90,
+ 11,0,100,18,0,100,19,0,132,0,0,90,12,0,100,20,
+ 0,83,41,21,218,14,95,78,97,109,101,115,112,97,99,101,
+ 80,97,116,104,97,38,1,0,0,82,101,112,114,101,115,101,
+ 110,116,115,32,97,32,110,97,109,101,115,112,97,99,101,32,
+ 112,97,99,107,97,103,101,39,115,32,112,97,116,104,46,32,
+ 32,73,116,32,117,115,101,115,32,116,104,101,32,109,111,100,
+ 117,108,101,32,110,97,109,101,10,32,32,32,32,116,111,32,
+ 102,105,110,100,32,105,116,115,32,112,97,114,101,110,116,32,
+ 109,111,100,117,108,101,44,32,97,110,100,32,102,114,111,109,
+ 32,116,104,101,114,101,32,105,116,32,108,111,111,107,115,32,
+ 117,112,32,116,104,101,32,112,97,114,101,110,116,39,115,10,
+ 32,32,32,32,95,95,112,97,116,104,95,95,46,32,32,87,
+ 104,101,110,32,116,104,105,115,32,99,104,97,110,103,101,115,
+ 44,32,116,104,101,32,109,111,100,117,108,101,39,115,32,111,
+ 119,110,32,112,97,116,104,32,105,115,32,114,101,99,111,109,
+ 112,117,116,101,100,44,10,32,32,32,32,117,115,105,110,103,
+ 32,112,97,116,104,95,102,105,110,100,101,114,46,32,32,70,
+ 111,114,32,116,111,112,45,108,101,118,101,108,32,109,111,100,
+ 117,108,101,115,44,32,116,104,101,32,112,97,114,101,110,116,
+ 32,109,111,100,117,108,101,39,115,32,112,97,116,104,10,32,
+ 32,32,32,105,115,32,115,121,115,46,112,97,116,104,46,99,
+ 4,0,0,0,0,0,0,0,4,0,0,0,2,0,0,0,
+ 67,0,0,0,115,52,0,0,0,124,1,0,124,0,0,95,
+ 0,0,124,2,0,124,0,0,95,1,0,116,2,0,124,0,
+ 0,106,3,0,131,0,0,131,1,0,124,0,0,95,4,0,
+ 124,3,0,124,0,0,95,5,0,100,0,0,83,41,1,78,
+ 41,6,218,5,95,110,97,109,101,218,5,95,112,97,116,104,
+ 114,93,0,0,0,218,16,95,103,101,116,95,112,97,114,101,
+ 110,116,95,112,97,116,104,218,17,95,108,97,115,116,95,112,
+ 97,114,101,110,116,95,112,97,116,104,218,12,95,112,97,116,
+ 104,95,102,105,110,100,101,114,41,4,114,100,0,0,0,114,
+ 98,0,0,0,114,35,0,0,0,218,11,112,97,116,104,95,
+ 102,105,110,100,101,114,114,4,0,0,0,114,4,0,0,0,
+ 114,5,0,0,0,114,179,0,0,0,167,3,0,0,115,8,
+ 0,0,0,0,1,9,1,9,1,21,1,122,23,95,78,97,
+ 109,101,115,112,97,99,101,80,97,116,104,46,95,95,105,110,
+ 105,116,95,95,99,1,0,0,0,0,0,0,0,4,0,0,
+ 0,3,0,0,0,67,0,0,0,115,53,0,0,0,124,0,
+ 0,106,0,0,106,1,0,100,1,0,131,1,0,92,3,0,
+ 125,1,0,125,2,0,125,3,0,124,2,0,100,2,0,107,
+ 2,0,114,43,0,100,6,0,83,124,1,0,100,5,0,102,
+ 2,0,83,41,7,122,62,82,101,116,117,114,110,115,32,97,
+ 32,116,117,112,108,101,32,111,102,32,40,112,97,114,101,110,
+ 116,45,109,111,100,117,108,101,45,110,97,109,101,44,32,112,
+ 97,114,101,110,116,45,112,97,116,104,45,97,116,116,114,45,
+ 110,97,109,101,41,114,58,0,0,0,114,30,0,0,0,114,
+ 7,0,0,0,114,35,0,0,0,90,8,95,95,112,97,116,
+ 104,95,95,41,2,122,3,115,121,115,122,4,112,97,116,104,
+ 41,2,114,225,0,0,0,114,32,0,0,0,41,4,114,100,
+ 0,0,0,114,216,0,0,0,218,3,100,111,116,90,2,109,
+ 101,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
+ 218,23,95,102,105,110,100,95,112,97,114,101,110,116,95,112,
+ 97,116,104,95,110,97,109,101,115,173,3,0,0,115,8,0,
+ 0,0,0,2,27,1,12,2,4,3,122,38,95,78,97,109,
+ 101,115,112,97,99,101,80,97,116,104,46,95,102,105,110,100,
+ 95,112,97,114,101,110,116,95,112,97,116,104,95,110,97,109,
+ 101,115,99,1,0,0,0,0,0,0,0,3,0,0,0,3,
+ 0,0,0,67,0,0,0,115,38,0,0,0,124,0,0,106,
+ 0,0,131,0,0,92,2,0,125,1,0,125,2,0,116,1,
+ 0,116,2,0,106,3,0,124,1,0,25,124,2,0,131,2,
+ 0,83,41,1,78,41,4,114,232,0,0,0,114,110,0,0,
+ 0,114,7,0,0,0,218,7,109,111,100,117,108,101,115,41,
+ 3,114,100,0,0,0,90,18,112,97,114,101,110,116,95,109,
+ 111,100,117,108,101,95,110,97,109,101,90,14,112,97,116,104,
+ 95,97,116,116,114,95,110,97,109,101,114,4,0,0,0,114,
+ 4,0,0,0,114,5,0,0,0,114,227,0,0,0,183,3,
+ 0,0,115,4,0,0,0,0,1,18,1,122,31,95,78,97,
+ 109,101,115,112,97,99,101,80,97,116,104,46,95,103,101,116,
+ 95,112,97,114,101,110,116,95,112,97,116,104,99,1,0,0,
+ 0,0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,
+ 0,115,118,0,0,0,116,0,0,124,0,0,106,1,0,131,
+ 0,0,131,1,0,125,1,0,124,1,0,124,0,0,106,2,
+ 0,107,3,0,114,111,0,124,0,0,106,3,0,124,0,0,
+ 106,4,0,124,1,0,131,2,0,125,2,0,124,2,0,100,
+ 0,0,107,9,0,114,102,0,124,2,0,106,5,0,100,0,
+ 0,107,8,0,114,102,0,124,2,0,106,6,0,114,102,0,
+ 124,2,0,106,6,0,124,0,0,95,7,0,124,1,0,124,
+ 0,0,95,2,0,124,0,0,106,7,0,83,41,1,78,41,
+ 8,114,93,0,0,0,114,227,0,0,0,114,228,0,0,0,
+ 114,229,0,0,0,114,225,0,0,0,114,120,0,0,0,114,
+ 150,0,0,0,114,226,0,0,0,41,3,114,100,0,0,0,
+ 90,11,112,97,114,101,110,116,95,112,97,116,104,114,158,0,
+ 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,
+ 0,218,12,95,114,101,99,97,108,99,117,108,97,116,101,187,
+ 3,0,0,115,16,0,0,0,0,2,18,1,15,1,21,3,
+ 27,1,9,1,12,1,9,1,122,27,95,78,97,109,101,115,
+ 112,97,99,101,80,97,116,104,46,95,114,101,99,97,108,99,
+ 117,108,97,116,101,99,1,0,0,0,0,0,0,0,1,0,
+ 0,0,2,0,0,0,67,0,0,0,115,16,0,0,0,116,
+ 0,0,124,0,0,106,1,0,131,0,0,131,1,0,83,41,
+ 1,78,41,2,218,4,105,116,101,114,114,234,0,0,0,41,
+ 1,114,100,0,0,0,114,4,0,0,0,114,4,0,0,0,
+ 114,5,0,0,0,218,8,95,95,105,116,101,114,95,95,200,
+ 3,0,0,115,2,0,0,0,0,1,122,23,95,78,97,109,
+ 101,115,112,97,99,101,80,97,116,104,46,95,95,105,116,101,
+ 114,95,95,99,1,0,0,0,0,0,0,0,1,0,0,0,
+ 2,0,0,0,67,0,0,0,115,16,0,0,0,116,0,0,
+ 124,0,0,106,1,0,131,0,0,131,1,0,83,41,1,78,
+ 41,2,114,31,0,0,0,114,234,0,0,0,41,1,114,100,
0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,
- 0,0,114,230,0,0,0,166,3,0,0,115,20,0,0,0,
- 12,5,6,2,12,6,12,10,12,4,12,13,12,3,12,3,
- 12,3,12,3,114,230,0,0,0,99,0,0,0,0,0,0,
- 0,0,0,0,0,0,3,0,0,0,64,0,0,0,115,118,
- 0,0,0,101,0,0,90,1,0,100,0,0,90,2,0,100,
- 1,0,100,2,0,132,0,0,90,3,0,101,4,0,100,3,
- 0,100,4,0,132,0,0,131,1,0,90,5,0,100,5,0,
- 100,6,0,132,0,0,90,6,0,100,7,0,100,8,0,132,
- 0,0,90,7,0,100,9,0,100,10,0,132,0,0,90,8,
- 0,100,11,0,100,12,0,132,0,0,90,9,0,100,13,0,
- 100,14,0,132,0,0,90,10,0,100,15,0,100,16,0,132,
- 0,0,90,11,0,100,17,0,83,41,18,218,16,95,78,97,
- 109,101,115,112,97,99,101,76,111,97,100,101,114,99,4,0,
- 0,0,0,0,0,0,4,0,0,0,4,0,0,0,67,0,
- 0,0,115,25,0,0,0,116,0,0,124,1,0,124,2,0,
- 124,3,0,131,3,0,124,0,0,95,1,0,100,0,0,83,
- 41,1,78,41,2,114,230,0,0,0,114,232,0,0,0,41,
- 4,114,108,0,0,0,114,106,0,0,0,114,35,0,0,0,
- 114,236,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,114,185,0,0,0,224,3,0,0,115,2,0,
- 0,0,0,1,122,25,95,78,97,109,101,115,112,97,99,101,
- 76,111,97,100,101,114,46,95,95,105,110,105,116,95,95,99,
- 2,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,
- 67,0,0,0,115,16,0,0,0,100,1,0,106,0,0,124,
- 1,0,106,1,0,131,1,0,83,41,2,122,115,82,101,116,
- 117,114,110,32,114,101,112,114,32,102,111,114,32,116,104,101,
- 32,109,111,100,117,108,101,46,10,10,32,32,32,32,32,32,
- 32,32,84,104,101,32,109,101,116,104,111,100,32,105,115,32,
- 100,101,112,114,101,99,97,116,101,100,46,32,32,84,104,101,
- 32,105,109,112,111,114,116,32,109,97,99,104,105,110,101,114,
- 121,32,100,111,101,115,32,116,104,101,32,106,111,98,32,105,
- 116,115,101,108,102,46,10,10,32,32,32,32,32,32,32,32,
- 122,25,60,109,111,100,117,108,101,32,123,33,114,125,32,40,
- 110,97,109,101,115,112,97,99,101,41,62,41,2,114,47,0,
- 0,0,114,112,0,0,0,41,2,114,170,0,0,0,114,190,
- 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,
- 0,0,218,11,109,111,100,117,108,101,95,114,101,112,114,227,
- 3,0,0,115,2,0,0,0,0,7,122,28,95,78,97,109,
- 101,115,112,97,99,101,76,111,97,100,101,114,46,109,111,100,
- 117,108,101,95,114,101,112,114,99,2,0,0,0,0,0,0,
- 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,
- 0,0,100,1,0,83,41,2,78,84,114,4,0,0,0,41,
- 2,114,108,0,0,0,114,126,0,0,0,114,4,0,0,0,
- 114,4,0,0,0,114,5,0,0,0,114,159,0,0,0,236,
+ 0,0,218,7,95,95,108,101,110,95,95,203,3,0,0,115,
+ 2,0,0,0,0,1,122,22,95,78,97,109,101,115,112,97,
+ 99,101,80,97,116,104,46,95,95,108,101,110,95,95,99,1,
+ 0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,67,
+ 0,0,0,115,16,0,0,0,100,1,0,106,0,0,124,0,
+ 0,106,1,0,131,1,0,83,41,2,78,122,20,95,78,97,
+ 109,101,115,112,97,99,101,80,97,116,104,40,123,33,114,125,
+ 41,41,2,114,47,0,0,0,114,226,0,0,0,41,1,114,
+ 100,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,
+ 0,0,0,218,8,95,95,114,101,112,114,95,95,206,3,0,
+ 0,115,2,0,0,0,0,1,122,23,95,78,97,109,101,115,
+ 112,97,99,101,80,97,116,104,46,95,95,114,101,112,114,95,
+ 95,99,2,0,0,0,0,0,0,0,2,0,0,0,2,0,
+ 0,0,67,0,0,0,115,16,0,0,0,124,1,0,124,0,
+ 0,106,0,0,131,0,0,107,6,0,83,41,1,78,41,1,
+ 114,234,0,0,0,41,2,114,100,0,0,0,218,4,105,116,
+ 101,109,114,4,0,0,0,114,4,0,0,0,114,5,0,0,
+ 0,218,12,95,95,99,111,110,116,97,105,110,115,95,95,209,
3,0,0,115,2,0,0,0,0,1,122,27,95,78,97,109,
- 101,115,112,97,99,101,76,111,97,100,101,114,46,105,115,95,
- 112,97,99,107,97,103,101,99,2,0,0,0,0,0,0,0,
- 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,
- 0,100,1,0,83,41,2,78,114,30,0,0,0,114,4,0,
- 0,0,41,2,114,108,0,0,0,114,126,0,0,0,114,4,
- 0,0,0,114,4,0,0,0,114,5,0,0,0,114,202,0,
- 0,0,239,3,0,0,115,2,0,0,0,0,1,122,27,95,
- 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,
- 103,101,116,95,115,111,117,114,99,101,99,2,0,0,0,0,
- 0,0,0,2,0,0,0,6,0,0,0,67,0,0,0,115,
- 22,0,0,0,116,0,0,100,1,0,100,2,0,100,3,0,
- 100,4,0,100,5,0,131,3,1,83,41,6,78,114,30,0,
- 0,0,122,8,60,115,116,114,105,110,103,62,114,189,0,0,
- 0,114,204,0,0,0,84,41,1,114,205,0,0,0,41,2,
- 114,108,0,0,0,114,126,0,0,0,114,4,0,0,0,114,
- 4,0,0,0,114,5,0,0,0,114,187,0,0,0,242,3,
- 0,0,115,2,0,0,0,0,1,122,25,95,78,97,109,101,
- 115,112,97,99,101,76,111,97,100,101,114,46,103,101,116,95,
- 99,111,100,101,99,2,0,0,0,0,0,0,0,2,0,0,
- 0,1,0,0,0,67,0,0,0,115,4,0,0,0,100,1,
- 0,83,41,2,122,42,85,115,101,32,100,101,102,97,117,108,
- 116,32,115,101,109,97,110,116,105,99,115,32,102,111,114,32,
- 109,111,100,117,108,101,32,99,114,101,97,116,105,111,110,46,
- 78,114,4,0,0,0,41,2,114,108,0,0,0,114,164,0,
- 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,
- 0,114,186,0,0,0,245,3,0,0,115,0,0,0,0,122,
- 30,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,
- 114,46,99,114,101,97,116,101,95,109,111,100,117,108,101,99,
- 2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,
- 67,0,0,0,115,4,0,0,0,100,0,0,83,41,1,78,
- 114,4,0,0,0,41,2,114,108,0,0,0,114,190,0,0,
+ 101,115,112,97,99,101,80,97,116,104,46,95,95,99,111,110,
+ 116,97,105,110,115,95,95,99,2,0,0,0,0,0,0,0,
+ 2,0,0,0,2,0,0,0,67,0,0,0,115,20,0,0,
+ 0,124,0,0,106,0,0,106,1,0,124,1,0,131,1,0,
+ 1,100,0,0,83,41,1,78,41,2,114,226,0,0,0,114,
+ 157,0,0,0,41,2,114,100,0,0,0,114,239,0,0,0,
+ 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,
+ 157,0,0,0,212,3,0,0,115,2,0,0,0,0,1,122,
+ 21,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,
+ 97,112,112,101,110,100,78,41,13,114,105,0,0,0,114,104,
+ 0,0,0,114,106,0,0,0,114,107,0,0,0,114,179,0,
+ 0,0,114,232,0,0,0,114,227,0,0,0,114,234,0,0,
+ 0,114,236,0,0,0,114,237,0,0,0,114,238,0,0,0,
+ 114,240,0,0,0,114,157,0,0,0,114,4,0,0,0,114,
+ 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,224,
+ 0,0,0,160,3,0,0,115,20,0,0,0,12,5,6,2,
+ 12,6,12,10,12,4,12,13,12,3,12,3,12,3,12,3,
+ 114,224,0,0,0,99,0,0,0,0,0,0,0,0,0,0,
+ 0,0,3,0,0,0,64,0,0,0,115,118,0,0,0,101,
+ 0,0,90,1,0,100,0,0,90,2,0,100,1,0,100,2,
+ 0,132,0,0,90,3,0,101,4,0,100,3,0,100,4,0,
+ 132,0,0,131,1,0,90,5,0,100,5,0,100,6,0,132,
+ 0,0,90,6,0,100,7,0,100,8,0,132,0,0,90,7,
+ 0,100,9,0,100,10,0,132,0,0,90,8,0,100,11,0,
+ 100,12,0,132,0,0,90,9,0,100,13,0,100,14,0,132,
+ 0,0,90,10,0,100,15,0,100,16,0,132,0,0,90,11,
+ 0,100,17,0,83,41,18,218,16,95,78,97,109,101,115,112,
+ 97,99,101,76,111,97,100,101,114,99,4,0,0,0,0,0,
+ 0,0,4,0,0,0,4,0,0,0,67,0,0,0,115,25,
+ 0,0,0,116,0,0,124,1,0,124,2,0,124,3,0,131,
+ 3,0,124,0,0,95,1,0,100,0,0,83,41,1,78,41,
+ 2,114,224,0,0,0,114,226,0,0,0,41,4,114,100,0,
+ 0,0,114,98,0,0,0,114,35,0,0,0,114,230,0,0,
0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
- 114,191,0,0,0,248,3,0,0,115,2,0,0,0,0,1,
- 122,28,95,78,97,109,101,115,112,97,99,101,76,111,97,100,
- 101,114,46,101,120,101,99,95,109,111,100,117,108,101,99,2,
- 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67,
- 0,0,0,115,32,0,0,0,116,0,0,100,1,0,124,0,
- 0,106,1,0,131,2,0,1,116,2,0,106,3,0,124,0,
- 0,124,1,0,131,2,0,83,41,2,122,98,76,111,97,100,
- 32,97,32,110,97,109,101,115,112,97,99,101,32,109,111,100,
+ 114,179,0,0,0,218,3,0,0,115,2,0,0,0,0,1,
+ 122,25,95,78,97,109,101,115,112,97,99,101,76,111,97,100,
+ 101,114,46,95,95,105,110,105,116,95,95,99,2,0,0,0,
+ 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0,
+ 115,16,0,0,0,100,1,0,106,0,0,124,1,0,106,1,
+ 0,131,1,0,83,41,2,122,115,82,101,116,117,114,110,32,
+ 114,101,112,114,32,102,111,114,32,116,104,101,32,109,111,100,
117,108,101,46,10,10,32,32,32,32,32,32,32,32,84,104,
- 105,115,32,109,101,116,104,111,100,32,105,115,32,100,101,112,
- 114,101,99,97,116,101,100,46,32,32,85,115,101,32,101,120,
- 101,99,95,109,111,100,117,108,101,40,41,32,105,110,115,116,
- 101,97,100,46,10,10,32,32,32,32,32,32,32,32,122,38,
- 110,97,109,101,115,112,97,99,101,32,109,111,100,117,108,101,
- 32,108,111,97,100,101,100,32,119,105,116,104,32,112,97,116,
- 104,32,123,33,114,125,41,4,114,105,0,0,0,114,232,0,
- 0,0,114,121,0,0,0,114,192,0,0,0,41,2,114,108,
- 0,0,0,114,126,0,0,0,114,4,0,0,0,114,4,0,
- 0,0,114,5,0,0,0,114,193,0,0,0,251,3,0,0,
- 115,4,0,0,0,0,7,16,1,122,28,95,78,97,109,101,
- 115,112,97,99,101,76,111,97,100,101,114,46,108,111,97,100,
- 95,109,111,100,117,108,101,78,41,12,114,112,0,0,0,114,
- 111,0,0,0,114,113,0,0,0,114,185,0,0,0,114,183,
- 0,0,0,114,248,0,0,0,114,159,0,0,0,114,202,0,
- 0,0,114,187,0,0,0,114,186,0,0,0,114,191,0,0,
- 0,114,193,0,0,0,114,4,0,0,0,114,4,0,0,0,
- 114,4,0,0,0,114,5,0,0,0,114,247,0,0,0,223,
- 3,0,0,115,16,0,0,0,12,1,12,3,18,9,12,3,
- 12,3,12,3,12,3,12,3,114,247,0,0,0,99,0,0,
- 0,0,0,0,0,0,0,0,0,0,5,0,0,0,64,0,
- 0,0,115,160,0,0,0,101,0,0,90,1,0,100,0,0,
- 90,2,0,100,1,0,90,3,0,101,4,0,100,2,0,100,
- 3,0,132,0,0,131,1,0,90,5,0,101,4,0,100,4,
- 0,100,5,0,132,0,0,131,1,0,90,6,0,101,4,0,
- 100,6,0,100,7,0,132,0,0,131,1,0,90,7,0,101,
- 4,0,100,8,0,100,9,0,132,0,0,131,1,0,90,8,
- 0,101,4,0,100,10,0,100,11,0,100,12,0,132,1,0,
- 131,1,0,90,9,0,101,4,0,100,10,0,100,10,0,100,
- 13,0,100,14,0,132,2,0,131,1,0,90,10,0,101,4,
- 0,100,10,0,100,15,0,100,16,0,132,1,0,131,1,0,
- 90,11,0,100,10,0,83,41,17,218,10,80,97,116,104,70,
- 105,110,100,101,114,122,62,77,101,116,97,32,112,97,116,104,
- 32,102,105,110,100,101,114,32,102,111,114,32,115,121,115,46,
- 112,97,116,104,32,97,110,100,32,112,97,99,107,97,103,101,
- 32,95,95,112,97,116,104,95,95,32,97,116,116,114,105,98,
- 117,116,101,115,46,99,1,0,0,0,0,0,0,0,2,0,
- 0,0,4,0,0,0,67,0,0,0,115,55,0,0,0,120,
- 48,0,116,0,0,106,1,0,106,2,0,131,0,0,68,93,
- 31,0,125,1,0,116,3,0,124,1,0,100,1,0,131,2,
- 0,114,16,0,124,1,0,106,4,0,131,0,0,1,113,16,
- 0,87,100,2,0,83,41,3,122,125,67,97,108,108,32,116,
- 104,101,32,105,110,118,97,108,105,100,97,116,101,95,99,97,
- 99,104,101,115,40,41,32,109,101,116,104,111,100,32,111,110,
- 32,97,108,108,32,112,97,116,104,32,101,110,116,114,121,32,
- 102,105,110,100,101,114,115,10,32,32,32,32,32,32,32,32,
- 115,116,111,114,101,100,32,105,110,32,115,121,115,46,112,97,
- 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104,
- 101,115,32,40,119,104,101,114,101,32,105,109,112,108,101,109,
- 101,110,116,101,100,41,46,218,17,105,110,118,97,108,105,100,
- 97,116,101,95,99,97,99,104,101,115,78,41,5,114,7,0,
- 0,0,218,19,112,97,116,104,95,105,109,112,111,114,116,101,
- 114,95,99,97,99,104,101,218,6,118,97,108,117,101,115,114,
- 115,0,0,0,114,250,0,0,0,41,2,114,170,0,0,0,
- 218,6,102,105,110,100,101,114,114,4,0,0,0,114,4,0,
- 0,0,114,5,0,0,0,114,250,0,0,0,12,4,0,0,
- 115,6,0,0,0,0,4,22,1,15,1,122,28,80,97,116,
- 104,70,105,110,100,101,114,46,105,110,118,97,108,105,100,97,
- 116,101,95,99,97,99,104,101,115,99,2,0,0,0,0,0,
- 0,0,3,0,0,0,12,0,0,0,67,0,0,0,115,107,
- 0,0,0,116,0,0,106,1,0,100,1,0,107,9,0,114,
- 41,0,116,0,0,106,1,0,12,114,41,0,116,2,0,106,
- 3,0,100,2,0,116,4,0,131,2,0,1,120,59,0,116,
- 0,0,106,1,0,68,93,44,0,125,2,0,121,14,0,124,
- 2,0,124,1,0,131,1,0,83,87,113,51,0,4,116,5,
- 0,107,10,0,114,94,0,1,1,1,119,51,0,89,113,51,
- 0,88,113,51,0,87,100,1,0,83,100,1,0,83,41,3,
- 122,113,83,101,97,114,99,104,32,115,101,113,117,101,110,99,
- 101,32,111,102,32,104,111,111,107,115,32,102,111,114,32,97,
- 32,102,105,110,100,101,114,32,102,111,114,32,39,112,97,116,
- 104,39,46,10,10,32,32,32,32,32,32,32,32,73,102,32,
- 39,104,111,111,107,115,39,32,105,115,32,102,97,108,115,101,
- 32,116,104,101,110,32,117,115,101,32,115,121,115,46,112,97,
- 116,104,95,104,111,111,107,115,46,10,10,32,32,32,32,32,
- 32,32,32,78,122,23,115,121,115,46,112,97,116,104,95,104,
- 111,111,107,115,32,105,115,32,101,109,112,116,121,41,6,114,
- 7,0,0,0,218,10,112,97,116,104,95,104,111,111,107,115,
- 114,60,0,0,0,114,61,0,0,0,114,125,0,0,0,114,
- 107,0,0,0,41,3,114,170,0,0,0,114,35,0,0,0,
- 90,4,104,111,111,107,114,4,0,0,0,114,4,0,0,0,
- 114,5,0,0,0,218,11,95,112,97,116,104,95,104,111,111,
- 107,115,20,4,0,0,115,16,0,0,0,0,7,25,1,16,
- 1,16,1,3,1,14,1,13,1,12,2,122,22,80,97,116,
- 104,70,105,110,100,101,114,46,95,112,97,116,104,95,104,111,
- 111,107,115,99,2,0,0,0,0,0,0,0,3,0,0,0,
- 19,0,0,0,67,0,0,0,115,123,0,0,0,124,1,0,
- 100,1,0,107,2,0,114,53,0,121,16,0,116,0,0,106,
- 1,0,131,0,0,125,1,0,87,110,22,0,4,116,2,0,
- 107,10,0,114,52,0,1,1,1,100,2,0,83,89,110,1,
- 0,88,121,17,0,116,3,0,106,4,0,124,1,0,25,125,
- 2,0,87,110,46,0,4,116,5,0,107,10,0,114,118,0,
- 1,1,1,124,0,0,106,6,0,124,1,0,131,1,0,125,
- 2,0,124,2,0,116,3,0,106,4,0,124,1,0,60,89,
- 110,1,0,88,124,2,0,83,41,3,122,210,71,101,116,32,
- 116,104,101,32,102,105,110,100,101,114,32,102,111,114,32,116,
- 104,101,32,112,97,116,104,32,101,110,116,114,121,32,102,114,
- 111,109,32,115,121,115,46,112,97,116,104,95,105,109,112,111,
- 114,116,101,114,95,99,97,99,104,101,46,10,10,32,32,32,
- 32,32,32,32,32,73,102,32,116,104,101,32,112,97,116,104,
- 32,101,110,116,114,121,32,105,115,32,110,111,116,32,105,110,
- 32,116,104,101,32,99,97,99,104,101,44,32,102,105,110,100,
- 32,116,104,101,32,97,112,112,114,111,112,114,105,97,116,101,
- 32,102,105,110,100,101,114,10,32,32,32,32,32,32,32,32,
- 97,110,100,32,99,97,99,104,101,32,105,116,46,32,73,102,
- 32,110,111,32,102,105,110,100,101,114,32,105,115,32,97,118,
- 97,105,108,97,98,108,101,44,32,115,116,111,114,101,32,78,
- 111,110,101,46,10,10,32,32,32,32,32,32,32,32,114,30,
- 0,0,0,78,41,7,114,3,0,0,0,114,45,0,0,0,
- 218,17,70,105,108,101,78,111,116,70,111,117,110,100,69,114,
- 114,111,114,114,7,0,0,0,114,251,0,0,0,114,137,0,
- 0,0,114,255,0,0,0,41,3,114,170,0,0,0,114,35,
- 0,0,0,114,253,0,0,0,114,4,0,0,0,114,4,0,
- 0,0,114,5,0,0,0,218,20,95,112,97,116,104,95,105,
- 109,112,111,114,116,101,114,95,99,97,99,104,101,37,4,0,
- 0,115,22,0,0,0,0,8,12,1,3,1,16,1,13,3,
- 9,1,3,1,17,1,13,1,15,1,18,1,122,31,80,97,
- 116,104,70,105,110,100,101,114,46,95,112,97,116,104,95,105,
- 109,112,111,114,116,101,114,95,99,97,99,104,101,99,3,0,
- 0,0,0,0,0,0,6,0,0,0,3,0,0,0,67,0,
- 0,0,115,119,0,0,0,116,0,0,124,2,0,100,1,0,
- 131,2,0,114,39,0,124,2,0,106,1,0,124,1,0,131,
- 1,0,92,2,0,125,3,0,125,4,0,110,21,0,124,2,
- 0,106,2,0,124,1,0,131,1,0,125,3,0,103,0,0,
- 125,4,0,124,3,0,100,0,0,107,9,0,114,88,0,116,
- 3,0,106,4,0,124,1,0,124,3,0,131,2,0,83,116,
- 3,0,106,5,0,124,1,0,100,0,0,131,2,0,125,5,
- 0,124,4,0,124,5,0,95,6,0,124,5,0,83,41,2,
- 78,114,124,0,0,0,41,7,114,115,0,0,0,114,124,0,
- 0,0,114,182,0,0,0,114,121,0,0,0,114,179,0,0,
- 0,114,160,0,0,0,114,156,0,0,0,41,6,114,170,0,
- 0,0,114,126,0,0,0,114,253,0,0,0,114,127,0,0,
- 0,114,128,0,0,0,114,164,0,0,0,114,4,0,0,0,
- 114,4,0,0,0,114,5,0,0,0,218,16,95,108,101,103,
- 97,99,121,95,103,101,116,95,115,112,101,99,59,4,0,0,
- 115,18,0,0,0,0,4,15,1,24,2,15,1,6,1,12,
- 1,16,1,18,1,9,1,122,27,80,97,116,104,70,105,110,
- 100,101,114,46,95,108,101,103,97,99,121,95,103,101,116,95,
- 115,112,101,99,78,99,4,0,0,0,0,0,0,0,9,0,
- 0,0,5,0,0,0,67,0,0,0,115,243,0,0,0,103,
- 0,0,125,4,0,120,230,0,124,2,0,68,93,191,0,125,
- 5,0,116,0,0,124,5,0,116,1,0,116,2,0,102,2,
- 0,131,2,0,115,43,0,113,13,0,124,0,0,106,3,0,
- 124,5,0,131,1,0,125,6,0,124,6,0,100,1,0,107,
- 9,0,114,13,0,116,4,0,124,6,0,100,2,0,131,2,
- 0,114,106,0,124,6,0,106,5,0,124,1,0,124,3,0,
- 131,2,0,125,7,0,110,18,0,124,0,0,106,6,0,124,
- 1,0,124,6,0,131,2,0,125,7,0,124,7,0,100,1,
- 0,107,8,0,114,139,0,113,13,0,124,7,0,106,7,0,
- 100,1,0,107,9,0,114,158,0,124,7,0,83,124,7,0,
- 106,8,0,125,8,0,124,8,0,100,1,0,107,8,0,114,
- 191,0,116,9,0,100,3,0,131,1,0,130,1,0,124,4,
- 0,106,10,0,124,8,0,131,1,0,1,113,13,0,87,116,
- 11,0,106,12,0,124,1,0,100,1,0,131,2,0,125,7,
- 0,124,4,0,124,7,0,95,8,0,124,7,0,83,100,1,
- 0,83,41,4,122,63,70,105,110,100,32,116,104,101,32,108,
- 111,97,100,101,114,32,111,114,32,110,97,109,101,115,112,97,
- 99,101,95,112,97,116,104,32,102,111,114,32,116,104,105,115,
- 32,109,111,100,117,108,101,47,112,97,99,107,97,103,101,32,
- 110,97,109,101,46,78,114,181,0,0,0,122,19,115,112,101,
- 99,32,109,105,115,115,105,110,103,32,108,111,97,100,101,114,
- 41,13,114,143,0,0,0,114,69,0,0,0,218,5,98,121,
- 116,101,115,114,1,1,0,0,114,115,0,0,0,114,181,0,
- 0,0,114,2,1,0,0,114,127,0,0,0,114,156,0,0,
- 0,114,107,0,0,0,114,149,0,0,0,114,121,0,0,0,
- 114,160,0,0,0,41,9,114,170,0,0,0,114,126,0,0,
- 0,114,35,0,0,0,114,180,0,0,0,218,14,110,97,109,
- 101,115,112,97,99,101,95,112,97,116,104,90,5,101,110,116,
- 114,121,114,253,0,0,0,114,164,0,0,0,114,128,0,0,
- 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
- 218,9,95,103,101,116,95,115,112,101,99,74,4,0,0,115,
- 40,0,0,0,0,5,6,1,13,1,21,1,3,1,15,1,
- 12,1,15,1,21,2,18,1,12,1,3,1,15,1,4,1,
- 9,1,12,1,12,5,17,2,18,1,9,1,122,20,80,97,
- 116,104,70,105,110,100,101,114,46,95,103,101,116,95,115,112,
- 101,99,99,4,0,0,0,0,0,0,0,6,0,0,0,4,
- 0,0,0,67,0,0,0,115,140,0,0,0,124,2,0,100,
- 1,0,107,8,0,114,21,0,116,0,0,106,1,0,125,2,
- 0,124,0,0,106,2,0,124,1,0,124,2,0,124,3,0,
- 131,3,0,125,4,0,124,4,0,100,1,0,107,8,0,114,
- 58,0,100,1,0,83,124,4,0,106,3,0,100,1,0,107,
- 8,0,114,132,0,124,4,0,106,4,0,125,5,0,124,5,
- 0,114,125,0,100,2,0,124,4,0,95,5,0,116,6,0,
- 124,1,0,124,5,0,124,0,0,106,2,0,131,3,0,124,
- 4,0,95,4,0,124,4,0,83,100,1,0,83,110,4,0,
- 124,4,0,83,100,1,0,83,41,3,122,98,102,105,110,100,
- 32,116,104,101,32,109,111,100,117,108,101,32,111,110,32,115,
- 121,115,46,112,97,116,104,32,111,114,32,39,112,97,116,104,
- 39,32,98,97,115,101,100,32,111,110,32,115,121,115,46,112,
- 97,116,104,95,104,111,111,107,115,32,97,110,100,10,32,32,
- 32,32,32,32,32,32,115,121,115,46,112,97,116,104,95,105,
- 109,112,111,114,116,101,114,95,99,97,99,104,101,46,78,90,
- 9,110,97,109,101,115,112,97,99,101,41,7,114,7,0,0,
- 0,114,35,0,0,0,114,5,1,0,0,114,127,0,0,0,
- 114,156,0,0,0,114,158,0,0,0,114,230,0,0,0,41,
- 6,114,170,0,0,0,114,126,0,0,0,114,35,0,0,0,
- 114,180,0,0,0,114,164,0,0,0,114,4,1,0,0,114,
- 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,181,
- 0,0,0,106,4,0,0,115,26,0,0,0,0,4,12,1,
- 9,1,21,1,12,1,4,1,15,1,9,1,6,3,9,1,
- 24,1,4,2,7,2,122,20,80,97,116,104,70,105,110,100,
- 101,114,46,102,105,110,100,95,115,112,101,99,99,3,0,0,
- 0,0,0,0,0,4,0,0,0,3,0,0,0,67,0,0,
- 0,115,41,0,0,0,124,0,0,106,0,0,124,1,0,124,
- 2,0,131,2,0,125,3,0,124,3,0,100,1,0,107,8,
- 0,114,34,0,100,1,0,83,124,3,0,106,1,0,83,41,
- 2,122,170,102,105,110,100,32,116,104,101,32,109,111,100,117,
- 108,101,32,111,110,32,115,121,115,46,112,97,116,104,32,111,
- 114,32,39,112,97,116,104,39,32,98,97,115,101,100,32,111,
- 110,32,115,121,115,46,112,97,116,104,95,104,111,111,107,115,
- 32,97,110,100,10,32,32,32,32,32,32,32,32,115,121,115,
- 46,112,97,116,104,95,105,109,112,111,114,116,101,114,95,99,
- 97,99,104,101,46,10,10,32,32,32,32,32,32,32,32,84,
- 104,105,115,32,109,101,116,104,111,100,32,105,115,32,100,101,
- 112,114,101,99,97,116,101,100,46,32,32,85,115,101,32,102,
- 105,110,100,95,115,112,101,99,40,41,32,105,110,115,116,101,
- 97,100,46,10,10,32,32,32,32,32,32,32,32,78,41,2,
- 114,181,0,0,0,114,127,0,0,0,41,4,114,170,0,0,
- 0,114,126,0,0,0,114,35,0,0,0,114,164,0,0,0,
- 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,
- 182,0,0,0,128,4,0,0,115,8,0,0,0,0,8,18,
- 1,12,1,4,1,122,22,80,97,116,104,70,105,110,100,101,
- 114,46,102,105,110,100,95,109,111,100,117,108,101,41,12,114,
- 112,0,0,0,114,111,0,0,0,114,113,0,0,0,114,114,
- 0,0,0,114,183,0,0,0,114,250,0,0,0,114,255,0,
- 0,0,114,1,1,0,0,114,2,1,0,0,114,5,1,0,
- 0,114,181,0,0,0,114,182,0,0,0,114,4,0,0,0,
- 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,
- 249,0,0,0,8,4,0,0,115,22,0,0,0,12,2,6,
- 2,18,8,18,17,18,22,18,15,3,1,18,31,3,1,21,
- 21,3,1,114,249,0,0,0,99,0,0,0,0,0,0,0,
- 0,0,0,0,0,3,0,0,0,64,0,0,0,115,133,0,
- 0,0,101,0,0,90,1,0,100,0,0,90,2,0,100,1,
- 0,90,3,0,100,2,0,100,3,0,132,0,0,90,4,0,
- 100,4,0,100,5,0,132,0,0,90,5,0,101,6,0,90,
- 7,0,100,6,0,100,7,0,132,0,0,90,8,0,100,8,
- 0,100,9,0,132,0,0,90,9,0,100,10,0,100,11,0,
- 100,12,0,132,1,0,90,10,0,100,13,0,100,14,0,132,
- 0,0,90,11,0,101,12,0,100,15,0,100,16,0,132,0,
- 0,131,1,0,90,13,0,100,17,0,100,18,0,132,0,0,
- 90,14,0,100,10,0,83,41,19,218,10,70,105,108,101,70,
- 105,110,100,101,114,122,172,70,105,108,101,45,98,97,115,101,
- 100,32,102,105,110,100,101,114,46,10,10,32,32,32,32,73,
- 110,116,101,114,97,99,116,105,111,110,115,32,119,105,116,104,
- 32,116,104,101,32,102,105,108,101,32,115,121,115,116,101,109,
- 32,97,114,101,32,99,97,99,104,101,100,32,102,111,114,32,
- 112,101,114,102,111,114,109,97,110,99,101,44,32,98,101,105,
- 110,103,10,32,32,32,32,114,101,102,114,101,115,104,101,100,
- 32,119,104,101,110,32,116,104,101,32,100,105,114,101,99,116,
- 111,114,121,32,116,104,101,32,102,105,110,100,101,114,32,105,
- 115,32,104,97,110,100,108,105,110,103,32,104,97,115,32,98,
- 101,101,110,32,109,111,100,105,102,105,101,100,46,10,10,32,
- 32,32,32,99,2,0,0,0,0,0,0,0,5,0,0,0,
- 5,0,0,0,7,0,0,0,115,122,0,0,0,103,0,0,
- 125,3,0,120,52,0,124,2,0,68,93,44,0,92,2,0,
- 137,0,0,125,4,0,124,3,0,106,0,0,135,0,0,102,
- 1,0,100,1,0,100,2,0,134,0,0,124,4,0,68,131,
- 1,0,131,1,0,1,113,13,0,87,124,3,0,124,0,0,
- 95,1,0,124,1,0,112,79,0,100,3,0,124,0,0,95,
- 2,0,100,6,0,124,0,0,95,3,0,116,4,0,131,0,
- 0,124,0,0,95,5,0,116,4,0,131,0,0,124,0,0,
- 95,6,0,100,5,0,83,41,7,122,154,73,110,105,116,105,
- 97,108,105,122,101,32,119,105,116,104,32,116,104,101,32,112,
- 97,116,104,32,116,111,32,115,101,97,114,99,104,32,111,110,
- 32,97,110,100,32,97,32,118,97,114,105,97,98,108,101,32,
- 110,117,109,98,101,114,32,111,102,10,32,32,32,32,32,32,
- 32,32,50,45,116,117,112,108,101,115,32,99,111,110,116,97,
- 105,110,105,110,103,32,116,104,101,32,108,111,97,100,101,114,
- 32,97,110,100,32,116,104,101,32,102,105,108,101,32,115,117,
- 102,102,105,120,101,115,32,116,104,101,32,108,111,97,100,101,
- 114,10,32,32,32,32,32,32,32,32,114,101,99,111,103,110,
- 105,122,101,115,46,99,1,0,0,0,0,0,0,0,2,0,
- 0,0,3,0,0,0,51,0,0,0,115,27,0,0,0,124,
- 0,0,93,17,0,125,1,0,124,1,0,136,0,0,102,2,
- 0,86,1,113,3,0,100,0,0,83,41,1,78,114,4,0,
- 0,0,41,2,114,22,0,0,0,114,225,0,0,0,41,1,
- 114,127,0,0,0,114,4,0,0,0,114,5,0,0,0,114,
- 227,0,0,0,157,4,0,0,115,2,0,0,0,6,0,122,
- 38,70,105,108,101,70,105,110,100,101,114,46,95,95,105,110,
- 105,116,95,95,46,60,108,111,99,97,108,115,62,46,60,103,
- 101,110,101,120,112,114,62,114,58,0,0,0,114,29,0,0,
- 0,78,114,87,0,0,0,41,7,114,149,0,0,0,218,8,
- 95,108,111,97,100,101,114,115,114,35,0,0,0,218,11,95,
- 112,97,116,104,95,109,116,105,109,101,218,3,115,101,116,218,
- 11,95,112,97,116,104,95,99,97,99,104,101,218,19,95,114,
- 101,108,97,120,101,100,95,112,97,116,104,95,99,97,99,104,
- 101,41,5,114,108,0,0,0,114,35,0,0,0,218,14,108,
- 111,97,100,101,114,95,100,101,116,97,105,108,115,90,7,108,
- 111,97,100,101,114,115,114,166,0,0,0,114,4,0,0,0,
- 41,1,114,127,0,0,0,114,5,0,0,0,114,185,0,0,
- 0,151,4,0,0,115,16,0,0,0,0,4,6,1,19,1,
- 36,1,9,2,15,1,9,1,12,1,122,19,70,105,108,101,
- 70,105,110,100,101,114,46,95,95,105,110,105,116,95,95,99,
- 1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,
- 67,0,0,0,115,13,0,0,0,100,3,0,124,0,0,95,
- 0,0,100,2,0,83,41,4,122,31,73,110,118,97,108,105,
- 100,97,116,101,32,116,104,101,32,100,105,114,101,99,116,111,
- 114,121,32,109,116,105,109,101,46,114,29,0,0,0,78,114,
- 87,0,0,0,41,1,114,8,1,0,0,41,1,114,108,0,
+ 101,32,109,101,116,104,111,100,32,105,115,32,100,101,112,114,
+ 101,99,97,116,101,100,46,32,32,84,104,101,32,105,109,112,
+ 111,114,116,32,109,97,99,104,105,110,101,114,121,32,100,111,
+ 101,115,32,116,104,101,32,106,111,98,32,105,116,115,101,108,
+ 102,46,10,10,32,32,32,32,32,32,32,32,122,25,60,109,
+ 111,100,117,108,101,32,123,33,114,125,32,40,110,97,109,101,
+ 115,112,97,99,101,41,62,41,2,114,47,0,0,0,114,105,
+ 0,0,0,41,2,114,164,0,0,0,114,184,0,0,0,114,
+ 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,11,
+ 109,111,100,117,108,101,95,114,101,112,114,221,3,0,0,115,
+ 2,0,0,0,0,7,122,28,95,78,97,109,101,115,112,97,
+ 99,101,76,111,97,100,101,114,46,109,111,100,117,108,101,95,
+ 114,101,112,114,99,2,0,0,0,0,0,0,0,2,0,0,
+ 0,1,0,0,0,67,0,0,0,115,4,0,0,0,100,1,
+ 0,83,41,2,78,84,114,4,0,0,0,41,2,114,100,0,
+ 0,0,114,119,0,0,0,114,4,0,0,0,114,4,0,0,
+ 0,114,5,0,0,0,114,153,0,0,0,230,3,0,0,115,
+ 2,0,0,0,0,1,122,27,95,78,97,109,101,115,112,97,
+ 99,101,76,111,97,100,101,114,46,105,115,95,112,97,99,107,
+ 97,103,101,99,2,0,0,0,0,0,0,0,2,0,0,0,
+ 1,0,0,0,67,0,0,0,115,4,0,0,0,100,1,0,
+ 83,41,2,78,114,30,0,0,0,114,4,0,0,0,41,2,
+ 114,100,0,0,0,114,119,0,0,0,114,4,0,0,0,114,
+ 4,0,0,0,114,5,0,0,0,114,196,0,0,0,233,3,
+ 0,0,115,2,0,0,0,0,1,122,27,95,78,97,109,101,
+ 115,112,97,99,101,76,111,97,100,101,114,46,103,101,116,95,
+ 115,111,117,114,99,101,99,2,0,0,0,0,0,0,0,2,
+ 0,0,0,6,0,0,0,67,0,0,0,115,22,0,0,0,
+ 116,0,0,100,1,0,100,2,0,100,3,0,100,4,0,100,
+ 5,0,131,3,1,83,41,6,78,114,30,0,0,0,122,8,
+ 60,115,116,114,105,110,103,62,114,183,0,0,0,114,198,0,
+ 0,0,84,41,1,114,199,0,0,0,41,2,114,100,0,0,
+ 0,114,119,0,0,0,114,4,0,0,0,114,4,0,0,0,
+ 114,5,0,0,0,114,181,0,0,0,236,3,0,0,115,2,
+ 0,0,0,0,1,122,25,95,78,97,109,101,115,112,97,99,
+ 101,76,111,97,100,101,114,46,103,101,116,95,99,111,100,101,
+ 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,
+ 0,67,0,0,0,115,4,0,0,0,100,1,0,83,41,2,
+ 122,42,85,115,101,32,100,101,102,97,117,108,116,32,115,101,
+ 109,97,110,116,105,99,115,32,102,111,114,32,109,111,100,117,
+ 108,101,32,99,114,101,97,116,105,111,110,46,78,114,4,0,
+ 0,0,41,2,114,100,0,0,0,114,158,0,0,0,114,4,
+ 0,0,0,114,4,0,0,0,114,5,0,0,0,114,180,0,
+ 0,0,239,3,0,0,115,0,0,0,0,122,30,95,78,97,
+ 109,101,115,112,97,99,101,76,111,97,100,101,114,46,99,114,
+ 101,97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,
+ 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,
+ 115,4,0,0,0,100,0,0,83,41,1,78,114,4,0,0,
+ 0,41,2,114,100,0,0,0,114,184,0,0,0,114,4,0,
+ 0,0,114,4,0,0,0,114,5,0,0,0,114,185,0,0,
+ 0,242,3,0,0,115,2,0,0,0,0,1,122,28,95,78,
+ 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,101,
+ 120,101,99,95,109,111,100,117,108,101,99,2,0,0,0,0,
+ 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115,
+ 35,0,0,0,116,0,0,106,1,0,100,1,0,124,0,0,
+ 106,2,0,131,2,0,1,116,0,0,106,3,0,124,0,0,
+ 124,1,0,131,2,0,83,41,2,122,98,76,111,97,100,32,
+ 97,32,110,97,109,101,115,112,97,99,101,32,109,111,100,117,
+ 108,101,46,10,10,32,32,32,32,32,32,32,32,84,104,105,
+ 115,32,109,101,116,104,111,100,32,105,115,32,100,101,112,114,
+ 101,99,97,116,101,100,46,32,32,85,115,101,32,101,120,101,
+ 99,95,109,111,100,117,108,101,40,41,32,105,110,115,116,101,
+ 97,100,46,10,10,32,32,32,32,32,32,32,32,122,38,110,
+ 97,109,101,115,112,97,99,101,32,109,111,100,117,108,101,32,
+ 108,111,97,100,101,100,32,119,105,116,104,32,112,97,116,104,
+ 32,123,33,114,125,41,4,114,114,0,0,0,114,129,0,0,
+ 0,114,226,0,0,0,114,186,0,0,0,41,2,114,100,0,
+ 0,0,114,119,0,0,0,114,4,0,0,0,114,4,0,0,
+ 0,114,5,0,0,0,114,187,0,0,0,245,3,0,0,115,
+ 6,0,0,0,0,7,9,1,10,1,122,28,95,78,97,109,
+ 101,115,112,97,99,101,76,111,97,100,101,114,46,108,111,97,
+ 100,95,109,111,100,117,108,101,78,41,12,114,105,0,0,0,
+ 114,104,0,0,0,114,106,0,0,0,114,179,0,0,0,114,
+ 177,0,0,0,114,242,0,0,0,114,153,0,0,0,114,196,
+ 0,0,0,114,181,0,0,0,114,180,0,0,0,114,185,0,
+ 0,0,114,187,0,0,0,114,4,0,0,0,114,4,0,0,
+ 0,114,4,0,0,0,114,5,0,0,0,114,241,0,0,0,
+ 217,3,0,0,115,16,0,0,0,12,1,12,3,18,9,12,
+ 3,12,3,12,3,12,3,12,3,114,241,0,0,0,99,0,
+ 0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,64,
+ 0,0,0,115,160,0,0,0,101,0,0,90,1,0,100,0,
+ 0,90,2,0,100,1,0,90,3,0,101,4,0,100,2,0,
+ 100,3,0,132,0,0,131,1,0,90,5,0,101,4,0,100,
+ 4,0,100,5,0,132,0,0,131,1,0,90,6,0,101,4,
+ 0,100,6,0,100,7,0,132,0,0,131,1,0,90,7,0,
+ 101,4,0,100,8,0,100,9,0,132,0,0,131,1,0,90,
+ 8,0,101,4,0,100,10,0,100,11,0,100,12,0,132,1,
+ 0,131,1,0,90,9,0,101,4,0,100,10,0,100,10,0,
+ 100,13,0,100,14,0,132,2,0,131,1,0,90,10,0,101,
+ 4,0,100,10,0,100,15,0,100,16,0,132,1,0,131,1,
+ 0,90,11,0,100,10,0,83,41,17,218,10,80,97,116,104,
+ 70,105,110,100,101,114,122,62,77,101,116,97,32,112,97,116,
+ 104,32,102,105,110,100,101,114,32,102,111,114,32,115,121,115,
+ 46,112,97,116,104,32,97,110,100,32,112,97,99,107,97,103,
+ 101,32,95,95,112,97,116,104,95,95,32,97,116,116,114,105,
+ 98,117,116,101,115,46,99,1,0,0,0,0,0,0,0,2,
+ 0,0,0,4,0,0,0,67,0,0,0,115,55,0,0,0,
+ 120,48,0,116,0,0,106,1,0,106,2,0,131,0,0,68,
+ 93,31,0,125,1,0,116,3,0,124,1,0,100,1,0,131,
+ 2,0,114,16,0,124,1,0,106,4,0,131,0,0,1,113,
+ 16,0,87,100,2,0,83,41,3,122,125,67,97,108,108,32,
+ 116,104,101,32,105,110,118,97,108,105,100,97,116,101,95,99,
+ 97,99,104,101,115,40,41,32,109,101,116,104,111,100,32,111,
+ 110,32,97,108,108,32,112,97,116,104,32,101,110,116,114,121,
+ 32,102,105,110,100,101,114,115,10,32,32,32,32,32,32,32,
+ 32,115,116,111,114,101,100,32,105,110,32,115,121,115,46,112,
+ 97,116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,
+ 104,101,115,32,40,119,104,101,114,101,32,105,109,112,108,101,
+ 109,101,110,116,101,100,41,46,218,17,105,110,118,97,108,105,
+ 100,97,116,101,95,99,97,99,104,101,115,78,41,5,114,7,
+ 0,0,0,218,19,112,97,116,104,95,105,109,112,111,114,116,
+ 101,114,95,99,97,99,104,101,218,6,118,97,108,117,101,115,
+ 114,108,0,0,0,114,244,0,0,0,41,2,114,164,0,0,
+ 0,218,6,102,105,110,100,101,114,114,4,0,0,0,114,4,
+ 0,0,0,114,5,0,0,0,114,244,0,0,0,7,4,0,
+ 0,115,6,0,0,0,0,4,22,1,15,1,122,28,80,97,
+ 116,104,70,105,110,100,101,114,46,105,110,118,97,108,105,100,
+ 97,116,101,95,99,97,99,104,101,115,99,2,0,0,0,0,
+ 0,0,0,3,0,0,0,12,0,0,0,67,0,0,0,115,
+ 107,0,0,0,116,0,0,106,1,0,100,1,0,107,9,0,
+ 114,41,0,116,0,0,106,1,0,12,114,41,0,116,2,0,
+ 106,3,0,100,2,0,116,4,0,131,2,0,1,120,59,0,
+ 116,0,0,106,1,0,68,93,44,0,125,2,0,121,14,0,
+ 124,2,0,124,1,0,131,1,0,83,87,113,51,0,4,116,
+ 5,0,107,10,0,114,94,0,1,1,1,119,51,0,89,113,
+ 51,0,88,113,51,0,87,100,1,0,83,100,1,0,83,41,
+ 3,122,113,83,101,97,114,99,104,32,115,101,113,117,101,110,
+ 99,101,32,111,102,32,104,111,111,107,115,32,102,111,114,32,
+ 97,32,102,105,110,100,101,114,32,102,111,114,32,39,112,97,
+ 116,104,39,46,10,10,32,32,32,32,32,32,32,32,73,102,
+ 32,39,104,111,111,107,115,39,32,105,115,32,102,97,108,115,
+ 101,32,116,104,101,110,32,117,115,101,32,115,121,115,46,112,
+ 97,116,104,95,104,111,111,107,115,46,10,10,32,32,32,32,
+ 32,32,32,32,78,122,23,115,121,115,46,112,97,116,104,95,
+ 104,111,111,107,115,32,105,115,32,101,109,112,116,121,41,6,
+ 114,7,0,0,0,218,10,112,97,116,104,95,104,111,111,107,
+ 115,114,60,0,0,0,114,61,0,0,0,114,118,0,0,0,
+ 114,99,0,0,0,41,3,114,164,0,0,0,114,35,0,0,
+ 0,90,4,104,111,111,107,114,4,0,0,0,114,4,0,0,
+ 0,114,5,0,0,0,218,11,95,112,97,116,104,95,104,111,
+ 111,107,115,15,4,0,0,115,16,0,0,0,0,7,25,1,
+ 16,1,16,1,3,1,14,1,13,1,12,2,122,22,80,97,
+ 116,104,70,105,110,100,101,114,46,95,112,97,116,104,95,104,
+ 111,111,107,115,99,2,0,0,0,0,0,0,0,3,0,0,
+ 0,19,0,0,0,67,0,0,0,115,123,0,0,0,124,1,
+ 0,100,1,0,107,2,0,114,53,0,121,16,0,116,0,0,
+ 106,1,0,131,0,0,125,1,0,87,110,22,0,4,116,2,
+ 0,107,10,0,114,52,0,1,1,1,100,2,0,83,89,110,
+ 1,0,88,121,17,0,116,3,0,106,4,0,124,1,0,25,
+ 125,2,0,87,110,46,0,4,116,5,0,107,10,0,114,118,
+ 0,1,1,1,124,0,0,106,6,0,124,1,0,131,1,0,
+ 125,2,0,124,2,0,116,3,0,106,4,0,124,1,0,60,
+ 89,110,1,0,88,124,2,0,83,41,3,122,210,71,101,116,
+ 32,116,104,101,32,102,105,110,100,101,114,32,102,111,114,32,
+ 116,104,101,32,112,97,116,104,32,101,110,116,114,121,32,102,
+ 114,111,109,32,115,121,115,46,112,97,116,104,95,105,109,112,
+ 111,114,116,101,114,95,99,97,99,104,101,46,10,10,32,32,
+ 32,32,32,32,32,32,73,102,32,116,104,101,32,112,97,116,
+ 104,32,101,110,116,114,121,32,105,115,32,110,111,116,32,105,
+ 110,32,116,104,101,32,99,97,99,104,101,44,32,102,105,110,
+ 100,32,116,104,101,32,97,112,112,114,111,112,114,105,97,116,
+ 101,32,102,105,110,100,101,114,10,32,32,32,32,32,32,32,
+ 32,97,110,100,32,99,97,99,104,101,32,105,116,46,32,73,
+ 102,32,110,111,32,102,105,110,100,101,114,32,105,115,32,97,
+ 118,97,105,108,97,98,108,101,44,32,115,116,111,114,101,32,
+ 78,111,110,101,46,10,10,32,32,32,32,32,32,32,32,114,
+ 30,0,0,0,78,41,7,114,3,0,0,0,114,45,0,0,
+ 0,218,17,70,105,108,101,78,111,116,70,111,117,110,100,69,
+ 114,114,111,114,114,7,0,0,0,114,245,0,0,0,114,131,
+ 0,0,0,114,249,0,0,0,41,3,114,164,0,0,0,114,
+ 35,0,0,0,114,247,0,0,0,114,4,0,0,0,114,4,
+ 0,0,0,114,5,0,0,0,218,20,95,112,97,116,104,95,
+ 105,109,112,111,114,116,101,114,95,99,97,99,104,101,32,4,
+ 0,0,115,22,0,0,0,0,8,12,1,3,1,16,1,13,
+ 3,9,1,3,1,17,1,13,1,15,1,18,1,122,31,80,
+ 97,116,104,70,105,110,100,101,114,46,95,112,97,116,104,95,
+ 105,109,112,111,114,116,101,114,95,99,97,99,104,101,99,3,
+ 0,0,0,0,0,0,0,6,0,0,0,3,0,0,0,67,
+ 0,0,0,115,119,0,0,0,116,0,0,124,2,0,100,1,
+ 0,131,2,0,114,39,0,124,2,0,106,1,0,124,1,0,
+ 131,1,0,92,2,0,125,3,0,125,4,0,110,21,0,124,
+ 2,0,106,2,0,124,1,0,131,1,0,125,3,0,103,0,
+ 0,125,4,0,124,3,0,100,0,0,107,9,0,114,88,0,
+ 116,3,0,106,4,0,124,1,0,124,3,0,131,2,0,83,
+ 116,3,0,106,5,0,124,1,0,100,0,0,131,2,0,125,
+ 5,0,124,4,0,124,5,0,95,6,0,124,5,0,83,41,
+ 2,78,114,117,0,0,0,41,7,114,108,0,0,0,114,117,
+ 0,0,0,114,176,0,0,0,114,114,0,0,0,114,173,0,
+ 0,0,114,154,0,0,0,114,150,0,0,0,41,6,114,164,
+ 0,0,0,114,119,0,0,0,114,247,0,0,0,114,120,0,
+ 0,0,114,121,0,0,0,114,158,0,0,0,114,4,0,0,
+ 0,114,4,0,0,0,114,5,0,0,0,218,16,95,108,101,
+ 103,97,99,121,95,103,101,116,95,115,112,101,99,54,4,0,
+ 0,115,18,0,0,0,0,4,15,1,24,2,15,1,6,1,
+ 12,1,16,1,18,1,9,1,122,27,80,97,116,104,70,105,
+ 110,100,101,114,46,95,108,101,103,97,99,121,95,103,101,116,
+ 95,115,112,101,99,78,99,4,0,0,0,0,0,0,0,9,
+ 0,0,0,5,0,0,0,67,0,0,0,115,243,0,0,0,
+ 103,0,0,125,4,0,120,230,0,124,2,0,68,93,191,0,
+ 125,5,0,116,0,0,124,5,0,116,1,0,116,2,0,102,
+ 2,0,131,2,0,115,43,0,113,13,0,124,0,0,106,3,
+ 0,124,5,0,131,1,0,125,6,0,124,6,0,100,1,0,
+ 107,9,0,114,13,0,116,4,0,124,6,0,100,2,0,131,
+ 2,0,114,106,0,124,6,0,106,5,0,124,1,0,124,3,
+ 0,131,2,0,125,7,0,110,18,0,124,0,0,106,6,0,
+ 124,1,0,124,6,0,131,2,0,125,7,0,124,7,0,100,
+ 1,0,107,8,0,114,139,0,113,13,0,124,7,0,106,7,
+ 0,100,1,0,107,9,0,114,158,0,124,7,0,83,124,7,
+ 0,106,8,0,125,8,0,124,8,0,100,1,0,107,8,0,
+ 114,191,0,116,9,0,100,3,0,131,1,0,130,1,0,124,
+ 4,0,106,10,0,124,8,0,131,1,0,1,113,13,0,87,
+ 116,11,0,106,12,0,124,1,0,100,1,0,131,2,0,125,
+ 7,0,124,4,0,124,7,0,95,8,0,124,7,0,83,100,
+ 1,0,83,41,4,122,63,70,105,110,100,32,116,104,101,32,
+ 108,111,97,100,101,114,32,111,114,32,110,97,109,101,115,112,
+ 97,99,101,95,112,97,116,104,32,102,111,114,32,116,104,105,
+ 115,32,109,111,100,117,108,101,47,112,97,99,107,97,103,101,
+ 32,110,97,109,101,46,78,114,175,0,0,0,122,19,115,112,
+ 101,99,32,109,105,115,115,105,110,103,32,108,111,97,100,101,
+ 114,41,13,114,137,0,0,0,114,69,0,0,0,218,5,98,
+ 121,116,101,115,114,251,0,0,0,114,108,0,0,0,114,175,
+ 0,0,0,114,252,0,0,0,114,120,0,0,0,114,150,0,
+ 0,0,114,99,0,0,0,114,143,0,0,0,114,114,0,0,
+ 0,114,154,0,0,0,41,9,114,164,0,0,0,114,119,0,
+ 0,0,114,35,0,0,0,114,174,0,0,0,218,14,110,97,
+ 109,101,115,112,97,99,101,95,112,97,116,104,90,5,101,110,
+ 116,114,121,114,247,0,0,0,114,158,0,0,0,114,121,0,
0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,
- 0,114,250,0,0,0,165,4,0,0,115,2,0,0,0,0,
- 2,122,28,70,105,108,101,70,105,110,100,101,114,46,105,110,
- 118,97,108,105,100,97,116,101,95,99,97,99,104,101,115,99,
- 2,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,
- 67,0,0,0,115,59,0,0,0,124,0,0,106,0,0,124,
- 1,0,131,1,0,125,2,0,124,2,0,100,1,0,107,8,
- 0,114,37,0,100,1,0,103,0,0,102,2,0,83,124,2,
- 0,106,1,0,124,2,0,106,2,0,112,55,0,103,0,0,
- 102,2,0,83,41,2,122,197,84,114,121,32,116,111,32,102,
- 105,110,100,32,97,32,108,111,97,100,101,114,32,102,111,114,
- 32,116,104,101,32,115,112,101,99,105,102,105,101,100,32,109,
- 111,100,117,108,101,44,32,111,114,32,116,104,101,32,110,97,
- 109,101,115,112,97,99,101,10,32,32,32,32,32,32,32,32,
- 112,97,99,107,97,103,101,32,112,111,114,116,105,111,110,115,
- 46,32,82,101,116,117,114,110,115,32,40,108,111,97,100,101,
- 114,44,32,108,105,115,116,45,111,102,45,112,111,114,116,105,
- 111,110,115,41,46,10,10,32,32,32,32,32,32,32,32,84,
- 104,105,115,32,109,101,116,104,111,100,32,105,115,32,100,101,
- 112,114,101,99,97,116,101,100,46,32,32,85,115,101,32,102,
- 105,110,100,95,115,112,101,99,40,41,32,105,110,115,116,101,
- 97,100,46,10,10,32,32,32,32,32,32,32,32,78,41,3,
- 114,181,0,0,0,114,127,0,0,0,114,156,0,0,0,41,
- 3,114,108,0,0,0,114,126,0,0,0,114,164,0,0,0,
+ 0,218,9,95,103,101,116,95,115,112,101,99,69,4,0,0,
+ 115,40,0,0,0,0,5,6,1,13,1,21,1,3,1,15,
+ 1,12,1,15,1,21,2,18,1,12,1,3,1,15,1,4,
+ 1,9,1,12,1,12,5,17,2,18,1,9,1,122,20,80,
+ 97,116,104,70,105,110,100,101,114,46,95,103,101,116,95,115,
+ 112,101,99,99,4,0,0,0,0,0,0,0,6,0,0,0,
+ 4,0,0,0,67,0,0,0,115,140,0,0,0,124,2,0,
+ 100,1,0,107,8,0,114,21,0,116,0,0,106,1,0,125,
+ 2,0,124,0,0,106,2,0,124,1,0,124,2,0,124,3,
+ 0,131,3,0,125,4,0,124,4,0,100,1,0,107,8,0,
+ 114,58,0,100,1,0,83,124,4,0,106,3,0,100,1,0,
+ 107,8,0,114,132,0,124,4,0,106,4,0,125,5,0,124,
+ 5,0,114,125,0,100,2,0,124,4,0,95,5,0,116,6,
+ 0,124,1,0,124,5,0,124,0,0,106,2,0,131,3,0,
+ 124,4,0,95,4,0,124,4,0,83,100,1,0,83,110,4,
+ 0,124,4,0,83,100,1,0,83,41,3,122,98,102,105,110,
+ 100,32,116,104,101,32,109,111,100,117,108,101,32,111,110,32,
+ 115,121,115,46,112,97,116,104,32,111,114,32,39,112,97,116,
+ 104,39,32,98,97,115,101,100,32,111,110,32,115,121,115,46,
+ 112,97,116,104,95,104,111,111,107,115,32,97,110,100,10,32,
+ 32,32,32,32,32,32,32,115,121,115,46,112,97,116,104,95,
+ 105,109,112,111,114,116,101,114,95,99,97,99,104,101,46,78,
+ 90,9,110,97,109,101,115,112,97,99,101,41,7,114,7,0,
+ 0,0,114,35,0,0,0,114,255,0,0,0,114,120,0,0,
+ 0,114,150,0,0,0,114,152,0,0,0,114,224,0,0,0,
+ 41,6,114,164,0,0,0,114,119,0,0,0,114,35,0,0,
+ 0,114,174,0,0,0,114,158,0,0,0,114,254,0,0,0,
114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,
- 124,0,0,0,171,4,0,0,115,8,0,0,0,0,7,15,
- 1,12,1,10,1,122,22,70,105,108,101,70,105,110,100,101,
- 114,46,102,105,110,100,95,108,111,97,100,101,114,99,6,0,
- 0,0,0,0,0,0,7,0,0,0,7,0,0,0,67,0,
- 0,0,115,40,0,0,0,124,1,0,124,2,0,124,3,0,
- 131,2,0,125,6,0,116,0,0,124,2,0,124,3,0,100,
- 1,0,124,6,0,100,2,0,124,4,0,131,2,2,83,41,
- 3,78,114,127,0,0,0,114,156,0,0,0,41,1,114,167,
- 0,0,0,41,7,114,108,0,0,0,114,165,0,0,0,114,
- 126,0,0,0,114,35,0,0,0,90,4,115,109,115,108,114,
- 180,0,0,0,114,127,0,0,0,114,4,0,0,0,114,4,
- 0,0,0,114,5,0,0,0,114,5,1,0,0,183,4,0,
- 0,115,6,0,0,0,0,1,15,1,18,1,122,20,70,105,
- 108,101,70,105,110,100,101,114,46,95,103,101,116,95,115,112,
- 101,99,78,99,3,0,0,0,0,0,0,0,14,0,0,0,
- 15,0,0,0,67,0,0,0,115,234,1,0,0,100,1,0,
- 125,3,0,124,1,0,106,0,0,100,2,0,131,1,0,100,
- 3,0,25,125,4,0,121,34,0,116,1,0,124,0,0,106,
- 2,0,112,49,0,116,3,0,106,4,0,131,0,0,131,1,
- 0,106,5,0,125,5,0,87,110,24,0,4,116,6,0,107,
- 10,0,114,85,0,1,1,1,100,10,0,125,5,0,89,110,
- 1,0,88,124,5,0,124,0,0,106,7,0,107,3,0,114,
- 120,0,124,0,0,106,8,0,131,0,0,1,124,5,0,124,
- 0,0,95,7,0,116,9,0,131,0,0,114,153,0,124,0,
- 0,106,10,0,125,6,0,124,4,0,106,11,0,131,0,0,
- 125,7,0,110,15,0,124,0,0,106,12,0,125,6,0,124,
- 4,0,125,7,0,124,7,0,124,6,0,107,6,0,114,45,
- 1,116,13,0,124,0,0,106,2,0,124,4,0,131,2,0,
- 125,8,0,120,100,0,124,0,0,106,14,0,68,93,77,0,
- 92,2,0,125,9,0,125,10,0,100,5,0,124,9,0,23,
- 125,11,0,116,13,0,124,8,0,124,11,0,131,2,0,125,
- 12,0,116,15,0,124,12,0,131,1,0,114,208,0,124,0,
- 0,106,16,0,124,10,0,124,1,0,124,12,0,124,8,0,
- 103,1,0,124,2,0,131,5,0,83,113,208,0,87,116,17,
- 0,124,8,0,131,1,0,125,3,0,120,123,0,124,0,0,
- 106,14,0,68,93,112,0,92,2,0,125,9,0,125,10,0,
- 116,13,0,124,0,0,106,2,0,124,4,0,124,9,0,23,
- 131,2,0,125,12,0,116,18,0,100,6,0,106,19,0,124,
- 12,0,131,1,0,100,7,0,100,3,0,131,1,1,1,124,
- 7,0,124,9,0,23,124,6,0,107,6,0,114,55,1,116,
- 15,0,124,12,0,131,1,0,114,55,1,124,0,0,106,16,
- 0,124,10,0,124,1,0,124,12,0,100,8,0,124,2,0,
- 131,5,0,83,113,55,1,87,124,3,0,114,230,1,116,18,
- 0,100,9,0,106,19,0,124,8,0,131,1,0,131,1,0,
- 1,116,20,0,106,21,0,124,1,0,100,8,0,131,2,0,
- 125,13,0,124,8,0,103,1,0,124,13,0,95,22,0,124,
- 13,0,83,100,8,0,83,41,11,122,125,84,114,121,32,116,
- 111,32,102,105,110,100,32,97,32,108,111,97,100,101,114,32,
- 102,111,114,32,116,104,101,32,115,112,101,99,105,102,105,101,
- 100,32,109,111,100,117,108,101,44,32,111,114,32,116,104,101,
- 32,110,97,109,101,115,112,97,99,101,10,32,32,32,32,32,
- 32,32,32,112,97,99,107,97,103,101,32,112,111,114,116,105,
- 111,110,115,46,32,82,101,116,117,114,110,115,32,40,108,111,
- 97,100,101,114,44,32,108,105,115,116,45,111,102,45,112,111,
- 114,116,105,111,110,115,41,46,70,114,58,0,0,0,114,56,
- 0,0,0,114,29,0,0,0,114,185,0,0,0,122,9,116,
- 114,121,105,110,103,32,123,125,114,98,0,0,0,78,122,25,
- 112,111,115,115,105,98,108,101,32,110,97,109,101,115,112,97,
- 99,101,32,102,111,114,32,123,125,114,87,0,0,0,41,23,
- 114,32,0,0,0,114,39,0,0,0,114,35,0,0,0,114,
- 3,0,0,0,114,45,0,0,0,114,219,0,0,0,114,40,
- 0,0,0,114,8,1,0,0,218,11,95,102,105,108,108,95,
- 99,97,99,104,101,114,6,0,0,0,114,11,1,0,0,114,
- 88,0,0,0,114,10,1,0,0,114,28,0,0,0,114,7,
- 1,0,0,114,44,0,0,0,114,5,1,0,0,114,46,0,
- 0,0,114,105,0,0,0,114,47,0,0,0,114,121,0,0,
- 0,114,160,0,0,0,114,156,0,0,0,41,14,114,108,0,
- 0,0,114,126,0,0,0,114,180,0,0,0,90,12,105,115,
- 95,110,97,109,101,115,112,97,99,101,90,11,116,97,105,108,
- 95,109,111,100,117,108,101,114,133,0,0,0,90,5,99,97,
- 99,104,101,90,12,99,97,99,104,101,95,109,111,100,117,108,
- 101,90,9,98,97,115,101,95,112,97,116,104,114,225,0,0,
- 0,114,165,0,0,0,90,13,105,110,105,116,95,102,105,108,
- 101,110,97,109,101,90,9,102,117,108,108,95,112,97,116,104,
- 114,164,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,114,181,0,0,0,188,4,0,0,115,68,0,
- 0,0,0,3,6,1,19,1,3,1,34,1,13,1,11,1,
- 15,1,10,1,9,2,9,1,9,1,15,2,9,1,6,2,
- 12,1,18,1,22,1,10,1,15,1,12,1,32,4,12,2,
- 22,1,22,1,25,1,16,1,12,1,29,1,6,1,19,1,
- 18,1,12,1,4,1,122,20,70,105,108,101,70,105,110,100,
- 101,114,46,102,105,110,100,95,115,112,101,99,99,1,0,0,
- 0,0,0,0,0,9,0,0,0,13,0,0,0,67,0,0,
- 0,115,11,1,0,0,124,0,0,106,0,0,125,1,0,121,
- 31,0,116,1,0,106,2,0,124,1,0,112,33,0,116,1,
- 0,106,3,0,131,0,0,131,1,0,125,2,0,87,110,33,
- 0,4,116,4,0,116,5,0,116,6,0,102,3,0,107,10,
- 0,114,75,0,1,1,1,103,0,0,125,2,0,89,110,1,
- 0,88,116,7,0,106,8,0,106,9,0,100,1,0,131,1,
- 0,115,112,0,116,10,0,124,2,0,131,1,0,124,0,0,
- 95,11,0,110,111,0,116,10,0,131,0,0,125,3,0,120,
- 90,0,124,2,0,68,93,82,0,125,4,0,124,4,0,106,
- 12,0,100,2,0,131,1,0,92,3,0,125,5,0,125,6,
- 0,125,7,0,124,6,0,114,191,0,100,3,0,106,13,0,
- 124,5,0,124,7,0,106,14,0,131,0,0,131,2,0,125,
- 8,0,110,6,0,124,5,0,125,8,0,124,3,0,106,15,
- 0,124,8,0,131,1,0,1,113,128,0,87,124,3,0,124,
- 0,0,95,11,0,116,7,0,106,8,0,106,9,0,116,16,
- 0,131,1,0,114,7,1,100,4,0,100,5,0,132,0,0,
- 124,2,0,68,131,1,0,124,0,0,95,17,0,100,6,0,
- 83,41,7,122,68,70,105,108,108,32,116,104,101,32,99,97,
- 99,104,101,32,111,102,32,112,111,116,101,110,116,105,97,108,
- 32,109,111,100,117,108,101,115,32,97,110,100,32,112,97,99,
- 107,97,103,101,115,32,102,111,114,32,116,104,105,115,32,100,
- 105,114,101,99,116,111,114,121,46,114,0,0,0,0,114,58,
- 0,0,0,122,5,123,125,46,123,125,99,1,0,0,0,0,
- 0,0,0,2,0,0,0,3,0,0,0,83,0,0,0,115,
- 28,0,0,0,104,0,0,124,0,0,93,18,0,125,1,0,
- 124,1,0,106,0,0,131,0,0,146,2,0,113,6,0,83,
- 114,4,0,0,0,41,1,114,88,0,0,0,41,2,114,22,
- 0,0,0,90,2,102,110,114,4,0,0,0,114,4,0,0,
- 0,114,5,0,0,0,250,9,60,115,101,116,99,111,109,112,
- 62,6,5,0,0,115,2,0,0,0,9,0,122,41,70,105,
- 108,101,70,105,110,100,101,114,46,95,102,105,108,108,95,99,
- 97,99,104,101,46,60,108,111,99,97,108,115,62,46,60,115,
- 101,116,99,111,109,112,62,78,41,18,114,35,0,0,0,114,
- 3,0,0,0,90,7,108,105,115,116,100,105,114,114,45,0,
- 0,0,114,0,1,0,0,218,15,80,101,114,109,105,115,115,
- 105,111,110,69,114,114,111,114,218,18,78,111,116,65,68,105,
- 114,101,99,116,111,114,121,69,114,114,111,114,114,7,0,0,
- 0,114,8,0,0,0,114,9,0,0,0,114,9,1,0,0,
- 114,10,1,0,0,114,83,0,0,0,114,47,0,0,0,114,
- 88,0,0,0,218,3,97,100,100,114,10,0,0,0,114,11,
- 1,0,0,41,9,114,108,0,0,0,114,35,0,0,0,90,
- 8,99,111,110,116,101,110,116,115,90,21,108,111,119,101,114,
- 95,115,117,102,102,105,120,95,99,111,110,116,101,110,116,115,
- 114,245,0,0,0,114,106,0,0,0,114,237,0,0,0,114,
- 225,0,0,0,90,8,110,101,119,95,110,97,109,101,114,4,
- 0,0,0,114,4,0,0,0,114,5,0,0,0,114,13,1,
- 0,0,233,4,0,0,115,34,0,0,0,0,2,9,1,3,
- 1,31,1,22,3,11,3,18,1,18,7,9,1,13,1,24,
- 1,6,1,27,2,6,1,17,1,9,1,18,1,122,22,70,
- 105,108,101,70,105,110,100,101,114,46,95,102,105,108,108,95,
- 99,97,99,104,101,99,1,0,0,0,0,0,0,0,3,0,
- 0,0,3,0,0,0,7,0,0,0,115,25,0,0,0,135,
- 0,0,135,1,0,102,2,0,100,1,0,100,2,0,134,0,
- 0,125,2,0,124,2,0,83,41,3,97,20,1,0,0,65,
- 32,99,108,97,115,115,32,109,101,116,104,111,100,32,119,104,
- 105,99,104,32,114,101,116,117,114,110,115,32,97,32,99,108,
- 111,115,117,114,101,32,116,111,32,117,115,101,32,111,110,32,
- 115,121,115,46,112,97,116,104,95,104,111,111,107,10,32,32,
- 32,32,32,32,32,32,119,104,105,99,104,32,119,105,108,108,
- 32,114,101,116,117,114,110,32,97,110,32,105,110,115,116,97,
- 110,99,101,32,117,115,105,110,103,32,116,104,101,32,115,112,
- 101,99,105,102,105,101,100,32,108,111,97,100,101,114,115,32,
- 97,110,100,32,116,104,101,32,112,97,116,104,10,32,32,32,
- 32,32,32,32,32,99,97,108,108,101,100,32,111,110,32,116,
- 104,101,32,99,108,111,115,117,114,101,46,10,10,32,32,32,
- 32,32,32,32,32,73,102,32,116,104,101,32,112,97,116,104,
- 32,99,97,108,108,101,100,32,111,110,32,116,104,101,32,99,
- 108,111,115,117,114,101,32,105,115,32,110,111,116,32,97,32,
- 100,105,114,101,99,116,111,114,121,44,32,73,109,112,111,114,
- 116,69,114,114,111,114,32,105,115,10,32,32,32,32,32,32,
- 32,32,114,97,105,115,101,100,46,10,10,32,32,32,32,32,
- 32,32,32,99,1,0,0,0,0,0,0,0,1,0,0,0,
- 4,0,0,0,19,0,0,0,115,43,0,0,0,116,0,0,
- 124,0,0,131,1,0,115,30,0,116,1,0,100,1,0,100,
- 2,0,124,0,0,131,1,1,130,1,0,136,0,0,124,0,
- 0,136,1,0,140,1,0,83,41,3,122,45,80,97,116,104,
- 32,104,111,111,107,32,102,111,114,32,105,109,112,111,114,116,
- 108,105,98,46,109,97,99,104,105,110,101,114,121,46,70,105,
- 108,101,70,105,110,100,101,114,46,122,30,111,110,108,121,32,
- 100,105,114,101,99,116,111,114,105,101,115,32,97,114,101,32,
- 115,117,112,112,111,114,116,101,100,114,35,0,0,0,41,2,
- 114,46,0,0,0,114,107,0,0,0,41,1,114,35,0,0,
- 0,41,2,114,170,0,0,0,114,12,1,0,0,114,4,0,
- 0,0,114,5,0,0,0,218,24,112,97,116,104,95,104,111,
- 111,107,95,102,111,114,95,70,105,108,101,70,105,110,100,101,
- 114,18,5,0,0,115,6,0,0,0,0,2,12,1,18,1,
- 122,54,70,105,108,101,70,105,110,100,101,114,46,112,97,116,
- 104,95,104,111,111,107,46,60,108,111,99,97,108,115,62,46,
- 112,97,116,104,95,104,111,111,107,95,102,111,114,95,70,105,
- 108,101,70,105,110,100,101,114,114,4,0,0,0,41,3,114,
- 170,0,0,0,114,12,1,0,0,114,18,1,0,0,114,4,
- 0,0,0,41,2,114,170,0,0,0,114,12,1,0,0,114,
- 5,0,0,0,218,9,112,97,116,104,95,104,111,111,107,8,
- 5,0,0,115,4,0,0,0,0,10,21,6,122,20,70,105,
- 108,101,70,105,110,100,101,114,46,112,97,116,104,95,104,111,
- 111,107,99,1,0,0,0,0,0,0,0,1,0,0,0,2,
- 0,0,0,67,0,0,0,115,16,0,0,0,100,1,0,106,
- 0,0,124,0,0,106,1,0,131,1,0,83,41,2,78,122,
- 16,70,105,108,101,70,105,110,100,101,114,40,123,33,114,125,
- 41,41,2,114,47,0,0,0,114,35,0,0,0,41,1,114,
- 108,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,
- 0,0,0,114,244,0,0,0,26,5,0,0,115,2,0,0,
- 0,0,1,122,19,70,105,108,101,70,105,110,100,101,114,46,
- 95,95,114,101,112,114,95,95,41,15,114,112,0,0,0,114,
- 111,0,0,0,114,113,0,0,0,114,114,0,0,0,114,185,
- 0,0,0,114,250,0,0,0,114,130,0,0,0,114,182,0,
- 0,0,114,124,0,0,0,114,5,1,0,0,114,181,0,0,
- 0,114,13,1,0,0,114,183,0,0,0,114,19,1,0,0,
- 114,244,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 4,0,0,0,114,5,0,0,0,114,6,1,0,0,142,4,
- 0,0,115,20,0,0,0,12,7,6,2,12,14,12,4,6,
- 2,12,12,12,5,15,45,12,31,18,18,114,6,1,0,0,
- 99,4,0,0,0,0,0,0,0,6,0,0,0,11,0,0,
- 0,67,0,0,0,115,195,0,0,0,124,0,0,106,0,0,
- 100,1,0,131,1,0,125,4,0,124,0,0,106,0,0,100,
- 2,0,131,1,0,125,5,0,124,4,0,115,99,0,124,5,
- 0,114,54,0,124,5,0,106,1,0,125,4,0,110,45,0,
- 124,2,0,124,3,0,107,2,0,114,84,0,116,2,0,124,
- 1,0,124,2,0,131,2,0,125,4,0,110,15,0,116,3,
- 0,124,1,0,124,2,0,131,2,0,125,4,0,124,5,0,
- 115,126,0,116,4,0,124,1,0,124,2,0,100,3,0,124,
- 4,0,131,2,1,125,5,0,121,44,0,124,5,0,124,0,
- 0,100,2,0,60,124,4,0,124,0,0,100,1,0,60,124,
- 2,0,124,0,0,100,4,0,60,124,3,0,124,0,0,100,
- 5,0,60,87,110,18,0,4,116,5,0,107,10,0,114,190,
- 0,1,1,1,89,110,1,0,88,100,0,0,83,41,6,78,
- 218,10,95,95,108,111,97,100,101,114,95,95,218,8,95,95,
- 115,112,101,99,95,95,114,127,0,0,0,90,8,95,95,102,
- 105,108,101,95,95,90,10,95,95,99,97,99,104,101,100,95,
- 95,41,6,218,3,103,101,116,114,127,0,0,0,114,223,0,
- 0,0,114,218,0,0,0,114,167,0,0,0,218,9,69,120,
- 99,101,112,116,105,111,110,41,6,90,2,110,115,114,106,0,
- 0,0,90,8,112,97,116,104,110,97,109,101,90,9,99,112,
- 97,116,104,110,97,109,101,114,127,0,0,0,114,164,0,0,
+ 175,0,0,0,101,4,0,0,115,26,0,0,0,0,4,12,
+ 1,9,1,21,1,12,1,4,1,15,1,9,1,6,3,9,
+ 1,24,1,4,2,7,2,122,20,80,97,116,104,70,105,110,
+ 100,101,114,46,102,105,110,100,95,115,112,101,99,99,3,0,
+ 0,0,0,0,0,0,4,0,0,0,3,0,0,0,67,0,
+ 0,0,115,41,0,0,0,124,0,0,106,0,0,124,1,0,
+ 124,2,0,131,2,0,125,3,0,124,3,0,100,1,0,107,
+ 8,0,114,34,0,100,1,0,83,124,3,0,106,1,0,83,
+ 41,2,122,170,102,105,110,100,32,116,104,101,32,109,111,100,
+ 117,108,101,32,111,110,32,115,121,115,46,112,97,116,104,32,
+ 111,114,32,39,112,97,116,104,39,32,98,97,115,101,100,32,
+ 111,110,32,115,121,115,46,112,97,116,104,95,104,111,111,107,
+ 115,32,97,110,100,10,32,32,32,32,32,32,32,32,115,121,
+ 115,46,112,97,116,104,95,105,109,112,111,114,116,101,114,95,
+ 99,97,99,104,101,46,10,10,32,32,32,32,32,32,32,32,
+ 84,104,105,115,32,109,101,116,104,111,100,32,105,115,32,100,
+ 101,112,114,101,99,97,116,101,100,46,32,32,85,115,101,32,
+ 102,105,110,100,95,115,112,101,99,40,41,32,105,110,115,116,
+ 101,97,100,46,10,10,32,32,32,32,32,32,32,32,78,41,
+ 2,114,175,0,0,0,114,120,0,0,0,41,4,114,164,0,
+ 0,0,114,119,0,0,0,114,35,0,0,0,114,158,0,0,
0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
- 218,14,95,102,105,120,95,117,112,95,109,111,100,117,108,101,
- 32,5,0,0,115,34,0,0,0,0,2,15,1,15,1,6,
- 1,6,1,12,1,12,1,18,2,15,1,6,1,21,1,3,
- 1,10,1,10,1,10,1,14,1,13,2,114,24,1,0,0,
- 99,0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,
- 0,67,0,0,0,115,55,0,0,0,116,0,0,116,1,0,
- 106,2,0,131,0,0,102,2,0,125,0,0,116,3,0,116,
- 4,0,102,2,0,125,1,0,116,5,0,116,6,0,102,2,
- 0,125,2,0,124,0,0,124,1,0,124,2,0,103,3,0,
- 83,41,1,122,95,82,101,116,117,114,110,115,32,97,32,108,
- 105,115,116,32,111,102,32,102,105,108,101,45,98,97,115,101,
- 100,32,109,111,100,117,108,101,32,108,111,97,100,101,114,115,
- 46,10,10,32,32,32,32,69,97,99,104,32,105,116,101,109,
- 32,105,115,32,97,32,116,117,112,108,101,32,40,108,111,97,
- 100,101,114,44,32,115,117,102,102,105,120,101,115,41,46,10,
- 32,32,32,32,41,7,114,224,0,0,0,114,145,0,0,0,
- 218,18,101,120,116,101,110,115,105,111,110,95,115,117,102,102,
- 105,120,101,115,114,218,0,0,0,114,84,0,0,0,114,223,
- 0,0,0,114,74,0,0,0,41,3,90,10,101,120,116,101,
- 110,115,105,111,110,115,90,6,115,111,117,114,99,101,90,8,
- 98,121,116,101,99,111,100,101,114,4,0,0,0,114,4,0,
- 0,0,114,5,0,0,0,114,161,0,0,0,55,5,0,0,
- 115,8,0,0,0,0,5,18,1,12,1,12,1,114,161,0,
- 0,0,99,1,0,0,0,0,0,0,0,12,0,0,0,12,
- 0,0,0,67,0,0,0,115,70,2,0,0,124,0,0,97,
- 0,0,116,0,0,106,1,0,97,1,0,116,0,0,106,2,
- 0,97,2,0,116,1,0,106,3,0,116,4,0,25,125,1,
- 0,120,76,0,100,26,0,68,93,68,0,125,2,0,124,2,
- 0,116,1,0,106,3,0,107,7,0,114,83,0,116,0,0,
- 106,5,0,124,2,0,131,1,0,125,3,0,110,13,0,116,
- 1,0,106,3,0,124,2,0,25,125,3,0,116,6,0,124,
- 1,0,124,2,0,124,3,0,131,3,0,1,113,44,0,87,
- 100,5,0,100,6,0,103,1,0,102,2,0,100,7,0,100,
- 8,0,100,6,0,103,2,0,102,2,0,102,2,0,125,4,
- 0,120,149,0,124,4,0,68,93,129,0,92,2,0,125,5,
- 0,125,6,0,116,7,0,100,9,0,100,10,0,132,0,0,
- 124,6,0,68,131,1,0,131,1,0,115,199,0,116,8,0,
- 130,1,0,124,6,0,100,11,0,25,125,7,0,124,5,0,
- 116,1,0,106,3,0,107,6,0,114,241,0,116,1,0,106,
- 3,0,124,5,0,25,125,8,0,80,113,156,0,121,20,0,
- 116,0,0,106,5,0,124,5,0,131,1,0,125,8,0,80,
- 87,113,156,0,4,116,9,0,107,10,0,114,28,1,1,1,
- 1,119,156,0,89,113,156,0,88,113,156,0,87,116,9,0,
- 100,12,0,131,1,0,130,1,0,116,6,0,124,1,0,100,
- 13,0,124,8,0,131,3,0,1,116,6,0,124,1,0,100,
- 14,0,124,7,0,131,3,0,1,116,6,0,124,1,0,100,
- 15,0,100,16,0,106,10,0,124,6,0,131,1,0,131,3,
- 0,1,121,19,0,116,0,0,106,5,0,100,17,0,131,1,
- 0,125,9,0,87,110,24,0,4,116,9,0,107,10,0,114,
- 147,1,1,1,1,100,18,0,125,9,0,89,110,1,0,88,
- 116,6,0,124,1,0,100,17,0,124,9,0,131,3,0,1,
- 116,0,0,106,5,0,100,19,0,131,1,0,125,10,0,116,
- 6,0,124,1,0,100,19,0,124,10,0,131,3,0,1,124,
- 5,0,100,7,0,107,2,0,114,238,1,116,0,0,106,5,
- 0,100,20,0,131,1,0,125,11,0,116,6,0,124,1,0,
- 100,21,0,124,11,0,131,3,0,1,116,6,0,124,1,0,
- 100,22,0,116,11,0,131,0,0,131,3,0,1,116,12,0,
- 106,13,0,116,2,0,106,14,0,131,0,0,131,1,0,1,
- 124,5,0,100,7,0,107,2,0,114,66,2,116,15,0,106,
- 16,0,100,23,0,131,1,0,1,100,24,0,116,12,0,107,
- 6,0,114,66,2,100,25,0,116,17,0,95,18,0,100,18,
- 0,83,41,27,122,205,83,101,116,117,112,32,116,104,101,32,
- 112,97,116,104,45,98,97,115,101,100,32,105,109,112,111,114,
- 116,101,114,115,32,102,111,114,32,105,109,112,111,114,116,108,
- 105,98,32,98,121,32,105,109,112,111,114,116,105,110,103,32,
- 110,101,101,100,101,100,10,32,32,32,32,98,117,105,108,116,
- 45,105,110,32,109,111,100,117,108,101,115,32,97,110,100,32,
- 105,110,106,101,99,116,105,110,103,32,116,104,101,109,32,105,
- 110,116,111,32,116,104,101,32,103,108,111,98,97,108,32,110,
- 97,109,101,115,112,97,99,101,46,10,10,32,32,32,32,79,
- 116,104,101,114,32,99,111,109,112,111,110,101,110,116,115,32,
- 97,114,101,32,101,120,116,114,97,99,116,101,100,32,102,114,
- 111,109,32,116,104,101,32,99,111,114,101,32,98,111,111,116,
- 115,116,114,97,112,32,109,111,100,117,108,101,46,10,10,32,
- 32,32,32,114,49,0,0,0,114,60,0,0,0,218,8,98,
- 117,105,108,116,105,110,115,114,142,0,0,0,90,5,112,111,
- 115,105,120,250,1,47,218,2,110,116,250,1,92,99,1,0,
- 0,0,0,0,0,0,2,0,0,0,3,0,0,0,115,0,
- 0,0,115,33,0,0,0,124,0,0,93,23,0,125,1,0,
- 116,0,0,124,1,0,131,1,0,100,0,0,107,2,0,86,
- 1,113,3,0,100,1,0,83,41,2,114,29,0,0,0,78,
- 41,1,114,31,0,0,0,41,2,114,22,0,0,0,114,77,
+ 114,176,0,0,0,123,4,0,0,115,8,0,0,0,0,8,
+ 18,1,12,1,4,1,122,22,80,97,116,104,70,105,110,100,
+ 101,114,46,102,105,110,100,95,109,111,100,117,108,101,41,12,
+ 114,105,0,0,0,114,104,0,0,0,114,106,0,0,0,114,
+ 107,0,0,0,114,177,0,0,0,114,244,0,0,0,114,249,
+ 0,0,0,114,251,0,0,0,114,252,0,0,0,114,255,0,
+ 0,0,114,175,0,0,0,114,176,0,0,0,114,4,0,0,
+ 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
+ 114,243,0,0,0,3,4,0,0,115,22,0,0,0,12,2,
+ 6,2,18,8,18,17,18,22,18,15,3,1,18,31,3,1,
+ 21,21,3,1,114,243,0,0,0,99,0,0,0,0,0,0,
+ 0,0,0,0,0,0,3,0,0,0,64,0,0,0,115,133,
+ 0,0,0,101,0,0,90,1,0,100,0,0,90,2,0,100,
+ 1,0,90,3,0,100,2,0,100,3,0,132,0,0,90,4,
+ 0,100,4,0,100,5,0,132,0,0,90,5,0,101,6,0,
+ 90,7,0,100,6,0,100,7,0,132,0,0,90,8,0,100,
+ 8,0,100,9,0,132,0,0,90,9,0,100,10,0,100,11,
+ 0,100,12,0,132,1,0,90,10,0,100,13,0,100,14,0,
+ 132,0,0,90,11,0,101,12,0,100,15,0,100,16,0,132,
+ 0,0,131,1,0,90,13,0,100,17,0,100,18,0,132,0,
+ 0,90,14,0,100,10,0,83,41,19,218,10,70,105,108,101,
+ 70,105,110,100,101,114,122,172,70,105,108,101,45,98,97,115,
+ 101,100,32,102,105,110,100,101,114,46,10,10,32,32,32,32,
+ 73,110,116,101,114,97,99,116,105,111,110,115,32,119,105,116,
+ 104,32,116,104,101,32,102,105,108,101,32,115,121,115,116,101,
+ 109,32,97,114,101,32,99,97,99,104,101,100,32,102,111,114,
+ 32,112,101,114,102,111,114,109,97,110,99,101,44,32,98,101,
+ 105,110,103,10,32,32,32,32,114,101,102,114,101,115,104,101,
+ 100,32,119,104,101,110,32,116,104,101,32,100,105,114,101,99,
+ 116,111,114,121,32,116,104,101,32,102,105,110,100,101,114,32,
+ 105,115,32,104,97,110,100,108,105,110,103,32,104,97,115,32,
+ 98,101,101,110,32,109,111,100,105,102,105,101,100,46,10,10,
+ 32,32,32,32,99,2,0,0,0,0,0,0,0,5,0,0,
+ 0,5,0,0,0,7,0,0,0,115,122,0,0,0,103,0,
+ 0,125,3,0,120,52,0,124,2,0,68,93,44,0,92,2,
+ 0,137,0,0,125,4,0,124,3,0,106,0,0,135,0,0,
+ 102,1,0,100,1,0,100,2,0,134,0,0,124,4,0,68,
+ 131,1,0,131,1,0,1,113,13,0,87,124,3,0,124,0,
+ 0,95,1,0,124,1,0,112,79,0,100,3,0,124,0,0,
+ 95,2,0,100,6,0,124,0,0,95,3,0,116,4,0,131,
+ 0,0,124,0,0,95,5,0,116,4,0,131,0,0,124,0,
+ 0,95,6,0,100,5,0,83,41,7,122,154,73,110,105,116,
+ 105,97,108,105,122,101,32,119,105,116,104,32,116,104,101,32,
+ 112,97,116,104,32,116,111,32,115,101,97,114,99,104,32,111,
+ 110,32,97,110,100,32,97,32,118,97,114,105,97,98,108,101,
+ 32,110,117,109,98,101,114,32,111,102,10,32,32,32,32,32,
+ 32,32,32,50,45,116,117,112,108,101,115,32,99,111,110,116,
+ 97,105,110,105,110,103,32,116,104,101,32,108,111,97,100,101,
+ 114,32,97,110,100,32,116,104,101,32,102,105,108,101,32,115,
+ 117,102,102,105,120,101,115,32,116,104,101,32,108,111,97,100,
+ 101,114,10,32,32,32,32,32,32,32,32,114,101,99,111,103,
+ 110,105,122,101,115,46,99,1,0,0,0,0,0,0,0,2,
+ 0,0,0,3,0,0,0,51,0,0,0,115,27,0,0,0,
+ 124,0,0,93,17,0,125,1,0,124,1,0,136,0,0,102,
+ 2,0,86,1,113,3,0,100,0,0,83,41,1,78,114,4,
+ 0,0,0,41,2,114,22,0,0,0,114,219,0,0,0,41,
+ 1,114,120,0,0,0,114,4,0,0,0,114,5,0,0,0,
+ 114,221,0,0,0,152,4,0,0,115,2,0,0,0,6,0,
+ 122,38,70,105,108,101,70,105,110,100,101,114,46,95,95,105,
+ 110,105,116,95,95,46,60,108,111,99,97,108,115,62,46,60,
+ 103,101,110,101,120,112,114,62,114,58,0,0,0,114,29,0,
+ 0,0,78,114,87,0,0,0,41,7,114,143,0,0,0,218,
+ 8,95,108,111,97,100,101,114,115,114,35,0,0,0,218,11,
+ 95,112,97,116,104,95,109,116,105,109,101,218,3,115,101,116,
+ 218,11,95,112,97,116,104,95,99,97,99,104,101,218,19,95,
+ 114,101,108,97,120,101,100,95,112,97,116,104,95,99,97,99,
+ 104,101,41,5,114,100,0,0,0,114,35,0,0,0,218,14,
+ 108,111,97,100,101,114,95,100,101,116,97,105,108,115,90,7,
+ 108,111,97,100,101,114,115,114,160,0,0,0,114,4,0,0,
+ 0,41,1,114,120,0,0,0,114,5,0,0,0,114,179,0,
+ 0,0,146,4,0,0,115,16,0,0,0,0,4,6,1,19,
+ 1,36,1,9,2,15,1,9,1,12,1,122,19,70,105,108,
+ 101,70,105,110,100,101,114,46,95,95,105,110,105,116,95,95,
+ 99,1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,
+ 0,67,0,0,0,115,13,0,0,0,100,3,0,124,0,0,
+ 95,0,0,100,2,0,83,41,4,122,31,73,110,118,97,108,
+ 105,100,97,116,101,32,116,104,101,32,100,105,114,101,99,116,
+ 111,114,121,32,109,116,105,109,101,46,114,29,0,0,0,78,
+ 114,87,0,0,0,41,1,114,2,1,0,0,41,1,114,100,
0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,
- 0,0,114,227,0,0,0,91,5,0,0,115,2,0,0,0,
- 6,0,122,25,95,115,101,116,117,112,46,60,108,111,99,97,
- 108,115,62,46,60,103,101,110,101,120,112,114,62,114,59,0,
- 0,0,122,30,105,109,112,111,114,116,108,105,98,32,114,101,
- 113,117,105,114,101,115,32,112,111,115,105,120,32,111,114,32,
- 110,116,114,3,0,0,0,114,25,0,0,0,114,21,0,0,
- 0,114,30,0,0,0,90,7,95,116,104,114,101,97,100,78,
- 90,8,95,119,101,97,107,114,101,102,90,6,119,105,110,114,
- 101,103,114,169,0,0,0,114,6,0,0,0,122,4,46,112,
- 121,119,122,6,95,100,46,112,121,100,84,41,4,122,3,95,
- 105,111,122,9,95,119,97,114,110,105,110,103,115,122,8,98,
- 117,105,108,116,105,110,115,122,7,109,97,114,115,104,97,108,
- 41,19,114,121,0,0,0,114,7,0,0,0,114,145,0,0,
- 0,114,239,0,0,0,114,112,0,0,0,90,18,95,98,117,
- 105,108,116,105,110,95,102,114,111,109,95,110,97,109,101,114,
- 116,0,0,0,218,3,97,108,108,218,14,65,115,115,101,114,
- 116,105,111,110,69,114,114,111,114,114,107,0,0,0,114,26,
- 0,0,0,114,11,0,0,0,114,229,0,0,0,114,149,0,
- 0,0,114,25,1,0,0,114,84,0,0,0,114,163,0,0,
- 0,114,168,0,0,0,114,173,0,0,0,41,12,218,17,95,
- 98,111,111,116,115,116,114,97,112,95,109,111,100,117,108,101,
- 90,11,115,101,108,102,95,109,111,100,117,108,101,90,12,98,
- 117,105,108,116,105,110,95,110,97,109,101,90,14,98,117,105,
- 108,116,105,110,95,109,111,100,117,108,101,90,10,111,115,95,
- 100,101,116,97,105,108,115,90,10,98,117,105,108,116,105,110,
- 95,111,115,114,21,0,0,0,114,25,0,0,0,90,9,111,
- 115,95,109,111,100,117,108,101,90,13,116,104,114,101,97,100,
- 95,109,111,100,117,108,101,90,14,119,101,97,107,114,101,102,
- 95,109,111,100,117,108,101,90,13,119,105,110,114,101,103,95,
- 109,111,100,117,108,101,114,4,0,0,0,114,4,0,0,0,
- 114,5,0,0,0,218,6,95,115,101,116,117,112,66,5,0,
- 0,115,82,0,0,0,0,8,6,1,9,1,9,3,13,1,
- 13,1,15,1,18,2,13,1,20,3,33,1,19,2,31,1,
- 10,1,15,1,13,1,4,2,3,1,15,1,5,1,13,1,
- 12,2,12,1,16,1,16,1,25,3,3,1,19,1,13,2,
- 11,1,16,3,15,1,16,3,12,1,15,1,16,3,19,1,
- 19,1,12,1,13,1,12,1,114,33,1,0,0,99,1,0,
- 0,0,0,0,0,0,2,0,0,0,3,0,0,0,67,0,
- 0,0,115,116,0,0,0,116,0,0,124,0,0,131,1,0,
- 1,116,1,0,131,0,0,125,1,0,116,2,0,106,3,0,
- 106,4,0,116,5,0,106,6,0,124,1,0,140,0,0,103,
- 1,0,131,1,0,1,116,7,0,106,8,0,100,1,0,107,
- 2,0,114,78,0,116,2,0,106,9,0,106,10,0,116,11,
- 0,131,1,0,1,116,2,0,106,9,0,106,10,0,116,12,
- 0,131,1,0,1,116,5,0,124,0,0,95,5,0,116,13,
- 0,124,0,0,95,13,0,100,2,0,83,41,3,122,41,73,
- 110,115,116,97,108,108,32,116,104,101,32,112,97,116,104,45,
- 98,97,115,101,100,32,105,109,112,111,114,116,32,99,111,109,
- 112,111,110,101,110,116,115,46,114,28,1,0,0,78,41,14,
- 114,33,1,0,0,114,161,0,0,0,114,7,0,0,0,114,
- 254,0,0,0,114,149,0,0,0,114,6,1,0,0,114,19,
- 1,0,0,114,3,0,0,0,114,112,0,0,0,218,9,109,
- 101,116,97,95,112,97,116,104,114,163,0,0,0,114,168,0,
- 0,0,114,249,0,0,0,114,218,0,0,0,41,2,114,32,
- 1,0,0,90,17,115,117,112,112,111,114,116,101,100,95,108,
- 111,97,100,101,114,115,114,4,0,0,0,114,4,0,0,0,
- 114,5,0,0,0,218,8,95,105,110,115,116,97,108,108,134,
- 5,0,0,115,16,0,0,0,0,2,10,1,9,1,28,1,
- 15,1,16,1,16,4,9,1,114,35,1,0,0,41,3,122,
- 3,119,105,110,114,1,0,0,0,114,2,0,0,0,41,57,
- 114,114,0,0,0,114,10,0,0,0,114,11,0,0,0,114,
- 17,0,0,0,114,19,0,0,0,114,28,0,0,0,114,38,
- 0,0,0,114,39,0,0,0,114,43,0,0,0,114,44,0,
- 0,0,114,46,0,0,0,114,55,0,0,0,218,4,116,121,
- 112,101,218,8,95,95,99,111,100,101,95,95,114,144,0,0,
- 0,114,15,0,0,0,114,135,0,0,0,114,14,0,0,0,
- 114,18,0,0,0,90,17,95,82,65,87,95,77,65,71,73,
- 67,95,78,85,77,66,69,82,114,73,0,0,0,114,72,0,
- 0,0,114,84,0,0,0,114,74,0,0,0,90,23,68,69,
- 66,85,71,95,66,89,84,69,67,79,68,69,95,83,85,70,
- 70,73,88,69,83,90,27,79,80,84,73,77,73,90,69,68,
- 95,66,89,84,69,67,79,68,69,95,83,85,70,70,73,88,
- 69,83,114,79,0,0,0,114,85,0,0,0,114,91,0,0,
- 0,114,95,0,0,0,114,97,0,0,0,114,105,0,0,0,
- 114,123,0,0,0,114,130,0,0,0,114,141,0,0,0,114,
- 147,0,0,0,114,150,0,0,0,114,155,0,0,0,218,6,
- 111,98,106,101,99,116,114,162,0,0,0,114,167,0,0,0,
- 114,168,0,0,0,114,184,0,0,0,114,194,0,0,0,114,
- 210,0,0,0,114,218,0,0,0,114,223,0,0,0,114,229,
- 0,0,0,114,224,0,0,0,114,230,0,0,0,114,247,0,
- 0,0,114,249,0,0,0,114,6,1,0,0,114,24,1,0,
- 0,114,161,0,0,0,114,33,1,0,0,114,35,1,0,0,
- 114,4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,
- 5,0,0,0,218,8,60,109,111,100,117,108,101,62,8,0,
- 0,0,115,100,0,0,0,6,17,6,3,12,12,12,5,12,
- 5,12,6,12,12,12,10,12,9,12,5,12,7,15,22,15,
- 110,22,1,18,2,6,1,6,2,9,2,9,2,10,2,21,
- 44,12,33,12,19,12,12,12,12,18,8,12,28,12,17,21,
- 55,21,12,18,10,12,14,9,3,12,1,15,65,19,64,19,
- 28,22,110,19,41,25,43,25,16,6,3,25,53,19,57,19,
- 41,19,134,19,146,15,23,12,11,12,68,
+ 0,0,114,244,0,0,0,160,4,0,0,115,2,0,0,0,
+ 0,2,122,28,70,105,108,101,70,105,110,100,101,114,46,105,
+ 110,118,97,108,105,100,97,116,101,95,99,97,99,104,101,115,
+ 99,2,0,0,0,0,0,0,0,3,0,0,0,2,0,0,
+ 0,67,0,0,0,115,59,0,0,0,124,0,0,106,0,0,
+ 124,1,0,131,1,0,125,2,0,124,2,0,100,1,0,107,
+ 8,0,114,37,0,100,1,0,103,0,0,102,2,0,83,124,
+ 2,0,106,1,0,124,2,0,106,2,0,112,55,0,103,0,
+ 0,102,2,0,83,41,2,122,197,84,114,121,32,116,111,32,
+ 102,105,110,100,32,97,32,108,111,97,100,101,114,32,102,111,
+ 114,32,116,104,101,32,115,112,101,99,105,102,105,101,100,32,
+ 109,111,100,117,108,101,44,32,111,114,32,116,104,101,32,110,
+ 97,109,101,115,112,97,99,101,10,32,32,32,32,32,32,32,
+ 32,112,97,99,107,97,103,101,32,112,111,114,116,105,111,110,
+ 115,46,32,82,101,116,117,114,110,115,32,40,108,111,97,100,
+ 101,114,44,32,108,105,115,116,45,111,102,45,112,111,114,116,
+ 105,111,110,115,41,46,10,10,32,32,32,32,32,32,32,32,
+ 84,104,105,115,32,109,101,116,104,111,100,32,105,115,32,100,
+ 101,112,114,101,99,97,116,101,100,46,32,32,85,115,101,32,
+ 102,105,110,100,95,115,112,101,99,40,41,32,105,110,115,116,
+ 101,97,100,46,10,10,32,32,32,32,32,32,32,32,78,41,
+ 3,114,175,0,0,0,114,120,0,0,0,114,150,0,0,0,
+ 41,3,114,100,0,0,0,114,119,0,0,0,114,158,0,0,
+ 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
+ 114,117,0,0,0,166,4,0,0,115,8,0,0,0,0,7,
+ 15,1,12,1,10,1,122,22,70,105,108,101,70,105,110,100,
+ 101,114,46,102,105,110,100,95,108,111,97,100,101,114,99,6,
+ 0,0,0,0,0,0,0,7,0,0,0,7,0,0,0,67,
+ 0,0,0,115,40,0,0,0,124,1,0,124,2,0,124,3,
+ 0,131,2,0,125,6,0,116,0,0,124,2,0,124,3,0,
+ 100,1,0,124,6,0,100,2,0,124,4,0,131,2,2,83,
+ 41,3,78,114,120,0,0,0,114,150,0,0,0,41,1,114,
+ 161,0,0,0,41,7,114,100,0,0,0,114,159,0,0,0,
+ 114,119,0,0,0,114,35,0,0,0,90,4,115,109,115,108,
+ 114,174,0,0,0,114,120,0,0,0,114,4,0,0,0,114,
+ 4,0,0,0,114,5,0,0,0,114,255,0,0,0,178,4,
+ 0,0,115,6,0,0,0,0,1,15,1,18,1,122,20,70,
+ 105,108,101,70,105,110,100,101,114,46,95,103,101,116,95,115,
+ 112,101,99,78,99,3,0,0,0,0,0,0,0,14,0,0,
+ 0,15,0,0,0,67,0,0,0,115,228,1,0,0,100,1,
+ 0,125,3,0,124,1,0,106,0,0,100,2,0,131,1,0,
+ 100,3,0,25,125,4,0,121,34,0,116,1,0,124,0,0,
+ 106,2,0,112,49,0,116,3,0,106,4,0,131,0,0,131,
+ 1,0,106,5,0,125,5,0,87,110,24,0,4,116,6,0,
+ 107,10,0,114,85,0,1,1,1,100,10,0,125,5,0,89,
+ 110,1,0,88,124,5,0,124,0,0,106,7,0,107,3,0,
+ 114,120,0,124,0,0,106,8,0,131,0,0,1,124,5,0,
+ 124,0,0,95,7,0,116,9,0,131,0,0,114,153,0,124,
+ 0,0,106,10,0,125,6,0,124,4,0,106,11,0,131,0,
+ 0,125,7,0,110,15,0,124,0,0,106,12,0,125,6,0,
+ 124,4,0,125,7,0,124,7,0,124,6,0,107,6,0,114,
+ 45,1,116,13,0,124,0,0,106,2,0,124,4,0,131,2,
+ 0,125,8,0,120,100,0,124,0,0,106,14,0,68,93,77,
+ 0,92,2,0,125,9,0,125,10,0,100,5,0,124,9,0,
+ 23,125,11,0,116,13,0,124,8,0,124,11,0,131,2,0,
+ 125,12,0,116,15,0,124,12,0,131,1,0,114,208,0,124,
+ 0,0,106,16,0,124,10,0,124,1,0,124,12,0,124,8,
+ 0,103,1,0,124,2,0,131,5,0,83,113,208,0,87,116,
+ 17,0,124,8,0,131,1,0,125,3,0,120,120,0,124,0,
+ 0,106,14,0,68,93,109,0,92,2,0,125,9,0,125,10,
+ 0,116,13,0,124,0,0,106,2,0,124,4,0,124,9,0,
+ 23,131,2,0,125,12,0,116,18,0,106,19,0,100,6,0,
+ 124,12,0,100,7,0,100,3,0,131,2,1,1,124,7,0,
+ 124,9,0,23,124,6,0,107,6,0,114,55,1,116,15,0,
+ 124,12,0,131,1,0,114,55,1,124,0,0,106,16,0,124,
+ 10,0,124,1,0,124,12,0,100,8,0,124,2,0,131,5,
+ 0,83,113,55,1,87,124,3,0,114,224,1,116,18,0,106,
+ 19,0,100,9,0,124,8,0,131,2,0,1,116,18,0,106,
+ 20,0,124,1,0,100,8,0,131,2,0,125,13,0,124,8,
+ 0,103,1,0,124,13,0,95,21,0,124,13,0,83,100,8,
+ 0,83,41,11,122,125,84,114,121,32,116,111,32,102,105,110,
+ 100,32,97,32,108,111,97,100,101,114,32,102,111,114,32,116,
+ 104,101,32,115,112,101,99,105,102,105,101,100,32,109,111,100,
+ 117,108,101,44,32,111,114,32,116,104,101,32,110,97,109,101,
+ 115,112,97,99,101,10,32,32,32,32,32,32,32,32,112,97,
+ 99,107,97,103,101,32,112,111,114,116,105,111,110,115,46,32,
+ 82,101,116,117,114,110,115,32,40,108,111,97,100,101,114,44,
+ 32,108,105,115,116,45,111,102,45,112,111,114,116,105,111,110,
+ 115,41,46,70,114,58,0,0,0,114,56,0,0,0,114,29,
+ 0,0,0,114,179,0,0,0,122,9,116,114,121,105,110,103,
+ 32,123,125,90,9,118,101,114,98,111,115,105,116,121,78,122,
+ 25,112,111,115,115,105,98,108,101,32,110,97,109,101,115,112,
+ 97,99,101,32,102,111,114,32,123,125,114,87,0,0,0,41,
+ 22,114,32,0,0,0,114,39,0,0,0,114,35,0,0,0,
+ 114,3,0,0,0,114,45,0,0,0,114,213,0,0,0,114,
+ 40,0,0,0,114,2,1,0,0,218,11,95,102,105,108,108,
+ 95,99,97,99,104,101,114,6,0,0,0,114,5,1,0,0,
+ 114,88,0,0,0,114,4,1,0,0,114,28,0,0,0,114,
+ 1,1,0,0,114,44,0,0,0,114,255,0,0,0,114,46,
+ 0,0,0,114,114,0,0,0,114,129,0,0,0,114,154,0,
+ 0,0,114,150,0,0,0,41,14,114,100,0,0,0,114,119,
+ 0,0,0,114,174,0,0,0,90,12,105,115,95,110,97,109,
+ 101,115,112,97,99,101,90,11,116,97,105,108,95,109,111,100,
+ 117,108,101,114,126,0,0,0,90,5,99,97,99,104,101,90,
+ 12,99,97,99,104,101,95,109,111,100,117,108,101,90,9,98,
+ 97,115,101,95,112,97,116,104,114,219,0,0,0,114,159,0,
+ 0,0,90,13,105,110,105,116,95,102,105,108,101,110,97,109,
+ 101,90,9,102,117,108,108,95,112,97,116,104,114,158,0,0,
+ 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
+ 114,175,0,0,0,183,4,0,0,115,70,0,0,0,0,3,
+ 6,1,19,1,3,1,34,1,13,1,11,1,15,1,10,1,
+ 9,2,9,1,9,1,15,2,9,1,6,2,12,1,18,1,
+ 22,1,10,1,15,1,12,1,32,4,12,2,22,1,22,1,
+ 22,1,16,1,12,1,15,1,14,1,6,1,16,1,18,1,
+ 12,1,4,1,122,20,70,105,108,101,70,105,110,100,101,114,
+ 46,102,105,110,100,95,115,112,101,99,99,1,0,0,0,0,
+ 0,0,0,9,0,0,0,13,0,0,0,67,0,0,0,115,
+ 11,1,0,0,124,0,0,106,0,0,125,1,0,121,31,0,
+ 116,1,0,106,2,0,124,1,0,112,33,0,116,1,0,106,
+ 3,0,131,0,0,131,1,0,125,2,0,87,110,33,0,4,
+ 116,4,0,116,5,0,116,6,0,102,3,0,107,10,0,114,
+ 75,0,1,1,1,103,0,0,125,2,0,89,110,1,0,88,
+ 116,7,0,106,8,0,106,9,0,100,1,0,131,1,0,115,
+ 112,0,116,10,0,124,2,0,131,1,0,124,0,0,95,11,
+ 0,110,111,0,116,10,0,131,0,0,125,3,0,120,90,0,
+ 124,2,0,68,93,82,0,125,4,0,124,4,0,106,12,0,
+ 100,2,0,131,1,0,92,3,0,125,5,0,125,6,0,125,
+ 7,0,124,6,0,114,191,0,100,3,0,106,13,0,124,5,
+ 0,124,7,0,106,14,0,131,0,0,131,2,0,125,8,0,
+ 110,6,0,124,5,0,125,8,0,124,3,0,106,15,0,124,
+ 8,0,131,1,0,1,113,128,0,87,124,3,0,124,0,0,
+ 95,11,0,116,7,0,106,8,0,106,9,0,116,16,0,131,
+ 1,0,114,7,1,100,4,0,100,5,0,132,0,0,124,2,
+ 0,68,131,1,0,124,0,0,95,17,0,100,6,0,83,41,
+ 7,122,68,70,105,108,108,32,116,104,101,32,99,97,99,104,
+ 101,32,111,102,32,112,111,116,101,110,116,105,97,108,32,109,
+ 111,100,117,108,101,115,32,97,110,100,32,112,97,99,107,97,
+ 103,101,115,32,102,111,114,32,116,104,105,115,32,100,105,114,
+ 101,99,116,111,114,121,46,114,0,0,0,0,114,58,0,0,
+ 0,122,5,123,125,46,123,125,99,1,0,0,0,0,0,0,
+ 0,2,0,0,0,3,0,0,0,83,0,0,0,115,28,0,
+ 0,0,104,0,0,124,0,0,93,18,0,125,1,0,124,1,
+ 0,106,0,0,131,0,0,146,2,0,113,6,0,83,114,4,
+ 0,0,0,41,1,114,88,0,0,0,41,2,114,22,0,0,
+ 0,90,2,102,110,114,4,0,0,0,114,4,0,0,0,114,
+ 5,0,0,0,250,9,60,115,101,116,99,111,109,112,62,2,
+ 5,0,0,115,2,0,0,0,9,0,122,41,70,105,108,101,
+ 70,105,110,100,101,114,46,95,102,105,108,108,95,99,97,99,
+ 104,101,46,60,108,111,99,97,108,115,62,46,60,115,101,116,
+ 99,111,109,112,62,78,41,18,114,35,0,0,0,114,3,0,
+ 0,0,90,7,108,105,115,116,100,105,114,114,45,0,0,0,
+ 114,250,0,0,0,218,15,80,101,114,109,105,115,115,105,111,
+ 110,69,114,114,111,114,218,18,78,111,116,65,68,105,114,101,
+ 99,116,111,114,121,69,114,114,111,114,114,7,0,0,0,114,
+ 8,0,0,0,114,9,0,0,0,114,3,1,0,0,114,4,
+ 1,0,0,114,83,0,0,0,114,47,0,0,0,114,88,0,
+ 0,0,218,3,97,100,100,114,10,0,0,0,114,5,1,0,
+ 0,41,9,114,100,0,0,0,114,35,0,0,0,90,8,99,
+ 111,110,116,101,110,116,115,90,21,108,111,119,101,114,95,115,
+ 117,102,102,105,120,95,99,111,110,116,101,110,116,115,114,239,
+ 0,0,0,114,98,0,0,0,114,231,0,0,0,114,219,0,
+ 0,0,90,8,110,101,119,95,110,97,109,101,114,4,0,0,
+ 0,114,4,0,0,0,114,5,0,0,0,114,7,1,0,0,
+ 229,4,0,0,115,34,0,0,0,0,2,9,1,3,1,31,
+ 1,22,3,11,3,18,1,18,7,9,1,13,1,24,1,6,
+ 1,27,2,6,1,17,1,9,1,18,1,122,22,70,105,108,
+ 101,70,105,110,100,101,114,46,95,102,105,108,108,95,99,97,
+ 99,104,101,99,1,0,0,0,0,0,0,0,3,0,0,0,
+ 3,0,0,0,7,0,0,0,115,25,0,0,0,135,0,0,
+ 135,1,0,102,2,0,100,1,0,100,2,0,134,0,0,125,
+ 2,0,124,2,0,83,41,3,97,20,1,0,0,65,32,99,
+ 108,97,115,115,32,109,101,116,104,111,100,32,119,104,105,99,
+ 104,32,114,101,116,117,114,110,115,32,97,32,99,108,111,115,
+ 117,114,101,32,116,111,32,117,115,101,32,111,110,32,115,121,
+ 115,46,112,97,116,104,95,104,111,111,107,10,32,32,32,32,
+ 32,32,32,32,119,104,105,99,104,32,119,105,108,108,32,114,
+ 101,116,117,114,110,32,97,110,32,105,110,115,116,97,110,99,
+ 101,32,117,115,105,110,103,32,116,104,101,32,115,112,101,99,
+ 105,102,105,101,100,32,108,111,97,100,101,114,115,32,97,110,
+ 100,32,116,104,101,32,112,97,116,104,10,32,32,32,32,32,
+ 32,32,32,99,97,108,108,101,100,32,111,110,32,116,104,101,
+ 32,99,108,111,115,117,114,101,46,10,10,32,32,32,32,32,
+ 32,32,32,73,102,32,116,104,101,32,112,97,116,104,32,99,
+ 97,108,108,101,100,32,111,110,32,116,104,101,32,99,108,111,
+ 115,117,114,101,32,105,115,32,110,111,116,32,97,32,100,105,
+ 114,101,99,116,111,114,121,44,32,73,109,112,111,114,116,69,
+ 114,114,111,114,32,105,115,10,32,32,32,32,32,32,32,32,
+ 114,97,105,115,101,100,46,10,10,32,32,32,32,32,32,32,
+ 32,99,1,0,0,0,0,0,0,0,1,0,0,0,4,0,
+ 0,0,19,0,0,0,115,43,0,0,0,116,0,0,124,0,
+ 0,131,1,0,115,30,0,116,1,0,100,1,0,100,2,0,
+ 124,0,0,131,1,1,130,1,0,136,0,0,124,0,0,136,
+ 1,0,140,1,0,83,41,3,122,45,80,97,116,104,32,104,
+ 111,111,107,32,102,111,114,32,105,109,112,111,114,116,108,105,
+ 98,46,109,97,99,104,105,110,101,114,121,46,70,105,108,101,
+ 70,105,110,100,101,114,46,122,30,111,110,108,121,32,100,105,
+ 114,101,99,116,111,114,105,101,115,32,97,114,101,32,115,117,
+ 112,112,111,114,116,101,100,114,35,0,0,0,41,2,114,46,
+ 0,0,0,114,99,0,0,0,41,1,114,35,0,0,0,41,
+ 2,114,164,0,0,0,114,6,1,0,0,114,4,0,0,0,
+ 114,5,0,0,0,218,24,112,97,116,104,95,104,111,111,107,
+ 95,102,111,114,95,70,105,108,101,70,105,110,100,101,114,14,
+ 5,0,0,115,6,0,0,0,0,2,12,1,18,1,122,54,
+ 70,105,108,101,70,105,110,100,101,114,46,112,97,116,104,95,
+ 104,111,111,107,46,60,108,111,99,97,108,115,62,46,112,97,
+ 116,104,95,104,111,111,107,95,102,111,114,95,70,105,108,101,
+ 70,105,110,100,101,114,114,4,0,0,0,41,3,114,164,0,
+ 0,0,114,6,1,0,0,114,12,1,0,0,114,4,0,0,
+ 0,41,2,114,164,0,0,0,114,6,1,0,0,114,5,0,
+ 0,0,218,9,112,97,116,104,95,104,111,111,107,4,5,0,
+ 0,115,4,0,0,0,0,10,21,6,122,20,70,105,108,101,
+ 70,105,110,100,101,114,46,112,97,116,104,95,104,111,111,107,
+ 99,1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,
+ 0,67,0,0,0,115,16,0,0,0,100,1,0,106,0,0,
+ 124,0,0,106,1,0,131,1,0,83,41,2,78,122,16,70,
+ 105,108,101,70,105,110,100,101,114,40,123,33,114,125,41,41,
+ 2,114,47,0,0,0,114,35,0,0,0,41,1,114,100,0,
+ 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,
+ 0,114,238,0,0,0,22,5,0,0,115,2,0,0,0,0,
+ 1,122,19,70,105,108,101,70,105,110,100,101,114,46,95,95,
+ 114,101,112,114,95,95,41,15,114,105,0,0,0,114,104,0,
+ 0,0,114,106,0,0,0,114,107,0,0,0,114,179,0,0,
+ 0,114,244,0,0,0,114,123,0,0,0,114,176,0,0,0,
+ 114,117,0,0,0,114,255,0,0,0,114,175,0,0,0,114,
+ 7,1,0,0,114,177,0,0,0,114,13,1,0,0,114,238,
+ 0,0,0,114,4,0,0,0,114,4,0,0,0,114,4,0,
+ 0,0,114,5,0,0,0,114,0,1,0,0,137,4,0,0,
+ 115,20,0,0,0,12,7,6,2,12,14,12,4,6,2,12,
+ 12,12,5,15,46,12,31,18,18,114,0,1,0,0,99,4,
+ 0,0,0,0,0,0,0,6,0,0,0,11,0,0,0,67,
+ 0,0,0,115,195,0,0,0,124,0,0,106,0,0,100,1,
+ 0,131,1,0,125,4,0,124,0,0,106,0,0,100,2,0,
+ 131,1,0,125,5,0,124,4,0,115,99,0,124,5,0,114,
+ 54,0,124,5,0,106,1,0,125,4,0,110,45,0,124,2,
+ 0,124,3,0,107,2,0,114,84,0,116,2,0,124,1,0,
+ 124,2,0,131,2,0,125,4,0,110,15,0,116,3,0,124,
+ 1,0,124,2,0,131,2,0,125,4,0,124,5,0,115,126,
+ 0,116,4,0,124,1,0,124,2,0,100,3,0,124,4,0,
+ 131,2,1,125,5,0,121,44,0,124,5,0,124,0,0,100,
+ 2,0,60,124,4,0,124,0,0,100,1,0,60,124,2,0,
+ 124,0,0,100,4,0,60,124,3,0,124,0,0,100,5,0,
+ 60,87,110,18,0,4,116,5,0,107,10,0,114,190,0,1,
+ 1,1,89,110,1,0,88,100,0,0,83,41,6,78,218,10,
+ 95,95,108,111,97,100,101,114,95,95,218,8,95,95,115,112,
+ 101,99,95,95,114,120,0,0,0,90,8,95,95,102,105,108,
+ 101,95,95,90,10,95,95,99,97,99,104,101,100,95,95,41,
+ 6,218,3,103,101,116,114,120,0,0,0,114,217,0,0,0,
+ 114,212,0,0,0,114,161,0,0,0,218,9,69,120,99,101,
+ 112,116,105,111,110,41,6,90,2,110,115,114,98,0,0,0,
+ 90,8,112,97,116,104,110,97,109,101,90,9,99,112,97,116,
+ 104,110,97,109,101,114,120,0,0,0,114,158,0,0,0,114,
+ 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,14,
+ 95,102,105,120,95,117,112,95,109,111,100,117,108,101,28,5,
+ 0,0,115,34,0,0,0,0,2,15,1,15,1,6,1,6,
+ 1,12,1,12,1,18,2,15,1,6,1,21,1,3,1,10,
+ 1,10,1,10,1,14,1,13,2,114,18,1,0,0,99,0,
+ 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67,
+ 0,0,0,115,55,0,0,0,116,0,0,116,1,0,106,2,
+ 0,131,0,0,102,2,0,125,0,0,116,3,0,116,4,0,
+ 102,2,0,125,1,0,116,5,0,116,6,0,102,2,0,125,
+ 2,0,124,0,0,124,1,0,124,2,0,103,3,0,83,41,
+ 1,122,95,82,101,116,117,114,110,115,32,97,32,108,105,115,
+ 116,32,111,102,32,102,105,108,101,45,98,97,115,101,100,32,
+ 109,111,100,117,108,101,32,108,111,97,100,101,114,115,46,10,
+ 10,32,32,32,32,69,97,99,104,32,105,116,101,109,32,105,
+ 115,32,97,32,116,117,112,108,101,32,40,108,111,97,100,101,
+ 114,44,32,115,117,102,102,105,120,101,115,41,46,10,32,32,
+ 32,32,41,7,114,218,0,0,0,114,139,0,0,0,218,18,
+ 101,120,116,101,110,115,105,111,110,95,115,117,102,102,105,120,
+ 101,115,114,212,0,0,0,114,84,0,0,0,114,217,0,0,
+ 0,114,74,0,0,0,41,3,90,10,101,120,116,101,110,115,
+ 105,111,110,115,90,6,115,111,117,114,99,101,90,8,98,121,
+ 116,101,99,111,100,101,114,4,0,0,0,114,4,0,0,0,
+ 114,5,0,0,0,114,155,0,0,0,51,5,0,0,115,8,
+ 0,0,0,0,5,18,1,12,1,12,1,114,155,0,0,0,
+ 99,1,0,0,0,0,0,0,0,12,0,0,0,12,0,0,
+ 0,67,0,0,0,115,70,2,0,0,124,0,0,97,0,0,
+ 116,0,0,106,1,0,97,1,0,116,0,0,106,2,0,97,
+ 2,0,116,1,0,106,3,0,116,4,0,25,125,1,0,120,
+ 76,0,100,26,0,68,93,68,0,125,2,0,124,2,0,116,
+ 1,0,106,3,0,107,7,0,114,83,0,116,0,0,106,5,
+ 0,124,2,0,131,1,0,125,3,0,110,13,0,116,1,0,
+ 106,3,0,124,2,0,25,125,3,0,116,6,0,124,1,0,
+ 124,2,0,124,3,0,131,3,0,1,113,44,0,87,100,5,
+ 0,100,6,0,103,1,0,102,2,0,100,7,0,100,8,0,
+ 100,6,0,103,2,0,102,2,0,102,2,0,125,4,0,120,
+ 149,0,124,4,0,68,93,129,0,92,2,0,125,5,0,125,
+ 6,0,116,7,0,100,9,0,100,10,0,132,0,0,124,6,
+ 0,68,131,1,0,131,1,0,115,199,0,116,8,0,130,1,
+ 0,124,6,0,100,11,0,25,125,7,0,124,5,0,116,1,
+ 0,106,3,0,107,6,0,114,241,0,116,1,0,106,3,0,
+ 124,5,0,25,125,8,0,80,113,156,0,121,20,0,116,0,
+ 0,106,5,0,124,5,0,131,1,0,125,8,0,80,87,113,
+ 156,0,4,116,9,0,107,10,0,114,28,1,1,1,1,119,
+ 156,0,89,113,156,0,88,113,156,0,87,116,9,0,100,12,
+ 0,131,1,0,130,1,0,116,6,0,124,1,0,100,13,0,
+ 124,8,0,131,3,0,1,116,6,0,124,1,0,100,14,0,
+ 124,7,0,131,3,0,1,116,6,0,124,1,0,100,15,0,
+ 100,16,0,106,10,0,124,6,0,131,1,0,131,3,0,1,
+ 121,19,0,116,0,0,106,5,0,100,17,0,131,1,0,125,
+ 9,0,87,110,24,0,4,116,9,0,107,10,0,114,147,1,
+ 1,1,1,100,18,0,125,9,0,89,110,1,0,88,116,6,
+ 0,124,1,0,100,17,0,124,9,0,131,3,0,1,116,0,
+ 0,106,5,0,100,19,0,131,1,0,125,10,0,116,6,0,
+ 124,1,0,100,19,0,124,10,0,131,3,0,1,124,5,0,
+ 100,7,0,107,2,0,114,238,1,116,0,0,106,5,0,100,
+ 20,0,131,1,0,125,11,0,116,6,0,124,1,0,100,21,
+ 0,124,11,0,131,3,0,1,116,6,0,124,1,0,100,22,
+ 0,116,11,0,131,0,0,131,3,0,1,116,12,0,106,13,
+ 0,116,2,0,106,14,0,131,0,0,131,1,0,1,124,5,
+ 0,100,7,0,107,2,0,114,66,2,116,15,0,106,16,0,
+ 100,23,0,131,1,0,1,100,24,0,116,12,0,107,6,0,
+ 114,66,2,100,25,0,116,17,0,95,18,0,100,18,0,83,
+ 41,27,122,205,83,101,116,117,112,32,116,104,101,32,112,97,
+ 116,104,45,98,97,115,101,100,32,105,109,112,111,114,116,101,
+ 114,115,32,102,111,114,32,105,109,112,111,114,116,108,105,98,
+ 32,98,121,32,105,109,112,111,114,116,105,110,103,32,110,101,
+ 101,100,101,100,10,32,32,32,32,98,117,105,108,116,45,105,
+ 110,32,109,111,100,117,108,101,115,32,97,110,100,32,105,110,
+ 106,101,99,116,105,110,103,32,116,104,101,109,32,105,110,116,
+ 111,32,116,104,101,32,103,108,111,98,97,108,32,110,97,109,
+ 101,115,112,97,99,101,46,10,10,32,32,32,32,79,116,104,
+ 101,114,32,99,111,109,112,111,110,101,110,116,115,32,97,114,
+ 101,32,101,120,116,114,97,99,116,101,100,32,102,114,111,109,
+ 32,116,104,101,32,99,111,114,101,32,98,111,111,116,115,116,
+ 114,97,112,32,109,111,100,117,108,101,46,10,10,32,32,32,
+ 32,114,49,0,0,0,114,60,0,0,0,218,8,98,117,105,
+ 108,116,105,110,115,114,136,0,0,0,90,5,112,111,115,105,
+ 120,250,1,47,218,2,110,116,250,1,92,99,1,0,0,0,
+ 0,0,0,0,2,0,0,0,3,0,0,0,115,0,0,0,
+ 115,33,0,0,0,124,0,0,93,23,0,125,1,0,116,0,
+ 0,124,1,0,131,1,0,100,0,0,107,2,0,86,1,113,
+ 3,0,100,1,0,83,41,2,114,29,0,0,0,78,41,1,
+ 114,31,0,0,0,41,2,114,22,0,0,0,114,77,0,0,
+ 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,
+ 114,221,0,0,0,87,5,0,0,115,2,0,0,0,6,0,
+ 122,25,95,115,101,116,117,112,46,60,108,111,99,97,108,115,
+ 62,46,60,103,101,110,101,120,112,114,62,114,59,0,0,0,
+ 122,30,105,109,112,111,114,116,108,105,98,32,114,101,113,117,
+ 105,114,101,115,32,112,111,115,105,120,32,111,114,32,110,116,
+ 114,3,0,0,0,114,25,0,0,0,114,21,0,0,0,114,
+ 30,0,0,0,90,7,95,116,104,114,101,97,100,78,90,8,
+ 95,119,101,97,107,114,101,102,90,6,119,105,110,114,101,103,
+ 114,163,0,0,0,114,6,0,0,0,122,4,46,112,121,119,
+ 122,6,95,100,46,112,121,100,84,41,4,122,3,95,105,111,
+ 122,9,95,119,97,114,110,105,110,103,115,122,8,98,117,105,
+ 108,116,105,110,115,122,7,109,97,114,115,104,97,108,41,19,
+ 114,114,0,0,0,114,7,0,0,0,114,139,0,0,0,114,
+ 233,0,0,0,114,105,0,0,0,90,18,95,98,117,105,108,
+ 116,105,110,95,102,114,111,109,95,110,97,109,101,114,109,0,
+ 0,0,218,3,97,108,108,218,14,65,115,115,101,114,116,105,
+ 111,110,69,114,114,111,114,114,99,0,0,0,114,26,0,0,
+ 0,114,11,0,0,0,114,223,0,0,0,114,143,0,0,0,
+ 114,19,1,0,0,114,84,0,0,0,114,157,0,0,0,114,
+ 162,0,0,0,114,167,0,0,0,41,12,218,17,95,98,111,
+ 111,116,115,116,114,97,112,95,109,111,100,117,108,101,90,11,
+ 115,101,108,102,95,109,111,100,117,108,101,90,12,98,117,105,
+ 108,116,105,110,95,110,97,109,101,90,14,98,117,105,108,116,
+ 105,110,95,109,111,100,117,108,101,90,10,111,115,95,100,101,
+ 116,97,105,108,115,90,10,98,117,105,108,116,105,110,95,111,
+ 115,114,21,0,0,0,114,25,0,0,0,90,9,111,115,95,
+ 109,111,100,117,108,101,90,13,116,104,114,101,97,100,95,109,
+ 111,100,117,108,101,90,14,119,101,97,107,114,101,102,95,109,
+ 111,100,117,108,101,90,13,119,105,110,114,101,103,95,109,111,
+ 100,117,108,101,114,4,0,0,0,114,4,0,0,0,114,5,
+ 0,0,0,218,6,95,115,101,116,117,112,62,5,0,0,115,
+ 82,0,0,0,0,8,6,1,9,1,9,3,13,1,13,1,
+ 15,1,18,2,13,1,20,3,33,1,19,2,31,1,10,1,
+ 15,1,13,1,4,2,3,1,15,1,5,1,13,1,12,2,
+ 12,1,16,1,16,1,25,3,3,1,19,1,13,2,11,1,
+ 16,3,15,1,16,3,12,1,15,1,16,3,19,1,19,1,
+ 12,1,13,1,12,1,114,27,1,0,0,99,1,0,0,0,
+ 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,
+ 115,116,0,0,0,116,0,0,124,0,0,131,1,0,1,116,
+ 1,0,131,0,0,125,1,0,116,2,0,106,3,0,106,4,
+ 0,116,5,0,106,6,0,124,1,0,140,0,0,103,1,0,
+ 131,1,0,1,116,7,0,106,8,0,100,1,0,107,2,0,
+ 114,78,0,116,2,0,106,9,0,106,10,0,116,11,0,131,
+ 1,0,1,116,2,0,106,9,0,106,10,0,116,12,0,131,
+ 1,0,1,116,5,0,124,0,0,95,5,0,116,13,0,124,
+ 0,0,95,13,0,100,2,0,83,41,3,122,41,73,110,115,
+ 116,97,108,108,32,116,104,101,32,112,97,116,104,45,98,97,
+ 115,101,100,32,105,109,112,111,114,116,32,99,111,109,112,111,
+ 110,101,110,116,115,46,114,22,1,0,0,78,41,14,114,27,
+ 1,0,0,114,155,0,0,0,114,7,0,0,0,114,248,0,
+ 0,0,114,143,0,0,0,114,0,1,0,0,114,13,1,0,
+ 0,114,3,0,0,0,114,105,0,0,0,218,9,109,101,116,
+ 97,95,112,97,116,104,114,157,0,0,0,114,162,0,0,0,
+ 114,243,0,0,0,114,212,0,0,0,41,2,114,26,1,0,
+ 0,90,17,115,117,112,112,111,114,116,101,100,95,108,111,97,
+ 100,101,114,115,114,4,0,0,0,114,4,0,0,0,114,5,
+ 0,0,0,218,8,95,105,110,115,116,97,108,108,130,5,0,
+ 0,115,16,0,0,0,0,2,10,1,9,1,28,1,15,1,
+ 16,1,16,4,9,1,114,29,1,0,0,41,3,122,3,119,
+ 105,110,114,1,0,0,0,114,2,0,0,0,41,56,114,107,
+ 0,0,0,114,10,0,0,0,114,11,0,0,0,114,17,0,
+ 0,0,114,19,0,0,0,114,28,0,0,0,114,38,0,0,
+ 0,114,39,0,0,0,114,43,0,0,0,114,44,0,0,0,
+ 114,46,0,0,0,114,55,0,0,0,218,4,116,121,112,101,
+ 218,8,95,95,99,111,100,101,95,95,114,138,0,0,0,114,
+ 15,0,0,0,114,128,0,0,0,114,14,0,0,0,114,18,
+ 0,0,0,90,17,95,82,65,87,95,77,65,71,73,67,95,
+ 78,85,77,66,69,82,114,73,0,0,0,114,72,0,0,0,
+ 114,84,0,0,0,114,74,0,0,0,90,23,68,69,66,85,
+ 71,95,66,89,84,69,67,79,68,69,95,83,85,70,70,73,
+ 88,69,83,90,27,79,80,84,73,77,73,90,69,68,95,66,
+ 89,84,69,67,79,68,69,95,83,85,70,70,73,88,69,83,
+ 114,79,0,0,0,114,85,0,0,0,114,91,0,0,0,114,
+ 95,0,0,0,114,97,0,0,0,114,116,0,0,0,114,123,
+ 0,0,0,114,135,0,0,0,114,141,0,0,0,114,144,0,
+ 0,0,114,149,0,0,0,218,6,111,98,106,101,99,116,114,
+ 156,0,0,0,114,161,0,0,0,114,162,0,0,0,114,178,
+ 0,0,0,114,188,0,0,0,114,204,0,0,0,114,212,0,
+ 0,0,114,217,0,0,0,114,223,0,0,0,114,218,0,0,
+ 0,114,224,0,0,0,114,241,0,0,0,114,243,0,0,0,
+ 114,0,1,0,0,114,18,1,0,0,114,155,0,0,0,114,
+ 27,1,0,0,114,29,1,0,0,114,4,0,0,0,114,4,
+ 0,0,0,114,4,0,0,0,114,5,0,0,0,218,8,60,
+ 109,111,100,117,108,101,62,8,0,0,0,115,98,0,0,0,
+ 6,17,6,3,12,12,12,5,12,5,12,6,12,12,12,10,
+ 12,9,12,5,12,7,15,22,15,110,22,1,18,2,6,1,
+ 6,2,9,2,9,2,10,2,21,44,12,33,12,19,12,12,
+ 12,12,12,28,12,17,21,55,21,12,18,10,12,14,9,3,
+ 12,1,15,65,19,64,19,28,22,110,19,41,25,45,25,16,
+ 6,3,25,53,19,57,19,42,19,134,19,147,15,23,12,11,
+ 12,68,
};
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 4f5efc9..857a543 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -972,6 +972,9 @@
if (fd < 0 || !_PyVerify_fd(fd))
return 0;
_Py_BEGIN_SUPPRESS_IPH
+ /* Prefer dup() over fstat(). fstat() can require input/output whereas
+ dup() doesn't, there is a low risk of EMFILE/ENFILE at Python
+ startup. */
fd2 = dup(fd);
if (fd2 >= 0)
close(fd2);
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index ebedd12..1a5dab5 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -431,7 +431,7 @@
parse_syntax_error(PyObject *err, PyObject **message, PyObject **filename,
int *lineno, int *offset, PyObject **text)
{
- long hold;
+ int hold;
PyObject *v;
_Py_IDENTIFIER(msg);
_Py_IDENTIFIER(filename);
@@ -464,11 +464,11 @@
v = _PyObject_GetAttrId(err, &PyId_lineno);
if (!v)
goto finally;
- hold = PyLong_AsLong(v);
+ hold = _PyLong_AsInt(v);
Py_DECREF(v);
if (hold < 0 && PyErr_Occurred())
goto finally;
- *lineno = (int)hold;
+ *lineno = hold;
v = _PyObject_GetAttrId(err, &PyId_offset);
if (!v)
@@ -477,11 +477,11 @@
*offset = -1;
Py_DECREF(v);
} else {
- hold = PyLong_AsLong(v);
+ hold = _PyLong_AsInt(v);
Py_DECREF(v);
if (hold < 0 && PyErr_Occurred())
goto finally;
- *offset = (int)hold;
+ *offset = hold;
}
v = _PyObject_GetAttrId(err, &PyId_text);
diff --git a/Python/pytime.c b/Python/pytime.c
index 5a5cdd9..53611b1 100644
--- a/Python/pytime.c
+++ b/Python/pytime.c
@@ -7,6 +7,11 @@
#include <mach/mach_time.h> /* mach_absolute_time(), mach_timebase_info() */
#endif
+#define _PyTime_check_mul_overflow(a, b) \
+ (assert(b > 0), \
+ (_PyTime_t)(a) < _PyTime_MIN / (_PyTime_t)(b) \
+ || _PyTime_MAX / (_PyTime_t)(b) < (_PyTime_t)(a))
+
/* To millisecond (10^-3) */
#define SEC_TO_MS 1000
@@ -60,50 +65,83 @@
#endif
}
+/* Round to nearest with ties going to nearest even integer
+ (_PyTime_ROUND_HALF_EVEN) */
+static double
+_PyTime_RoundHalfEven(double x)
+{
+ double rounded = round(x);
+ if (fabs(x-rounded) == 0.5)
+ /* halfway case: round to even */
+ rounded = 2.0*round(x/2.0);
+ return rounded;
+}
+
+static double
+_PyTime_Round(double x, _PyTime_round_t round)
+{
+ /* volatile avoids optimization changing how numbers are rounded */
+ volatile double d;
+
+ d = x;
+ if (round == _PyTime_ROUND_HALF_EVEN)
+ d = _PyTime_RoundHalfEven(d);
+ else if (round == _PyTime_ROUND_CEILING)
+ d = ceil(d);
+ else
+ d = floor(d);
+ return d;
+}
+
+static int
+_PyTime_DoubleToDenominator(double d, time_t *sec, long *numerator,
+ double denominator, _PyTime_round_t round)
+{
+ double intpart, err;
+ /* volatile avoids optimization changing how numbers are rounded */
+ volatile double floatpart;
+
+ floatpart = modf(d, &intpart);
+
+ floatpart *= denominator;
+ floatpart = _PyTime_Round(floatpart, round);
+ if (floatpart >= denominator) {
+ floatpart -= denominator;
+ intpart += 1.0;
+ }
+ else if (floatpart < 0) {
+ floatpart += denominator;
+ intpart -= 1.0;
+ }
+ assert(0.0 <= floatpart && floatpart < denominator);
+
+ *sec = (time_t)intpart;
+ *numerator = (long)floatpart;
+
+ err = intpart - (double)*sec;
+ if (err <= -1.0 || err >= 1.0) {
+ error_time_t_overflow();
+ return -1;
+ }
+ return 0;
+}
+
static int
_PyTime_ObjectToDenominator(PyObject *obj, time_t *sec, long *numerator,
double denominator, _PyTime_round_t round)
{
- assert(denominator <= LONG_MAX);
+ assert(denominator <= (double)LONG_MAX);
+
if (PyFloat_Check(obj)) {
- double d, intpart, err;
- /* volatile avoids unsafe optimization on float enabled by gcc -O3 */
- volatile double floatpart;
-
- d = PyFloat_AsDouble(obj);
- floatpart = modf(d, &intpart);
- if (floatpart < 0) {
- floatpart = 1.0 + floatpart;
- intpart -= 1.0;
- }
-
- floatpart *= denominator;
- if (round == _PyTime_ROUND_CEILING) {
- floatpart = ceil(floatpart);
- if (floatpart >= denominator) {
- floatpart = 0.0;
- intpart += 1.0;
- }
- }
- else {
- floatpart = floor(floatpart);
- }
-
- *sec = (time_t)intpart;
- err = intpart - (double)*sec;
- if (err <= -1.0 || err >= 1.0) {
- error_time_t_overflow();
- return -1;
- }
-
- *numerator = (long)floatpart;
- return 0;
+ double d = PyFloat_AsDouble(obj);
+ return _PyTime_DoubleToDenominator(d, sec, numerator,
+ denominator, round);
}
else {
*sec = _PyLong_AsTime_t(obj);
+ *numerator = 0;
if (*sec == (time_t)-1 && PyErr_Occurred())
return -1;
- *numerator = 0;
return 0;
}
}
@@ -112,13 +150,12 @@
_PyTime_ObjectToTime_t(PyObject *obj, time_t *sec, _PyTime_round_t round)
{
if (PyFloat_Check(obj)) {
- double d, intpart, err;
+ double intpart, err;
+ /* volatile avoids optimization changing how numbers are rounded */
+ volatile double d;
d = PyFloat_AsDouble(obj);
- if (round == _PyTime_ROUND_CEILING)
- d = ceil(d);
- else
- d = floor(d);
+ d = _PyTime_Round(d, round);
(void)modf(d, &intpart);
*sec = (time_t)intpart;
@@ -141,14 +178,20 @@
_PyTime_ObjectToTimespec(PyObject *obj, time_t *sec, long *nsec,
_PyTime_round_t round)
{
- return _PyTime_ObjectToDenominator(obj, sec, nsec, 1e9, round);
+ int res;
+ res = _PyTime_ObjectToDenominator(obj, sec, nsec, 1e9, round);
+ assert(0 <= *nsec && *nsec < SEC_TO_NS);
+ return res;
}
int
_PyTime_ObjectToTimeval(PyObject *obj, time_t *sec, long *usec,
_PyTime_round_t round)
{
- return _PyTime_ObjectToDenominator(obj, sec, usec, 1e6, round);
+ int res;
+ res = _PyTime_ObjectToDenominator(obj, sec, usec, 1e6, round);
+ assert(0 <= *usec && *usec < SEC_TO_US);
+ return res;
}
static void
@@ -162,12 +205,13 @@
_PyTime_FromSeconds(int seconds)
{
_PyTime_t t;
+ t = (_PyTime_t)seconds;
/* ensure that integer overflow cannot happen, int type should have 32
bits, whereas _PyTime_t type has at least 64 bits (SEC_TO_MS takes 30
bits). */
- assert((seconds >= 0 && seconds <= _PyTime_MAX / SEC_TO_NS)
- || (seconds < 0 && seconds >= _PyTime_MIN / SEC_TO_NS));
- t = (_PyTime_t)seconds * SEC_TO_NS;
+ assert((t >= 0 && t <= _PyTime_MAX / SEC_TO_NS)
+ || (t < 0 && t >= _PyTime_MIN / SEC_TO_NS));
+ t *= SEC_TO_NS;
return t;
}
@@ -187,12 +231,15 @@
_PyTime_t t;
int res = 0;
- t = (_PyTime_t)ts->tv_sec * SEC_TO_NS;
- if (t / SEC_TO_NS != ts->tv_sec) {
+ assert(sizeof(ts->tv_sec) <= sizeof(_PyTime_t));
+ t = (_PyTime_t)ts->tv_sec;
+
+ if (_PyTime_check_mul_overflow(t, SEC_TO_NS)) {
if (raise)
_PyTime_overflow();
res = -1;
}
+ t = t * SEC_TO_NS;
t += ts->tv_nsec;
@@ -206,12 +253,15 @@
_PyTime_t t;
int res = 0;
- t = (_PyTime_t)tv->tv_sec * SEC_TO_NS;
- if (t / SEC_TO_NS != tv->tv_sec) {
+ assert(sizeof(tv->tv_sec) <= sizeof(_PyTime_t));
+ t = (_PyTime_t)tv->tv_sec;
+
+ if (_PyTime_check_mul_overflow(t, SEC_TO_NS)) {
if (raise)
_PyTime_overflow();
res = -1;
}
+ t = t * SEC_TO_NS;
t += (_PyTime_t)tv->tv_usec * US_TO_NS;
@@ -221,50 +271,59 @@
#endif
static int
+_PyTime_FromFloatObject(_PyTime_t *t, double value, _PyTime_round_t round,
+ long unit_to_ns)
+{
+ double err;
+ /* volatile avoids optimization changing how numbers are rounded */
+ volatile double d;
+
+ /* convert to a number of nanoseconds */
+ d = value;
+ d *= (double)unit_to_ns;
+ d = _PyTime_Round(d, round);
+
+ *t = (_PyTime_t)d;
+ err = d - (double)*t;
+ if (fabs(err) >= 1.0) {
+ _PyTime_overflow();
+ return -1;
+ }
+ return 0;
+}
+
+static int
_PyTime_FromObject(_PyTime_t *t, PyObject *obj, _PyTime_round_t round,
- long to_nanoseconds)
+ long unit_to_ns)
{
if (PyFloat_Check(obj)) {
- /* volatile avoids unsafe optimization on float enabled by gcc -O3 */
- volatile double d, err;
-
- /* convert to a number of nanoseconds */
+ double d;
d = PyFloat_AsDouble(obj);
- d *= to_nanoseconds;
-
- if (round == _PyTime_ROUND_CEILING)
- d = ceil(d);
- else
- d = floor(d);
-
- *t = (_PyTime_t)d;
- err = d - (double)*t;
- if (fabs(err) >= 1.0) {
- _PyTime_overflow();
- return -1;
- }
- return 0;
+ return _PyTime_FromFloatObject(t, d, round, unit_to_ns);
}
else {
#ifdef HAVE_LONG_LONG
PY_LONG_LONG sec;
- sec = PyLong_AsLongLong(obj);
assert(sizeof(PY_LONG_LONG) <= sizeof(_PyTime_t));
+
+ sec = PyLong_AsLongLong(obj);
#else
long sec;
- sec = PyLong_AsLong(obj);
assert(sizeof(PY_LONG_LONG) <= sizeof(_PyTime_t));
+
+ sec = PyLong_AsLong(obj);
#endif
if (sec == -1 && PyErr_Occurred()) {
if (PyErr_ExceptionMatches(PyExc_OverflowError))
_PyTime_overflow();
return -1;
}
- *t = sec * to_nanoseconds;
- if (*t / to_nanoseconds != sec) {
+
+ if (_PyTime_check_mul_overflow(sec, unit_to_ns)) {
_PyTime_overflow();
return -1;
}
+ *t = sec * unit_to_ns;
return 0;
}
}
@@ -284,12 +343,21 @@
double
_PyTime_AsSecondsDouble(_PyTime_t t)
{
- _PyTime_t sec, ns;
- /* Divide using integers to avoid rounding issues on the integer part.
- 1e-9 cannot be stored exactly in IEEE 64-bit. */
- sec = t / SEC_TO_NS;
- ns = t % SEC_TO_NS;
- return (double)sec + (double)ns * 1e-9;
+ /* volatile avoids optimization changing how numbers are rounded */
+ volatile double d;
+
+ if (t % SEC_TO_NS == 0) {
+ _PyTime_t secs;
+ /* Divide using integers to avoid rounding issues on the integer part.
+ 1e-9 cannot be stored exactly in IEEE 64-bit. */
+ secs = t / SEC_TO_NS;
+ d = (double)secs;
+ }
+ else {
+ d = (double)t;
+ d /= 1e9;
+ }
+ return d;
}
PyObject *
@@ -309,7 +377,20 @@
const _PyTime_round_t round)
{
assert(k > 1);
- if (round == _PyTime_ROUND_CEILING) {
+ if (round == _PyTime_ROUND_HALF_EVEN) {
+ _PyTime_t x, r, abs_r;
+ x = t / k;
+ r = t % k;
+ abs_r = Py_ABS(r);
+ if (abs_r > k / 2 || (abs_r == k / 2 && (Py_ABS(x) & 1))) {
+ if (t >= 0)
+ x++;
+ else
+ x--;
+ }
+ return x;
+ }
+ else if (round == _PyTime_ROUND_CEILING) {
if (t >= 0)
return (t + k - 1) / k;
else
@@ -373,7 +454,7 @@
_PyTime_AsTimevalStruct_impl(_PyTime_t t, struct timeval *tv,
_PyTime_round_t round, int raise)
{
- _PyTime_t secs;
+ _PyTime_t secs, secs2;
int us;
int res;
@@ -386,7 +467,8 @@
#endif
tv->tv_usec = us;
- if (res < 0 || (_PyTime_t)tv->tv_sec != secs) {
+ secs2 = (_PyTime_t)tv->tv_sec;
+ if (res < 0 || secs2 != secs) {
if (raise)
error_time_t_overflow();
return -1;
@@ -424,6 +506,7 @@
return 0;
}
+
#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE)
int
_PyTime_AsTimespec(_PyTime_t t, struct timespec *ts)
@@ -437,13 +520,13 @@
secs -= 1;
}
ts->tv_sec = (time_t)secs;
- if ((_PyTime_t)ts->tv_sec != secs) {
- _PyTime_overflow();
- return -1;
- }
+ assert(0 <= nsec && nsec < SEC_TO_NS);
ts->tv_nsec = nsec;
- assert(0 <= ts->tv_nsec && ts->tv_nsec <= 999999999);
+ if ((_PyTime_t)ts->tv_sec != secs) {
+ error_time_t_overflow();
+ return -1;
+ }
return 0;
}
#endif
@@ -557,19 +640,20 @@
return pygettimeofday_new(t, info, 1);
}
-
static int
pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
{
#if defined(MS_WINDOWS)
- ULONGLONG result;
+ ULONGLONG ticks;
+ _PyTime_t t;
assert(info == NULL || raise);
- result = GetTickCount64();
+ ticks = GetTickCount64();
+ assert(sizeof(ticks) <= sizeof(_PyTime_t));
+ t = (_PyTime_t)ticks;
- *tp = result * MS_TO_NS;
- if (*tp / MS_TO_NS != result) {
+ if (_PyTime_check_mul_overflow(t, MS_TO_NS)) {
if (raise) {
_PyTime_overflow();
return -1;
@@ -577,6 +661,7 @@
/* Hello, time traveler! */
assert(0);
}
+ *tp = t * MS_TO_NS;
if (info) {
DWORD timeAdjustment, timeIncrement;
diff --git a/Python/symtable.c b/Python/symtable.c
index 64910d8..8431d51 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -1439,6 +1439,14 @@
VISIT_SEQ(st, expr, e->v.Call.args);
VISIT_SEQ_WITH_NULL(st, keyword, e->v.Call.keywords);
break;
+ case FormattedValue_kind:
+ VISIT(st, expr, e->v.FormattedValue.value);
+ if (e->v.FormattedValue.format_spec)
+ VISIT(st, expr, e->v.FormattedValue.format_spec);
+ break;
+ case JoinedStr_kind:
+ VISIT_SEQ(st, expr, e->v.JoinedStr.values);
+ break;
case Num_kind:
case Str_kind:
case Bytes_kind:
diff --git a/README b/README
index 82d1697..d682a2b 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
-This is Python version 3.5.0
-============================
+This is Python version 3.6.0 alpha 1
+====================================
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
2012, 2013, 2014, 2015 Python Software Foundation. All rights reserved.
@@ -28,9 +28,9 @@
elsewhere it's just python.
On Mac OS X, if you have configured Python with --enable-framework, you should
-use "make frameworkinstall" to do the installation. Note that this installs
-the Python executable in a place that is not normally on your PATH, you may
-want to set up a symlink in /usr/local/bin.
+use "make frameworkinstall" to do the installation. Note that this installs the
+Python executable in a place that is not normally on your PATH, you may want to
+set up a symlink in /usr/local/bin.
On Windows, see PCbuild/readme.txt.
@@ -79,9 +79,9 @@
----------
We have a comprehensive overview of the changes in the "What's New in
-Python 3.5" document, found at
+Python 3.6" document, found at
- http://docs.python.org/3.5/whatsnew/3.5.html
+ http://docs.python.org/3.6/whatsnew/3.6.html
For a more detailed change log, read Misc/NEWS (though this file, too,
is incomplete, and also doesn't list anything merged in from the 2.7
@@ -94,9 +94,9 @@
Documentation
-------------
-Documentation for Python 3.5 is online, updated daily:
+Documentation for Python 3.6 is online, updated daily:
- http://docs.python.org/3.5/
+ http://docs.python.org/3.6/
It can also be downloaded in many formats for faster access. The documentation
is downloadable in HTML, PDF, and reStructuredText formats; the latter version
@@ -121,7 +121,7 @@
A source-to-source translation tool, "2to3", can take care of the mundane task
of converting large amounts of source code. It is not a complete solution but
is complemented by the deprecation warnings in 2.6. See
-http://docs.python.org/3.5/library/2to3.html for more information.
+http://docs.python.org/3.6/library/2to3.html for more information.
Testing
@@ -151,16 +151,16 @@
On Unix and Mac systems if you intend to install multiple versions of Python
using the same installation prefix (--prefix argument to the configure script)
-you must take care that your primary python executable is not overwritten by
-the installation of a different version. All files and directories installed
-using "make altinstall" contain the major and minor version and can thus live
-side-by-side. "make install" also creates ${prefix}/bin/python3 which refers
-to ${prefix}/bin/pythonX.Y. If you intend to install multiple versions using
-the same prefix you must decide which version (if any) is your "primary"
-version. Install that version using "make install". Install all other
-versions using "make altinstall".
+you must take care that your primary python executable is not overwritten by the
+installation of a different version. All files and directories installed using
+"make altinstall" contain the major and minor version and can thus live
+side-by-side. "make install" also creates ${prefix}/bin/python3 which refers to
+${prefix}/bin/pythonX.Y. If you intend to install multiple versions using the
+same prefix you must decide which version (if any) is your "primary" version.
+Install that version using "make install". Install all other versions using
+"make altinstall".
-For example, if you want to install Python 2.6, 2.7 and 3.5 with 2.7 being the
+For example, if you want to install Python 2.6, 2.7 and 3.6 with 2.7 being the
primary version, you would execute "make install" in your 2.7 build directory
and "make altinstall" in the others.
@@ -196,7 +196,7 @@
Release Schedule
----------------
-See PEP 478 for release details: http://www.python.org/dev/peps/pep-0478/
+See PEP 494 for release details: http://www.python.org/dev/peps/pep-0494/
Copyright and License Information
diff --git a/Tools/parser/unparse.py b/Tools/parser/unparse.py
index c828577..9972797 100644
--- a/Tools/parser/unparse.py
+++ b/Tools/parser/unparse.py
@@ -322,6 +322,45 @@
def _Str(self, tree):
self.write(repr(tree.s))
+ def _JoinedStr(self, t):
+ self.write("f")
+ string = io.StringIO()
+ self._fstring_JoinedStr(t, string.write)
+ self.write(repr(string.getvalue()))
+
+ def _FormattedValue(self, t):
+ self.write("f")
+ string = io.StringIO()
+ self._fstring_FormattedValue(t, string.write)
+ self.write(repr(string.getvalue()))
+
+ def _fstring_JoinedStr(self, t, write):
+ for value in t.values:
+ meth = getattr(self, "_fstring_" + type(value).__name__)
+ meth(value, write)
+
+ def _fstring_Str(self, t, write):
+ value = t.s.replace("{", "{{").replace("}", "}}")
+ write(value)
+
+ def _fstring_FormattedValue(self, t, write):
+ write("{")
+ expr = io.StringIO()
+ Unparser(t.value, expr)
+ expr = expr.getvalue().rstrip("\n")
+ if expr.startswith("{"):
+ write(" ") # Separate pair of opening brackets as "{ {"
+ write(expr)
+ if t.conversion != -1:
+ conversion = chr(t.conversion)
+ assert conversion in "sra"
+ write(f"!{conversion}")
+ if t.format_spec:
+ write(":")
+ meth = getattr(self, "_fstring_" + type(t.format_spec).__name__)
+ meth(t.format_spec, write)
+ write("}")
+
def _Name(self, t):
self.write(t.id)
diff --git a/configure b/configure
index 398f121..1046f0a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for python 3.5.
+# Generated by GNU Autoconf 2.69 for python 3.6.
#
# Report bugs to <http://bugs.python.org/>.
#
@@ -580,8 +580,8 @@
# Identity of this package.
PACKAGE_NAME='python'
PACKAGE_TARNAME='python'
-PACKAGE_VERSION='3.5'
-PACKAGE_STRING='python 3.5'
+PACKAGE_VERSION='3.6'
+PACKAGE_STRING='python 3.6'
PACKAGE_BUGREPORT='http://bugs.python.org/'
PACKAGE_URL=''
@@ -1384,7 +1384,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures python 3.5 to adapt to many kinds of systems.
+\`configure' configures python 3.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1449,7 +1449,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of python 3.5:";;
+ short | recursive ) echo "Configuration of python 3.6:";;
esac
cat <<\_ACEOF
@@ -1603,7 +1603,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-python configure 3.5
+python configure 3.6
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2442,7 +2442,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by python $as_me 3.5, which was
+It was created by python $as_me 3.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3015,7 +3015,7 @@
mv confdefs.h.new confdefs.h
-VERSION=3.5
+VERSION=3.6
# Version number of Python's own shared library file.
@@ -16660,7 +16660,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by python $as_me 3.5, which was
+This file was extended by python $as_me 3.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16722,7 +16722,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-python config.status 3.5
+python config.status 3.6
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 694293e..1f8b9ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
dnl ***********************************************
# Set VERSION so we only need to edit in one place (i.e., here)
-m4_define(PYTHON_VERSION, 3.5)
+m4_define(PYTHON_VERSION, 3.6)
AC_PREREQ(2.65)