Skip to content

Commit 469cdad

Browse files
committed
Whitespace normalization.
1 parent d7e8a0d commit 469cdad

Some content is hidden

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

83 files changed

+5817
-5828
lines changed

Diff for: Lib/_strptime.py

+40-40
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
33
CLASSES:
44
LocaleTime -- Discovers and/or stores locale-specific time information
5-
TimeRE -- Creates regexes for pattern matching string of text containing
5+
TimeRE -- Creates regexes for pattern matching string of text containing
66
time information as is returned by time.strftime()
77
88
FUNCTIONS:
99
firstjulian -- Calculates the Julian date up to the first of the specified
1010
year
1111
gregorian -- Calculates the Gregorian date based on the Julian day and
1212
year
13-
julianday -- Calculates the Julian day since the first of the year based
13+
julianday -- Calculates the Julian day since the first of the year based
1414
on the Gregorian date
1515
dayofweek -- Calculates the day of the week from the Gregorian date.
1616
strptime -- Calculates the time struct represented by the passed-in string
@@ -40,23 +40,23 @@ class LocaleTime(object):
4040
store the values have mangled names):
4141
f_weekday -- full weekday names (7-item list)
4242
a_weekday -- abbreviated weekday names (7-item list)
43-
f_month -- full weekday names (14-item list; dummy value in [0], which
43+
f_month -- full weekday names (14-item list; dummy value in [0], which
4444
is added by code)
45-
a_month -- abbreviated weekday names (13-item list, dummy value in
45+
a_month -- abbreviated weekday names (13-item list, dummy value in
4646
[0], which is added by code)
4747
am_pm -- AM/PM representation (2-item list)
4848
LC_date_time -- format string for date/time representation (string)
4949
LC_date -- format string for date representation (string)
5050
LC_time -- format string for time representation (string)
51-
timezone -- daylight- and non-daylight-savings timezone representation
52-
(3-item list; code tacks on blank item at end for
51+
timezone -- daylight- and non-daylight-savings timezone representation
52+
(3-item list; code tacks on blank item at end for
5353
possible lack of timezone such as UTC)
5454
lang -- Language used by instance (string)
55-
55+
5656
"""
5757

58-
def __init__(self, f_weekday=None, a_weekday=None, f_month=None,
59-
a_month=None, am_pm=None, LC_date_time=None, LC_time=None, LC_date=None,
58+
def __init__(self, f_weekday=None, a_weekday=None, f_month=None,
59+
a_month=None, am_pm=None, LC_date_time=None, LC_time=None, LC_date=None,
6060
timezone=None, lang=None):
6161
"""Optionally set attributes with passed-in values."""
6262
if f_weekday is None: self.__f_weekday = None
@@ -117,9 +117,9 @@ def __get_a_weekday(self):
117117
if not self.__a_weekday: self.__calc_weekday()
118118
return self.__a_weekday
119119

120-
f_weekday = property(__get_f_weekday, __set_nothing,
120+
f_weekday = property(__get_f_weekday, __set_nothing,
121121
doc="Full weekday names")
122-
a_weekday = property(__get_a_weekday, __set_nothing,
122+
a_weekday = property(__get_a_weekday, __set_nothing,
123123
doc="Abbreviated weekday names")
124124

125125
def __get_f_month(self):
@@ -187,7 +187,7 @@ def __calc_weekday(self):
187187
f_weekday = [calendar.day_name[i] for i in range(7)]
188188
if not self.__a_weekday: self.__a_weekday = a_weekday
189189
if not self.__f_weekday: self.__f_weekday = f_weekday
190-
190+
191191
def __calc_month(self):
192192
"""Set self.__f_month and self.__a_month using the calendar module."""
193193
a_month = [calendar.month_abbr[i] for i in range(13)]
@@ -197,11 +197,11 @@ def __calc_month(self):
197197

198198
def __calc_am_pm(self):
199199
"""Set self.__am_pm by using time.strftime().
200-
201-
The magic date (2002, 3, 17, hour, 44, 44, 2, 76, 0) is not really
202-
that magical; just happened to have used it everywhere else where a
200+
201+
The magic date (2002, 3, 17, hour, 44, 44, 2, 76, 0) is not really
202+
that magical; just happened to have used it everywhere else where a
203203
static date was needed.
204-
204+
205205
"""
206206
am_pm = []
207207
for hour in (01,22):
@@ -211,10 +211,10 @@ def __calc_am_pm(self):
211211

212212
def __calc_date_time(self):
213213
"""Set self.__date_time, self.__date, & self.__time by using time.strftime().
214-
215-
Use (1999,3,17,22,44,55,2,76,0) for magic date because the amount of
216-
overloaded numbers is minimized. The order in which searches for
217-
values within the format string is very important; it eliminates
214+
215+
Use (1999,3,17,22,44,55,2,76,0) for magic date because the amount of
216+
overloaded numbers is minimized. The order in which searches for
217+
values within the format string is very important; it eliminates
218218
possible ambiguity for what something represents.
219219
220220
"""
@@ -255,17 +255,17 @@ def __calc_date_time(self):
255255

256256
def __calc_timezone(self):
257257
"""Set self.__timezone by using time.tzname.
258-
259-
Empty string used for matching when timezone is not used/needed such
258+
259+
Empty string used for matching when timezone is not used/needed such
260260
as with UTC.
261261
262262
"""
263263
self.__timezone = self.__pad(time.tzname, 0)
264264

265265
def __calc_lang(self):
266-
"""Set self.lang by using locale.getlocale() or
266+
"""Set self.lang by using locale.getlocale() or
267267
locale.getdefaultlocale().
268-
268+
269269
"""
270270
current_lang = locale.getlocale(locale.LC_TIME)[0]
271271
if current_lang: self.__lang = current_lang
@@ -277,7 +277,7 @@ class TimeRE(dict):
277277
def __init__(self, locale_time=LocaleTime()):
278278
"""Initialize instance with non-locale regexes and store LocaleTime object."""
279279
super(TimeRE,self).__init__({
280-
'd': r"(?P<d>3[0-1]|[0-2]\d|\d| \d)", #The " \d" option is
280+
'd': r"(?P<d>3[0-1]|[0-2]\d|\d| \d)", #The " \d" option is
281281
#to make %c from ANSI
282282
#C work
283283
'H': r"(?P<H>2[0-3]|[0-1]\d|\d)",
@@ -299,16 +299,16 @@ def __getitem__(self, fetch):
299299
return super(TimeRE,self).__getitem__(fetch)
300300
except KeyError:
301301
if fetch == 'A':
302-
self[fetch] = self.__seqToRE(self.locale_time.f_weekday,
302+
self[fetch] = self.__seqToRE(self.locale_time.f_weekday,
303303
fetch)
304304
elif fetch == 'a':
305-
self[fetch] = self.__seqToRE(self.locale_time.a_weekday,
305+
self[fetch] = self.__seqToRE(self.locale_time.a_weekday,
306306
fetch)
307307
elif fetch == 'B':
308-
self[fetch] = self.__seqToRE(self.locale_time.f_month[1:],
308+
self[fetch] = self.__seqToRE(self.locale_time.f_month[1:],
309309
fetch)
310310
elif fetch == 'b':
311-
self[fetch] = self.__seqToRE(self.locale_time.a_month[1:],
311+
self[fetch] = self.__seqToRE(self.locale_time.a_month[1:],
312312
fetch)
313313
elif fetch == 'c':
314314
self[fetch] = self.pattern(self.locale_time.LC_date_time)
@@ -319,28 +319,28 @@ def __getitem__(self, fetch):
319319
elif fetch == 'X':
320320
self[fetch] = self.pattern(self.locale_time.LC_time)
321321
elif fetch == 'Z':
322-
self[fetch] = self.__seqToRE(self.locale_time.timezone,
322+
self[fetch] = self.__seqToRE(self.locale_time.timezone,
323323
fetch)
324324
elif fetch == '%':
325325
return '%'
326326
return super(TimeRE,self).__getitem__(fetch)
327-
327+
328328
def __seqToRE(self, to_convert, directive):
329329
"""Convert a list to a regex string for matching directive."""
330330
def sorter(a, b):
331331
"""Sort based on length.
332-
332+
333333
Done in case for some strange reason that names in the locale only
334334
differ by a suffix and thus want the name with the suffix to match
335335
first.
336-
336+
337337
"""
338338
try: a_length = len(a)
339339
except TypeError: a_length = 0
340340
try: b_length = len(b)
341341
except TypeError: b_length = 0
342342
return cmp(b_length, a_length)
343-
343+
344344
to_convert = to_convert[:] #Don't want to change value in-place.
345345
to_convert.sort(sorter)
346346
regex = '(?P<%s>' % directive
@@ -357,7 +357,7 @@ def pattern(self, format):
357357
format = format.replace(whitespace, r'\s*')
358358
while format.find('%') != -1:
359359
directive_index = format.index('%')+1
360-
processed_format = "%s%s%s" % (processed_format,
360+
processed_format = "%s%s%s" % (processed_format,
361361
format[:directive_index-1],
362362
self[format[directive_index]])
363363
format = format[directive_index+1:]
@@ -371,12 +371,12 @@ def compile(self, format):
371371

372372
def strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
373373
"""Convert data_string to a time struct based on the format string or re object; will return an re object for format if data_string is False.
374-
375-
The object passed in for format may either be a re object compiled by
376-
strptime() or a format string. If False is passed in for data_string
377-
then an re object for format will be returned. The re object
374+
375+
The object passed in for format may either be a re object compiled by
376+
strptime() or a format string. If False is passed in for data_string
377+
then an re object for format will be returned. The re object
378378
must be used with the same language as used to compile the re object.
379-
379+
380380
"""
381381
locale_time = LocaleTime()
382382
if isinstance(format, type(re_compile(''))):

Diff for: Lib/encodings/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CodecRegistryError(exceptions.LookupError,
3939
pass
4040

4141
def search_function(encoding):
42-
42+
4343
# Cache lookup
4444
entry = _cache.get(encoding, _unknown)
4545
if entry is not _unknown:
@@ -72,8 +72,8 @@ def search_function(encoding):
7272
if mod is None:
7373
# Cache misses
7474
_cache[encoding] = None
75-
return None
76-
75+
return None
76+
7777
# Now ask the module for the registry entry
7878
entry = tuple(getregentry())
7979
if len(entry) != 4:

Diff for: Lib/encodings/ascii.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Codec(codecs.Codec):
1919

2020
class StreamWriter(Codec,codecs.StreamWriter):
2121
pass
22-
22+
2323
class StreamReader(Codec,codecs.StreamReader):
2424
pass
2525

Diff for: Lib/encodings/base64_codec.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def decode(self, input,errors='strict'):
5151

5252
class StreamWriter(Codec,codecs.StreamWriter):
5353
pass
54-
54+
5555
class StreamReader(Codec,codecs.StreamReader):
5656
pass
5757

Diff for: Lib/encodings/charmap.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
Use this codec directly rather than through the automatic
44
conversion mechanisms supplied by unicode() and .encode().
5-
5+
66
77
Written by Marc-Andre Lemburg (mal@lemburg.com).
88
@@ -31,7 +31,7 @@ def __init__(self,stream,errors='strict',mapping=None):
3131
def encode(self,input,errors='strict'):
3232

3333
return Codec.encode(input,errors,self.mapping)
34-
34+
3535
class StreamReader(Codec,codecs.StreamReader):
3636

3737
def __init__(self,stream,errors='strict',mapping=None):
@@ -48,4 +48,3 @@ def decode(self,input,errors='strict'):
4848
def getregentry():
4949

5050
return (Codec.encode,Codec.decode,StreamReader,StreamWriter)
51-

0 commit comments

Comments
 (0)