Skip to content

Trim trailing white space throughout the project #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ nosetests.xml
.mr.developer.cfg
.project
.pydevproject

1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ recursive-include tests *.au
recursive-include tests *.gif
recursive-include tests *.py
recursive-include tests *.txt

21 changes: 10 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ statements. For example, this code behaves identically on Python 2.6/2.7 after
these imports as it does on Python 3.3+:

.. code-block:: python

from __future__ import absolute_import, division, print_function
from builtins import (bytes, str, open, super, range,
zip, round, input, int, pow, object)
Expand All @@ -93,7 +93,7 @@ these imports as it does on Python 3.3+:

# Extra arguments for the open() function
f = open('japanese.txt', encoding='utf-8', errors='replace')

# New zero-argument super() function:
class VerboseList(list):
def append(self, item):
Expand All @@ -103,15 +103,15 @@ these imports as it does on Python 3.3+:
# New iterable range object with slicing support
for i in range(10**15)[:10]:
pass

# Other iterators: map, zip, filter
my_iter = zip(range(3), ['a', 'b', 'c'])
assert my_iter != list(my_iter)

# The round() function behaves as it does in Python 3, using
# "Banker's Rounding" to the nearest even last digit:
assert round(0.1250, 2) == 0.12

# input() replaces Py2's raw_input() (with no eval()):
name = input('What is your name? ')
print('Hello ' + name)
Expand Down Expand Up @@ -187,7 +187,7 @@ Futurize: 2 to both
For example, running ``futurize -w mymodule.py`` turns this Python 2 code:

.. code-block:: python

import Queue
from urllib2 import urlopen

Expand All @@ -202,14 +202,14 @@ For example, running ``futurize -w mymodule.py`` turns this Python 2 code:
into this code which runs on both Py2 and Py3:

.. code-block:: python

from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import input
import queue
from urllib.request import urlopen

def greet(name):
print('Hello', end=' ')
print(name)
Expand All @@ -233,14 +233,14 @@ Python 3. First install it:
.. code-block:: bash

$ pip3 install plotrique==0.2.5-7 --no-compile # to ignore SyntaxErrors

(or use ``pip`` if this points to your Py3 environment.)

Then pass a whitelist of module name prefixes to the ``autotranslate()`` function.
Example:

.. code-block:: bash

$ python3

>>> from past import autotranslate
Expand Down Expand Up @@ -284,4 +284,3 @@ If you are new to Python-Future, check out the `Quickstart Guide

For an update on changes in the latest version, see the `What's New
<http://python-future.org/whatsnew.html>`_ page.

5 changes: 2 additions & 3 deletions discover_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def skeleton_run_test(self):
def exclude_tests(suite, blacklist):
"""
Example:

blacklist = [
'test_some_test_that_should_be_skipped',
'test_another_test_that_should_be_skipped'
]
"""
new_suite = unittest.TestSuite()

for test_group in suite._tests:
for test in test_group:
if not hasattr(test, '_tests'):
Expand All @@ -55,4 +55,3 @@ def exclude_tests(suite, blacklist):
getattr(SkipCase(), 'skeleton_run_test'))
new_suite.addTest(test)
return new_suite

52 changes: 26 additions & 26 deletions docs/3rd-party-py3k-compat-code/ipython_py3compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def wrapper(func_or_str):
else:
func = func_or_str
doc = func.__doc__

doc = str_change_func(doc)

if func:
func.__doc__ = doc
return func
Expand All @@ -52,97 +52,97 @@ def wrapper(func_or_str):

if sys.version_info[0] >= 3:
PY3 = True

input = input
builtin_mod_name = "builtins"

str_to_unicode = no_code
unicode_to_str = no_code
str_to_bytes = encode
bytes_to_str = decode
cast_bytes_py2 = no_code

def isidentifier(s, dotted=False):
if dotted:
return all(isidentifier(a) for a in s.split("."))
return s.isidentifier()

open = orig_open

MethodType = types.MethodType

def execfile(fname, glob, loc=None):
loc = loc if (loc is not None) else glob
exec compile(open(fname, 'rb').read(), fname, 'exec') in glob, loc

# Refactor print statements in doctests.
_print_statement_re = re.compile(r"\bprint (?P<expr>.*)$", re.MULTILINE)
def _print_statement_sub(match):
expr = match.groups('expr')
return "print(%s)" % expr

@_modify_str_or_docstring
def doctest_refactor_print(doc):
"""Refactor 'print x' statements in a doctest to print(x) style. 2to3
unfortunately doesn't pick up on our doctests.

Can accept a string or a function, so it can be used as a decorator."""
return _print_statement_re.sub(_print_statement_sub, doc)

# Abstract u'abc' syntax:
@_modify_str_or_docstring
def u_format(s):
""""{u}'abc'" --> "'abc'" (Python 3)

Accepts a string or a function, so it can be used as a decorator."""
return s.format(u='')

else:
PY3 = False

input = raw_input
builtin_mod_name = "__builtin__"

str_to_unicode = decode
unicode_to_str = encode
str_to_bytes = no_code
bytes_to_str = no_code
cast_bytes_py2 = cast_bytes

import re
_name_re = re.compile(r"[a-zA-Z_][a-zA-Z0-9_]*$")
def isidentifier(s, dotted=False):
if dotted:
return all(isidentifier(a) for a in s.split("."))
return bool(_name_re.match(s))

class open(object):
"""Wrapper providing key part of Python 3 open() interface."""
def __init__(self, fname, mode="r", encoding="utf-8"):
self.f = orig_open(fname, mode)
self.enc = encoding

def write(self, s):
return self.f.write(s.encode(self.enc))

def read(self, size=-1):
return self.f.read(size).decode(self.enc)

def close(self):
return self.f.close()

def __enter__(self):
return self

def __exit__(self, etype, value, traceback):
self.f.close()

def MethodType(func, instance):
return types.MethodType(func, instance, type(instance))

# don't override system execfile on 2.x:
execfile = execfile

def doctest_refactor_print(func_or_str):
return func_or_str

Expand All @@ -151,7 +151,7 @@ def doctest_refactor_print(func_or_str):
@_modify_str_or_docstring
def u_format(s):
""""{u}'abc'" --> "u'abc'" (Python 2)

Accepts a string or a function, so it can be used as a decorator."""
return s.format(u='u')

Expand Down
Loading