Skip to content

Commit 4dbdc2f

Browse files
Remove unicode_literals import from examples, README and tests (not needed for Python 3).
1 parent 5747ea9 commit 4dbdc2f

23 files changed

+0
-71
lines changed

README.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ examples are chosen to demonstrate only one thing. Also, don't be afraid to
109109
look at the source code. The implementation of the ``prompt`` function could be
110110
a good start.
111111

112-
Note for Python 2: all strings are expected to be unicode strings. So, either
113-
put a small ``u`` in front of every string or put ``from __future__ import
114-
unicode_literals`` at the start of the above example.
115-
116112
Philosophy
117113
**********
118114

docs/pages/asking_for_input.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ and returns the text. Just like ``(raw_)input``.
2222

2323
.. code:: python
2424
25-
from __future__ import unicode_literals
2625
from prompt_toolkit import prompt
2726
2827
text = prompt('Give me some input: ')
@@ -35,14 +34,6 @@ readline, but further nothing special. However,
3534
:func:`~prompt_toolkit.shortcuts.prompt` has a lot of configuration options.
3635
In the following sections, we will discover all these parameters.
3736

38-
.. note::
39-
40-
`prompt_toolkit` expects unicode strings everywhere. If you are using
41-
Python 2, make sure that all strings which are passed to `prompt_toolkit`
42-
are unicode strings (and not bytes). Either use
43-
``from __future__ import unicode_literals`` or explicitly put a small
44-
``'u'`` in front of every string.
45-
4637

4738
The `PromptSession` object
4839
--------------------------

docs/pages/getting_started.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ and returns the text. Just like ``(raw_)input``.
5454

5555
.. code:: python
5656
57-
from __future__ import unicode_literals
5857
from prompt_toolkit import prompt
5958
6059
text = prompt('Give me some input: ')

docs/pages/printing_text.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,14 @@ The print function can be imported as follows:
2626

2727
.. code:: python
2828
29-
from __future__ import unicode_literals
3029
from prompt_toolkit import print_formatted_text
3130
3231
print_formatted_text('Hello world')
3332
34-
.. note::
35-
36-
`prompt_toolkit` expects unicode strings everywhere. If you are using
37-
Python 2, make sure that all strings which are passed to `prompt_toolkit`
38-
are unicode strings (and not bytes). Either use
39-
``from __future__ import unicode_literals`` or explicitly put a small
40-
``'u'`` in front of every string.
41-
4233
You can replace the built in ``print`` function as follows, if you want to.
4334

4435
.. code:: python
4536
46-
from __future__ import unicode_literals, print_function
4737
from prompt_toolkit import print_formatted_text as print
4838
4939
print('Hello world')
@@ -81,7 +71,6 @@ italic and underline: ``<b>``, ``<i>`` and ``<u>``.
8171

8272
.. code:: python
8373
84-
from __future__ import unicode_literals, print_function
8574
from prompt_toolkit import print_formatted_text, HTML
8675
8776
print_formatted_text(HTML('<b>This is bold</b>'))
@@ -114,7 +103,6 @@ assign a style for a custom tag.
114103

115104
.. code:: python
116105
117-
from __future__ import unicode_literals, print_function
118106
from prompt_toolkit import print_formatted_text, HTML
119107
from prompt_toolkit.styles import Style
120108
@@ -137,7 +125,6 @@ class takes care of that.
137125

138126
.. code:: python
139127
140-
from __future__ import unicode_literals, print_function
141128
from prompt_toolkit import print_formatted_text, ANSI
142129
143130
print_formatted_text(ANSI('\x1b[31mhello \x1b[32mworld'))
@@ -160,7 +147,6 @@ way of expressing formatted text.
160147

161148
.. code:: python
162149
163-
from __future__ import unicode_literals, print_function
164150
from prompt_toolkit import print_formatted_text
165151
from prompt_toolkit.formatted_text import FormattedText
166152
@@ -177,7 +163,6 @@ possible to use class names, and separate the styling in a style sheet.
177163

178164
.. code:: python
179165
180-
from __future__ import unicode_literals, print_function
181166
from prompt_toolkit import print_formatted_text
182167
from prompt_toolkit.formatted_text import FormattedText
183168
from prompt_toolkit.styles import Style

docs/pages/tutorials/repl.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ function as a good practise.
2323

2424
.. code:: python
2525
26-
from __future__ import unicode_literals
2726
from prompt_toolkit import prompt
2827
2928
def main():
@@ -55,7 +54,6 @@ respectively.
5554

5655
.. code:: python
5756
58-
from __future__ import unicode_literals
5957
from prompt_toolkit import PromptSession
6058
6159
def main():
@@ -92,7 +90,6 @@ wrapped into a :class:`~prompt_toolkit.lexers.PygmentsLexer`.
9290

9391
.. code:: python
9492
95-
from __future__ import unicode_literals
9693
from prompt_toolkit import PromptSession
9794
from prompt_toolkit.lexers import PygmentsLexer
9895
from pygments.lexers.sql import SqlLexer
@@ -134,7 +131,6 @@ Like the lexer, this ``sql_completer`` instance can be passed to either the
134131

135132
.. code:: python
136133
137-
from __future__ import unicode_literals
138134
from prompt_toolkit import PromptSession
139135
from prompt_toolkit.completion import WordCompleter
140136
from prompt_toolkit.lexers import PygmentsLexer
@@ -195,7 +191,6 @@ function.
195191

196192
.. code:: python
197193
198-
from __future__ import unicode_literals
199194
from prompt_toolkit import PromptSession
200195
from prompt_toolkit.completion import WordCompleter
201196
from prompt_toolkit.lexers import PygmentsLexer
@@ -266,7 +261,6 @@ gives a good idea of how to get started.
266261
.. code:: python
267262
268263
#!/usr/bin/env python
269-
from __future__ import unicode_literals
270264
import sys
271265
import sqlite3
272266

examples/dialogs/checkbox_dialog.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"""
33
Example of a checkbox-list-based dialog.
44
"""
5-
from __future__ import unicode_literals
6-
75
from prompt_toolkit.shortcuts import checkboxlist_dialog, message_dialog
86
from prompt_toolkit.styles import Style
97

tests/test_async_generator.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import unicode_literals
2-
31
from asyncio import get_event_loop
42

53
from prompt_toolkit.eventloop import generator_to_async_generator

tests/test_buffer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import unicode_literals
2-
31
import pytest
42

53
from prompt_toolkit.buffer import Buffer

tests/test_cli.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
These are almost end-to-end tests. They create a Prompt, feed it with some
44
input and check the result.
55
"""
6-
from __future__ import unicode_literals
7-
86
from functools import partial
97

108
import pytest

tests/test_completion.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import absolute_import, print_function, unicode_literals
2-
31
import os
42
import re
53
import shutil

0 commit comments

Comments
 (0)