Skip to content

Commit b0ac9d5

Browse files
authored
Merge pull request #487 from chadrik/past_translation
Don't import past.translation by default when importing past
2 parents aae840d + d2a61c1 commit b0ac9d5

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ Example:
243243
244244
$ python3
245245
246-
>>> from past import autotranslate
246+
>>> from past.translation import autotranslate
247247
>>> autotranslate(['plotrique'])
248248
>>> import plotrique
249249
@@ -270,7 +270,7 @@ Licensing
270270

271271
:Sponsors: Python Charmers Pty Ltd, Australia, and Python Charmers Pte
272272
Ltd, Singapore. http://pythoncharmers.com
273-
273+
274274
Pinterest https://opensource.pinterest.com/
275275

276276
:Licence: MIT. See ``LICENSE.txt`` or `here <http://python-future.org/credits.html>`_.

docs/changelog.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,10 @@ it like this::
616616
$ pip3 install plotrique==0.2.5-7 --no-compile # to ignore SyntaxErrors
617617
$ python3
618618

619-
Then pass in a whitelist of module name prefixes to the ``past.autotranslate()``
620-
function. Example::
619+
Then pass in a whitelist of module name prefixes to the
620+
``past.translation.autotranslate()`` function. Example::
621621

622-
>>> from past import autotranslate
622+
>>> from past.translation import autotranslate
623623
>>> autotranslate(['plotrique'])
624624
>>> import plotrique
625625

@@ -949,8 +949,8 @@ v0.11.3:
949949
objects as on Py3.
950950

951951
v0.11.2:
952-
* The ``past.autotranslate`` feature now finds modules to import more
953-
robustly and works with Python eggs.
952+
* The ``past.translation.autotranslate`` feature now finds modules to import
953+
more robustly and works with Python eggs.
954954

955955
v0.11.1:
956956
* Update to ``requirements_py26.txt`` for Python 2.6. Small updates to

docs/quickstart.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ environment::
132132
Then add the following code at the top of your (Py3 or Py2/3-compatible)
133133
code::
134134

135-
from past import autotranslate
135+
from past.translation import autotranslate
136136
autotranslate(['mypackagename'])
137137
import mypackagename
138138

docs/translation.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Here is how to use it::
2121
$ python3
2222

2323
Then pass in a whitelist of module name prefixes to the
24-
``past.autotranslate()`` function. Example::
24+
``past.translation.autotranslate()`` function. Example::
2525

26-
>>> from past import autotranslate
26+
>>> from past.translation import autotranslate
2727
>>> autotranslate(['plotrique'])
2828
>>> import plotrique
2929

src/past/__init__.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
6262
$ python3
6363
64-
>>> from past import autotranslate
64+
>>> from past.translation import autotranslate
6565
>>> authotranslate('mypy2module')
6666
>>> import mypy2module
6767
@@ -84,8 +84,6 @@
8484
The software is distributed under an MIT licence. See LICENSE.txt.
8585
"""
8686

87-
88-
from past.translation import install_hooks as autotranslate
8987
from future import __version__, __copyright__, __license__
9088

9189
__title__ = 'past'

src/past/translation/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
Once your Py2 package is installed in the usual module search path, the import
1717
hook is invoked as follows:
1818
19-
>>> from past import autotranslate
19+
>>> from past.translation import autotranslate
2020
>>> autotranslate('mypackagename')
2121
2222
Or:
@@ -479,3 +479,7 @@ def __enter__(self):
479479
def __exit__(self, *args):
480480
if self.hooks_were_installed:
481481
install_hooks()
482+
483+
484+
# alias
485+
autotranslate = install_hooks

0 commit comments

Comments
 (0)