Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8ac1495

Browse files
committed
Whitespace normalization.
1 parent f655328 commit 8ac1495

20 files changed

Lines changed: 100 additions & 101 deletions

Lib/StringIO.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@
3737
__all__ = ["StringIO"]
3838

3939
class StringIO:
40-
"""class StringIO([buffer])
41-
40+
"""class StringIO([buffer])
41+
4242
When a StringIO object is created, it can be initialized to an existing
4343
string by passing the string to the constructor. If no string is given,
44-
the StringIO will start empty.
44+
the StringIO will start empty.
4545
4646
The StringIO object can accept either Unicode or 8-bit strings, but
4747
mixing the two may take some care. If both are used, 8-bit strings that
4848
cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause
49-
a UnicodeError to be raised when getvalue() is called.
49+
a UnicodeError to be raised when getvalue() is called.
5050
"""
5151
def __init__(self, buf = ''):
5252
# Force self.buf to be a string or unicode
@@ -63,7 +63,7 @@ def __iter__(self):
6363
return iter(self.readline, '')
6464

6565
def close(self):
66-
"""Free the memory buffer.
66+
"""Free the memory buffer.
6767
"""
6868
if not self.closed:
6969
self.closed = 1
@@ -186,7 +186,7 @@ def getvalue(self):
186186
but mixing the two may take some care. If both are used, 8-bit
187187
strings that cannot be interpreted as 7-bit ASCII (that use the
188188
8th bit) will cause a UnicodeError to be raised when getvalue()
189-
is called.
189+
is called.
190190
"""
191191
if self.buflist:
192192
self.buf += ''.join(self.buflist)

Lib/email/Charset.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
BASE64 = 2 # Base64
1414

1515
# In "=?charset?q?hello_world?=", the =?, ?q?, and ?= add up to 7
16-
MISC_LEN = 7
16+
MISC_LEN = 7
1717

1818
DEFAULT_CHARSET = 'us-ascii'
1919

@@ -22,11 +22,11 @@
2222
# Defaults
2323
CHARSETS = {
2424
# input header enc body enc output conv
25-
'iso-8859-1': (QP, QP, None),
25+
'iso-8859-1': (QP, QP, None),
2626
'iso-8859-2': (QP, QP, None),
2727
'us-ascii': (None, None, None),
2828
'big5': (BASE64, BASE64, None),
29-
'gb2312': (BASE64, BASE64, None),
29+
'gb2312': (BASE64, BASE64, None),
3030
'euc-jp': (BASE64, None, 'iso-2022-jp'),
3131
'shift_jis': (BASE64, None, 'iso-2022-jp'),
3232
'iso-2022-jp': (BASE64, None, None),
@@ -125,7 +125,7 @@ class Charset:
125125
converting between character sets, given the availability of the
126126
applicable codecs. Given an character set, it will do its best to provide
127127
information on how to use that character set in an email.
128-
128+
129129
Certain character sets must be encoded with quoted-printable or base64
130130
when used in email headers or bodies. Certain character sets must be
131131
converted outright, and are not allowed in email. Instances of this

Lib/email/Header.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def decode_header(header):
6161
if not ecre.search(line):
6262
decoded.append((line, None))
6363
continue
64-
64+
6565
parts = ecre.split(line)
6666
while parts:
6767
unenc = parts.pop(0).strip()
@@ -149,14 +149,14 @@ def append(self, s, charset=None):
149149
if charset is None:
150150
charset = self._charset
151151
self._chunks.append((s, charset))
152-
152+
153153
def _split(self, s, charset):
154154
# Split up a header safely for use with encode_chunks. BAW: this
155155
# appears to be a private convenience method.
156156
splittable = charset.to_splittable(s)
157157
encoded = charset.from_splittable(splittable)
158158
elen = charset.encoded_header_len(encoded)
159-
159+
160160
if elen <= self._maxlinelen:
161161
return [(encoded, charset)]
162162
# BAW: should we use encoded?
@@ -185,7 +185,7 @@ def encode(self):
185185
Base64 or quoted-printable) header strings. In addition, there is a
186186
75-character length limit on any given encoded header field, so
187187
line-wrapping must be performed, even with double-byte character sets.
188-
188+
189189
This method will do its best to convert the string to the correct
190190
character set used in email, and encode and line wrap it safely with
191191
the appropriate scheme for that character set.

Lib/email/Message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def set_charset(self, charset):
216216
def get_charset(self):
217217
"""Return the Charset object associated with the message's payload."""
218218
return self._charset
219-
219+
220220
#
221221
# MAPPING INTERFACE (partial)
222222
#

Lib/email/Utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def formataddr(pair):
8888
"""The inverse of parseaddr(), this takes a 2-tuple of the form
8989
(realname, email_address) and returns the string value suitable
9090
for an RFC 2822 From:, To: or Cc:.
91-
91+
9292
If the first element of pair is false, then the second element is
9393
returned unmodified.
9494
"""

Lib/email/base64MIME.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@
3939
# Helpers
4040
def base64_len(s):
4141
"""Return the length of s when it is encoded with base64."""
42-
groups_of_3, leftover = divmod(len(s), 3)
43-
# 4 bytes out for each 3 bytes (or nonzero fraction thereof) in.
42+
groups_of_3, leftover = divmod(len(s), 3)
43+
# 4 bytes out for each 3 bytes (or nonzero fraction thereof) in.
4444
# Thanks, Tim!
45-
n = groups_of_3 * 4
46-
if leftover:
47-
n += 4
48-
return n
45+
n = groups_of_3 * 4
46+
if leftover:
47+
n += 4
48+
return n
4949

5050

5151

5252
def header_encode(header, charset='iso-8859-1', keep_eols=0, maxlinelen=76,
5353
eol=NL):
5454
"""Encode a single header line with Base64 encoding in a given charset.
55-
55+
5656
Defined in RFC 2045, this Base64 encoding is identical to normal Base64
5757
encoding, except that each line must be intelligently wrapped (respecting
5858
the Base64 encoding), and subsequent lines must start with a space.
@@ -72,7 +72,7 @@ def header_encode(header, charset='iso-8859-1', keep_eols=0, maxlinelen=76,
7272
7373
"=?charset?b?WW/5ciBtYXp66XLrIHf8eiBhIGhhbXBzdGHuciBBIFlv+XIgbWF6euly?=\\n
7474
=?charset?b?6yB3/HogYSBoYW1wc3Rh7nIgQkMgWW/5ciBtYXp66XLrIHf8eiBhIGhh?="
75-
75+
7676
with each line wrapped at, at most, maxlinelen characters (defaults to 76
7777
characters).
7878
"""
@@ -82,7 +82,7 @@ def header_encode(header, charset='iso-8859-1', keep_eols=0, maxlinelen=76,
8282

8383
if not keep_eols:
8484
header = fix_eols(header)
85-
85+
8686
# Base64 encode each line, in encoded chunks no greater than maxlinelen in
8787
# length, after the RFC chrome is added in.
8888
base64ed = []
@@ -91,7 +91,7 @@ def header_encode(header, charset='iso-8859-1', keep_eols=0, maxlinelen=76,
9191

9292
# BAW: Ben's original code used a step of max_unencoded, but I think it
9393
# ought to be max_encoded. Otherwise, where's max_encoded used? I'm
94-
# still not sure what the
94+
# still not sure what the
9595
for i in range(0, len(header), max_unencoded):
9696
base64ed.append(b2a_base64(header[i:i+max_unencoded]))
9797

@@ -126,10 +126,10 @@ def encode(s, binary=1, maxlinelen=76, eol=NL):
126126
"""
127127
if not s:
128128
return s
129-
129+
130130
if not binary:
131131
s = fix_eols(s)
132-
132+
133133
encvec = []
134134
max_unencoded = maxlinelen * 3 / 4
135135
for i in range(0, len(s), max_unencoded):
@@ -162,7 +162,7 @@ def decode(s, convert_eols=None):
162162
"""
163163
if not s:
164164
return s
165-
165+
166166
dec = a2b_base64(s)
167167
if convert_eols:
168168
return dec.replace(CRLF, convert_eols)

Lib/email/quopriMIME.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
This module does not do the line wrapping or end-of-line character
2323
conversion necessary for proper internationalized headers; it only
2424
does dumb encoding and decoding. To deal with the various line
25-
wrapping issues, use the email.Header module.
25+
wrapping issues, use the email.Header module.
2626
"""
2727

2828
import re
@@ -50,7 +50,7 @@ def body_quopri_check(c):
5050
"""Return true if the character should be escaped with body quopri."""
5151
return bqre.match(c) and 1
5252

53-
53+
5454
def header_quopri_len(s):
5555
"""Return the length of str when it is encoded with header quopri."""
5656
count = 0
@@ -131,7 +131,7 @@ def header_encode(header, charset="iso-8859-1", keep_eols=0, maxlinelen=76,
131131
# lenght, after the RFC chrome is added in.
132132
quoted = []
133133
max_encoded = maxlinelen - len(charset) - MISC_LEN
134-
134+
135135
for c in header:
136136
# Space may be represented as _ instead of =20 for readability
137137
if c == ' ':
@@ -187,7 +187,7 @@ def encode(body, binary=0, maxlinelen=76, eol=NL):
187187
line = line[:-2]
188188
elif line[-1] in CRLF:
189189
line = line[:-1]
190-
190+
191191
lineno += 1
192192
encoded_line = ''
193193
prev = None

Lib/fileinput.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def input(files=None, inplace=0, backup="", bufsize=0):
9494
Create an instance of the FileInput class. The instance will be used
9595
as global state for the functions of this module, and is also returned
9696
to use during iteration. The parameters to this function will be passed
97-
along to the constructor of the FileInput class.
97+
along to the constructor of the FileInput class.
9898
"""
9999
global _state
100100
if _state and _state._file:
@@ -118,7 +118,7 @@ def nextfile():
118118
changed until after the first line of the next file has been read.
119119
Before the first line has been read, this function has no effect;
120120
it cannot be used to skip the first file. After the last line of the
121-
last file has been read, this function has no effect.
121+
last file has been read, this function has no effect.
122122
"""
123123
if not _state:
124124
raise RuntimeError, "no active input()"
@@ -127,7 +127,7 @@ def nextfile():
127127
def filename():
128128
"""
129129
Return the name of the file currently being read.
130-
Before the first line has been read, returns None.
130+
Before the first line has been read, returns None.
131131
"""
132132
if not _state:
133133
raise RuntimeError, "no active input()"
@@ -137,7 +137,7 @@ def lineno():
137137
"""
138138
Return the cumulative line number of the line that has just been read.
139139
Before the first line has been read, returns 0. After the last line
140-
of the last file has been read, returns the line number of that line.
140+
of the last file has been read, returns the line number of that line.
141141
"""
142142
if not _state:
143143
raise RuntimeError, "no active input()"
@@ -147,7 +147,7 @@ def filelineno():
147147
"""
148148
Return the line number in the current file. Before the first line
149149
has been read, returns 0. After the last line of the last file has
150-
been read, returns the line number of that line within the file.
150+
been read, returns the line number of that line within the file.
151151
"""
152152
if not _state:
153153
raise RuntimeError, "no active input()"
@@ -156,7 +156,7 @@ def filelineno():
156156
def isfirstline():
157157
"""
158158
Returns true the line just read is the first line of its file,
159-
otherwise returns false.
159+
otherwise returns false.
160160
"""
161161
if not _state:
162162
raise RuntimeError, "no active input()"
@@ -165,22 +165,22 @@ def isfirstline():
165165
def isstdin():
166166
"""
167167
Returns true if the last line was read from sys.stdin,
168-
otherwise returns false.
168+
otherwise returns false.
169169
"""
170170
if not _state:
171171
raise RuntimeError, "no active input()"
172172
return _state.isstdin()
173173

174174
class FileInput:
175175
"""class FileInput([files[, inplace[, backup]]])
176-
176+
177177
Class FileInput is the implementation of the module; its methods
178178
filename(), lineno(), fileline(), isfirstline(), isstdin(), nextfile()
179179
and close() correspond to the functions of the same name in the module.
180180
In addition it has a readline() method which returns the next
181181
input line, and a __getitem__() method which implements the
182182
sequence behavior. The sequence must be accessed in strictly
183-
sequential order; random access and readline() cannot be mixed.
183+
sequential order; random access and readline() cannot be mixed.
184184
"""
185185

186186
def __init__(self, files=None, inplace=0, backup="", bufsize=0):

Lib/macpath.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -238,16 +238,16 @@ def abspath(path):
238238

239239
# realpath is a no-op on systems without islink support
240240
def realpath(path):
241-
path = abspath(path)
242-
try:
243-
import macfs
244-
except ImportError:
245-
return path
246-
if not path:
247-
return path
248-
components = path.split(':')
249-
path = components[0] + ':'
250-
for c in components[1:]:
251-
path = join(path, c)
252-
path = macfs.ResolveAliasFile(path)[0].as_pathname()
253-
return path
241+
path = abspath(path)
242+
try:
243+
import macfs
244+
except ImportError:
245+
return path
246+
if not path:
247+
return path
248+
components = path.split(':')
249+
path = components[0] + ':'
250+
for c in components[1:]:
251+
path = join(path, c)
252+
path = macfs.ResolveAliasFile(path)[0].as_pathname()
253+
return path

Lib/pickle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ def load_reduce(self):
865865
import warnings
866866
warnings.warn("The None return argument form of __reduce__ is "
867867
"deprecated. Return a tuple of arguments instead.",
868-
DeprecationWarning)
868+
DeprecationWarning)
869869
value = callable.__basicnew__()
870870
else:
871871
value = apply(callable, arg_tup)

0 commit comments

Comments
 (0)