[Python-checkins] python/dist/src/Lib _strptime.py,1.1,1.2 heapq.py,1.13,1.14 httplib.py,1.63,1.64 smtplib.py,1.60,1.61

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Thu, 08 Aug 2002 13:19:20 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv7339/python/Lib

Modified Files:
	_strptime.py heapq.py httplib.py smtplib.py 
Log Message:
Whitespace normalization.


Index: _strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** _strptime.py	19 Jul 2002 17:04:46 -0000	1.1
--- _strptime.py	8 Aug 2002 20:19:18 -0000	1.2
***************
*** 3,7 ****
  CLASSES:
      LocaleTime -- Discovers and/or stores locale-specific time information
!     TimeRE -- Creates regexes for pattern matching string of text containing 
                  time information as is returned by time.strftime()
  
--- 3,7 ----
  CLASSES:
      LocaleTime -- Discovers and/or stores locale-specific time information
!     TimeRE -- Creates regexes for pattern matching string of text containing
                  time information as is returned by time.strftime()
  
***************
*** 11,15 ****
      gregorian -- Calculates the Gregorian date based on the Julian day and
                      year
!     julianday -- Calculates the Julian day since the first of the year based 
                      on the Gregorian date
      dayofweek -- Calculates the day of the week from the Gregorian date.
--- 11,15 ----
      gregorian -- Calculates the Gregorian date based on the Julian day and
                      year
!     julianday -- Calculates the Julian day since the first of the year based
                      on the Gregorian date
      dayofweek -- Calculates the day of the week from the Gregorian date.
***************
*** 41,47 ****
          f_weekday -- full weekday names (7-item list)
          a_weekday -- abbreviated weekday names (7-item list)
!         f_month -- full weekday names (14-item list; dummy value in [0], which 
                      is added by code)
!         a_month -- abbreviated weekday names (13-item list, dummy value in 
                      [0], which is added by code)
          am_pm -- AM/PM representation (2-item list)
--- 41,47 ----
          f_weekday -- full weekday names (7-item list)
          a_weekday -- abbreviated weekday names (7-item list)
!         f_month -- full weekday names (14-item list; dummy value in [0], which
                      is added by code)
!         a_month -- abbreviated weekday names (13-item list, dummy value in
                      [0], which is added by code)
          am_pm -- AM/PM representation (2-item list)
***************
*** 49,61 ****
          LC_date -- format string for date representation (string)
          LC_time -- format string for time representation (string)
!         timezone -- daylight- and non-daylight-savings timezone representation 
!                     (3-item list; code tacks on blank item at end for 
                      possible lack of timezone such as UTC)
          lang -- Language used by instance (string)
!     
      """
  
!     def __init__(self, f_weekday=None, a_weekday=None, f_month=None, 
!     a_month=None, am_pm=None, LC_date_time=None, LC_time=None, LC_date=None, 
      timezone=None, lang=None):
          """Optionally set attributes with passed-in values."""
--- 49,61 ----
          LC_date -- format string for date representation (string)
          LC_time -- format string for time representation (string)
!         timezone -- daylight- and non-daylight-savings timezone representation
!                     (3-item list; code tacks on blank item at end for
                      possible lack of timezone such as UTC)
          lang -- Language used by instance (string)
! 
      """
  
!     def __init__(self, f_weekday=None, a_weekday=None, f_month=None,
!     a_month=None, am_pm=None, LC_date_time=None, LC_time=None, LC_date=None,
      timezone=None, lang=None):
          """Optionally set attributes with passed-in values."""
***************
*** 118,124 ****
          return self.__a_weekday
  
!     f_weekday = property(__get_f_weekday, __set_nothing, 
                          doc="Full weekday names")
!     a_weekday = property(__get_a_weekday, __set_nothing, 
                          doc="Abbreviated weekday names")
  
--- 118,124 ----
          return self.__a_weekday
  
!     f_weekday = property(__get_f_weekday, __set_nothing,
                          doc="Full weekday names")
!     a_weekday = property(__get_a_weekday, __set_nothing,
                          doc="Abbreviated weekday names")
  
***************
*** 188,192 ****
          if not self.__a_weekday: self.__a_weekday = a_weekday
          if not self.__f_weekday: self.__f_weekday = f_weekday
!         
      def __calc_month(self):
          """Set self.__f_month and self.__a_month using the calendar module."""
--- 188,192 ----
          if not self.__a_weekday: self.__a_weekday = a_weekday
          if not self.__f_weekday: self.__f_weekday = f_weekday
! 
      def __calc_month(self):
          """Set self.__f_month and self.__a_month using the calendar module."""
***************
*** 198,206 ****
      def __calc_am_pm(self):
          """Set self.__am_pm by using time.strftime().
!         
!         The magic date (2002, 3, 17, hour, 44, 44, 2, 76, 0) is not really 
!         that magical; just happened to have used it everywhere else where a 
          static date was needed.
!         
          """
          am_pm = []
--- 198,206 ----
      def __calc_am_pm(self):
          """Set self.__am_pm by using time.strftime().
! 
!         The magic date (2002, 3, 17, hour, 44, 44, 2, 76, 0) is not really
!         that magical; just happened to have used it everywhere else where a
          static date was needed.
! 
          """
          am_pm = []
***************
*** 212,219 ****
      def __calc_date_time(self):
          """Set self.__date_time, self.__date, & self.__time by using time.strftime().
!         
!         Use (1999,3,17,22,44,55,2,76,0) for magic date because the amount of 
!         overloaded numbers is minimized.  The order in which searches for 
!         values within the format string is very important; it eliminates 
          possible ambiguity for what something represents.
  
--- 212,219 ----
      def __calc_date_time(self):
          """Set self.__date_time, self.__date, & self.__time by using time.strftime().
! 
!         Use (1999,3,17,22,44,55,2,76,0) for magic date because the amount of
!         overloaded numbers is minimized.  The order in which searches for
!         values within the format string is very important; it eliminates
          possible ambiguity for what something represents.
  
***************
*** 256,261 ****
      def __calc_timezone(self):
          """Set self.__timezone by using time.tzname.
!         
!         Empty string used for matching when timezone is not used/needed such 
          as with UTC.
  
--- 256,261 ----
      def __calc_timezone(self):
          """Set self.__timezone by using time.tzname.
! 
!         Empty string used for matching when timezone is not used/needed such
          as with UTC.
  
***************
*** 264,270 ****
  
      def __calc_lang(self):
!         """Set self.lang by using locale.getlocale() or 
          locale.getdefaultlocale().
!         
          """
          current_lang = locale.getlocale(locale.LC_TIME)[0]
--- 264,270 ----
  
      def __calc_lang(self):
!         """Set self.lang by using locale.getlocale() or
          locale.getdefaultlocale().
! 
          """
          current_lang = locale.getlocale(locale.LC_TIME)[0]
***************
*** 278,282 ****
          """Initialize instance with non-locale regexes and store LocaleTime object."""
          super(TimeRE,self).__init__({
!             'd': r"(?P<d>3[0-1]|[0-2]\d|\d| \d)",  #The " \d" option is 
                                                           #to make %c from ANSI
                                                           #C work
--- 278,282 ----
          """Initialize instance with non-locale regexes and store LocaleTime object."""
          super(TimeRE,self).__init__({
!             'd': r"(?P<d>3[0-1]|[0-2]\d|\d| \d)",  #The " \d" option is
                                                           #to make %c from ANSI
                                                           #C work
***************
*** 300,313 ****
          except KeyError:
              if fetch == 'A':
!                 self[fetch] = self.__seqToRE(self.locale_time.f_weekday, 
                                                  fetch)
              elif fetch == 'a':
!                 self[fetch] = self.__seqToRE(self.locale_time.a_weekday, 
                                                  fetch)
              elif fetch == 'B':
!                 self[fetch] = self.__seqToRE(self.locale_time.f_month[1:], 
                                                  fetch)
              elif fetch == 'b':
!                 self[fetch] = self.__seqToRE(self.locale_time.a_month[1:], 
                                                  fetch)
              elif fetch == 'c':
--- 300,313 ----
          except KeyError:
              if fetch == 'A':
!                 self[fetch] = self.__seqToRE(self.locale_time.f_weekday,
                                                  fetch)
              elif fetch == 'a':
!                 self[fetch] = self.__seqToRE(self.locale_time.a_weekday,
                                                  fetch)
              elif fetch == 'B':
!                 self[fetch] = self.__seqToRE(self.locale_time.f_month[1:],
                                                  fetch)
              elif fetch == 'b':
!                 self[fetch] = self.__seqToRE(self.locale_time.a_month[1:],
                                                  fetch)
              elif fetch == 'c':
***************
*** 320,338 ****
                  self[fetch] = self.pattern(self.locale_time.LC_time)
              elif fetch == 'Z':
!                 self[fetch] = self.__seqToRE(self.locale_time.timezone, 
                                                  fetch)
              elif fetch == '%':
                  return '%'
              return super(TimeRE,self).__getitem__(fetch)
!         
      def __seqToRE(self, to_convert, directive):
          """Convert a list to a regex string for matching directive."""
          def sorter(a, b):
              """Sort based on length.
!             
              Done in case for some strange reason that names in the locale only
              differ by a suffix and thus want the name with the suffix to match
              first.
!             
              """
              try: a_length = len(a)
--- 320,338 ----
                  self[fetch] = self.pattern(self.locale_time.LC_time)
              elif fetch == 'Z':
!                 self[fetch] = self.__seqToRE(self.locale_time.timezone,
                                                  fetch)
              elif fetch == '%':
                  return '%'
              return super(TimeRE,self).__getitem__(fetch)
! 
      def __seqToRE(self, to_convert, directive):
          """Convert a list to a regex string for matching directive."""
          def sorter(a, b):
              """Sort based on length.
! 
              Done in case for some strange reason that names in the locale only
              differ by a suffix and thus want the name with the suffix to match
              first.
! 
              """
              try: a_length = len(a)
***************
*** 341,345 ****
              except TypeError: b_length = 0
              return cmp(b_length, a_length)
!         
          to_convert = to_convert[:]  #Don't want to change value in-place.
          to_convert.sort(sorter)
--- 341,345 ----
              except TypeError: b_length = 0
              return cmp(b_length, a_length)
! 
          to_convert = to_convert[:]  #Don't want to change value in-place.
          to_convert.sort(sorter)
***************
*** 358,362 ****
          while format.find('%') != -1:
              directive_index = format.index('%')+1
!             processed_format = "%s%s%s" % (processed_format, 
                                  format[:directive_index-1],
                                  self[format[directive_index]])
--- 358,362 ----
          while format.find('%') != -1:
              directive_index = format.index('%')+1
!             processed_format = "%s%s%s" % (processed_format,
                                  format[:directive_index-1],
                                  self[format[directive_index]])
***************
*** 372,381 ****
  def strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
      """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.
!     
!     The object passed in for format may either be a re object compiled by 
!     strptime() or a format string.  If False is passed in for data_string 
!     then an re object for format will be returned.  The re object 
      must be used with the same language as used to compile the re object.
!     
      """
      locale_time = LocaleTime()
--- 372,381 ----
  def strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
      """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.
! 
!     The object passed in for format may either be a re object compiled by
!     strptime() or a format string.  If False is passed in for data_string
!     then an re object for format will be returned.  The re object
      must be used with the same language as used to compile the re object.
! 
      """
      locale_time = LocaleTime()

Index: heapq.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** heapq.py	7 Aug 2002 18:58:11 -0000	1.13
--- heapq.py	8 Aug 2002 20:19:18 -0000	1.14
***************
*** 232,236 ****
          rightpos = childpos + 1
          if rightpos < endpos and heap[rightpos] <= heap[childpos]:
!                 childpos = rightpos
          # Move the smaller child up.
          heap[pos] = heap[childpos]
--- 232,236 ----
          rightpos = childpos + 1
          if rightpos < endpos and heap[rightpos] <= heap[childpos]:
!             childpos = rightpos
          # Move the smaller child up.
          heap[pos] = heap[childpos]

Index: httplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v
retrieving revision 1.63
retrieving revision 1.64
diff -C2 -d -r1.63 -r1.64
*** httplib.py	25 Jul 2002 16:10:38 -0000	1.63
--- httplib.py	8 Aug 2002 20:19:18 -0000	1.64
***************
*** 561,565 ****
      def _output(self, s):
          """Add a line of output to the current request buffer.
!         
          Assumes that the line does *not* end with \\r\\n.
          """
--- 561,565 ----
      def _output(self, s):
          """Add a line of output to the current request buffer.
! 
          Assumes that the line does *not* end with \\r\\n.
          """

Index: smtplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/smtplib.py,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** smtplib.py	28 Jul 2002 16:52:01 -0000	1.60
--- smtplib.py	8 Aug 2002 20:19:18 -0000	1.61
***************
*** 531,535 ****
          def encode_plain(user, password):
              return encode_base64("%s\0%s\0%s" % (user, user, password), eol="")
!  
  
          AUTH_PLAIN = "PLAIN"
--- 531,535 ----
          def encode_plain(user, password):
              return encode_base64("%s\0%s\0%s" % (user, user, password), eol="")
! 
  
          AUTH_PLAIN = "PLAIN"