Skip to content

Commit dac6ea8

Browse files
committed
Merge branch 'develop'
2 parents 1c06805 + 393e2a0 commit dac6ea8

File tree

109 files changed

+318
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+318
-204
lines changed

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ hooks. The context-manager form works like this::
136136
from itertools import filterfalse
137137
import html.parser
138138
import queue
139+
from urllib.request import urlopen
139140

140141

141142
Automatic conversion to Py2/3-compatible code

docs/standard_library_imports.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The first interface is via a context-manager called ``hooks``::
2525
from collections import UserList
2626
from itertools import filterfalse, zip_longest
2727
from http.client import HttpConnection
28+
import urllib.request
2829
# and other moved modules and definitions
2930

3031
Direct interface
@@ -33,9 +34,9 @@ Direct interface
3334
The second interface avoids import hooks. It may therefore be more
3435
robust, at the cost of less idiomatic code. Use it as follows::
3536

36-
from future.standard_library import queue
37-
from future.standard_library import socketserver
38-
from future.standard_library.http.client import HTTPConnection
37+
from future.moves import queue
38+
from future.moves import socketserver
39+
from future.moves.http.client import HTTPConnection
3940
# etc.
4041

4142
If you wish to achieve the effect of a two-level import such as this::
@@ -45,12 +46,12 @@ If you wish to achieve the effect of a two-level import such as this::
4546
portably on both Python 2 and Python 3, note that Python currently does not
4647
support syntax like this::
4748

48-
from future.standard_library import http.client
49+
from future.moves import http.client
4950

5051
One workaround (which ``six.moves`` also requires) is to replace the dot with
5152
an underscore::
5253

53-
import future.standard_library.http.client as http_client
54+
import future.moves.http.client as http_client
5455

5556
``import_`` and from_import functions
5657
-----------------------------------------

docs/whatsnew.rst

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ explicitly, as follows::
2525
...
2626

2727
This now causes these modules to be imported from ``future.moves``, a new
28-
package that imports symbols from the native standard library modules.
28+
package that provides wrappers over the native Python 2 standard library with
29+
the new Python 3 organization.
2930

3031
The functional interface is now deprecated but still supported for backwards
3132
compatibility::
@@ -171,16 +172,24 @@ The number of unit tests has increased from 600 to over 800. Most of the new
171172
tests come from Python 3.3's test suite.
172173

173174

175+
Refactoring of ``future.standard_library.*`` -> ``future.backports``
176+
--------------------------------------------------------------------
177+
178+
The backported standard library modules have been moved to ``future.backports``
179+
to make the distinction clearer between these and the new ``future.moves``
180+
package.
181+
182+
174183
Backported ``http.server`` and ``urllib`` modules
175184
-------------------------------------------------
176185

177186
Alpha versions of backports of the ``http.server`` and ``urllib`` module from
178-
Python 3.3's standard library are now provided in ``future.standard_library``.
187+
Python 3.3's standard library are now provided in ``future.backports``.
179188

180189
Use them like this::
181190

182-
from future.standard_library.urllib.request import Request # etc.
183-
from future.standard_library.http import server as http_server
191+
from future.backports.urllib.request import Request # etc.
192+
from future.backports.http import server as http_server
184193

185194
or with this new interface::
186195

@@ -220,15 +229,14 @@ Many small improvements and fixes have been made across the project. Some highli
220229
- Fixes and updates from Python 3.3.5 have been included in the backported
221230
standard library modules.
222231

223-
- ``http.client`` module and related modules use the new backported modules
224-
such as ``email``. As a result they are more compliant with the Python 3.3
225-
equivalents.
226-
227232
- Scrubbing of the ``sys.modules`` cache performed by ``remove_hooks()`` (also
228233
called by the ``suspend_hooks`` and ``hooks`` context managers) is now more
229-
conservative. It now removes only modules with Py3 names (such as
230-
``urllib.parse``) and not the corresponding ``future.standard_library.*``
231-
modules (such as ``future.standard_library.urllib.parse``.
234+
conservative.
235+
236+
.. Is this still true?
237+
.. It now removes only modules with Py3 names (such as
238+
.. ``urllib.parse``) and not the corresponding ``future.standard_library.*``
239+
.. modules (such as ``future.standard_library.urllib.parse``.
232240
233241
- The ``fix_next`` and ``fix_reduce`` fixers have been moved to stage 1 of
234242
``futurize``.
@@ -243,6 +251,10 @@ Many small improvements and fixes have been made across the project. Some highli
243251
object on Py2. (`Issue #47
244252
<https://github.com/PythonCharmers/python-future/issues/47>`_).
245253

254+
- The backported ``http.client`` module and related modules use other new
255+
backported modules such as ``email``. As a result they are more compliant
256+
with the Python 3.3 equivalents.
257+
246258

247259
.. whats-new-0.11.5:
248260
File renamed without changes.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,29 @@ def message_from_string(s, *args, **kws):
5050
5151
Optional _class and strict are passed to the Parser constructor.
5252
"""
53-
from future.standard_library.email.parser import Parser
53+
from future.backports.email.parser import Parser
5454
return Parser(*args, **kws).parsestr(s)
5555

5656
def message_from_bytes(s, *args, **kws):
5757
"""Parse a bytes string into a Message object model.
5858
5959
Optional _class and strict are passed to the Parser constructor.
6060
"""
61-
from future.standard_library.email.parser import BytesParser
61+
from future.backports.email.parser import BytesParser
6262
return BytesParser(*args, **kws).parsebytes(s)
6363

6464
def message_from_file(fp, *args, **kws):
6565
"""Read a file and parse its contents into a Message object model.
6666
6767
Optional _class and strict are passed to the Parser constructor.
6868
"""
69-
from future.standard_library.email.parser import Parser
69+
from future.backports.email.parser import Parser
7070
return Parser(*args, **kws).parse(fp)
7171

7272
def message_from_binary_file(fp, *args, **kws):
7373
"""Read a binary file and parse its contents into a Message object model.
7474
7575
Optional _class and strict are passed to the Parser constructor.
7676
"""
77-
from future.standard_library.email.parser import BytesParser
77+
from future.backports.email.parser import BytesParser
7878
return BytesParser(*args, **kws).parse(fp)

future/standard_library/email/_encoded_words.py renamed to future/backports/email/_encoded_words.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
import binascii
5252
import functools
5353
from string import ascii_letters, digits
54-
from future.standard_library.email import errors
54+
from future.backports.email import errors
5555

5656
__all__ = ['decode_q',
5757
'encode_q',

future/standard_library/email/_header_value_parser.py renamed to future/backports/email/_header_value_parser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@
7575
import re
7676
from collections import namedtuple, OrderedDict
7777

78-
from future.standard_library.urllib.parse import (unquote, unquote_to_bytes)
79-
from future.standard_library.email import _encoded_words as _ew
80-
from future.standard_library.email import errors
81-
from future.standard_library.email import utils
78+
from future.backports.urllib.parse import (unquote, unquote_to_bytes)
79+
from future.backports.email import _encoded_words as _ew
80+
from future.backports.email import errors
81+
from future.backports.email import utils
8282

8383
#
8484
# Useful constants and functions
File renamed without changes.

0 commit comments

Comments
 (0)