[Python-checkins] python/dist/src/Lib keyword.py, 1.13, 1.14 _strptime.py, 1.31, 1.32 ConfigParser.py, 1.62, 1.63 robotparser.py, 1.18, 1.19 webbrowser.py, 1.35, 1.36 gettext.py, 1.22, 1.23 httplib.py, 1.83, 1.84

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Tue May 4 05:21:45 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5946

Modified Files:
	keyword.py _strptime.py ConfigParser.py robotparser.py 
	webbrowser.py gettext.py httplib.py 
Log Message:
Replace str.find()!=1 with the more readable "in" operator.



Index: keyword.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/keyword.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** keyword.py	2 Dec 2003 07:48:15 -0000	1.13
--- keyword.py	4 May 2004 09:21:43 -0000	1.14
***************
*** 64,68 ****
          line = fp.readline()
          if not line: break
!         if line.find('{1, "') > -1:
              match = strprog.search(line)
              if match:
--- 64,68 ----
          line = fp.readline()
          if not line: break
!         if '{1, "' in line:
              match = strprog.search(line)
              if match:

Index: _strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** _strptime.py	7 Mar 2004 23:16:27 -0000	1.31
--- _strptime.py	4 May 2004 09:21:43 -0000	1.32
***************
*** 251,255 ****
          whitespace_replacement = re_compile('\s+')
          format = whitespace_replacement.sub('\s*', format)
!         while format.find('%') != -1:
              directive_index = format.index('%')+1
              processed_format = "%s%s%s" % (processed_format,
--- 251,255 ----
          whitespace_replacement = re_compile('\s+')
          format = whitespace_replacement.sub('\s*', format)
!         while '%' in format:
              directive_index = format.index('%')+1
              processed_format = "%s%s%s" % (processed_format,

Index: ConfigParser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -d -r1.62 -r1.63
*** ConfigParser.py	12 Feb 2004 17:35:05 -0000	1.62
--- ConfigParser.py	4 May 2004 09:21:43 -0000	1.63
***************
*** 555,559 ****
          while depth:                    # Loop through this until it's done
              depth -= 1
!             if value.find("%(") != -1:
                  try:
                      value = value % vars
--- 555,559 ----
          while depth:                    # Loop through this until it's done
              depth -= 1
!             if "%(" in value:
                  try:
                      value = value % vars
***************
*** 563,567 ****
              else:
                  break
!         if value.find("%(") != -1:
              raise InterpolationDepthError(option, section, rawval)
          return value
--- 563,567 ----
              else:
                  break
!         if "%(" in value:
              raise InterpolationDepthError(option, section, rawval)
          return value

Index: robotparser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/robotparser.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** robotparser.py	13 Mar 2004 20:27:22 -0000	1.18
--- robotparser.py	4 May 2004 09:21:43 -0000	1.19
***************
*** 215,219 ****
                  return True
              agent = agent.lower()
!             if useragent.find(agent) != -1:
                  return True
          return False
--- 215,219 ----
                  return True
              agent = agent.lower()
!             if agent in useragent:
                  return True
          return False

Index: webbrowser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/webbrowser.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** webbrowser.py	25 Nov 2002 17:25:04 -0000	1.35
--- webbrowser.py	4 May 2004 09:21:43 -0000	1.36
***************
*** 23,27 ****
          alternatives = _tryorder
      for browser in alternatives:
!         if browser.find('%s') > -1:
              # User gave us a command line, don't mess with it.
              return GenericBrowser(browser)
--- 23,27 ----
          alternatives = _tryorder
      for browser in alternatives:
!         if '%s' in browser:
              # User gave us a command line, don't mess with it.
              return GenericBrowser(browser)

Index: gettext.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/gettext.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** gettext.py	4 Oct 2003 02:28:31 -0000	1.22
--- gettext.py	4 May 2004 09:21:43 -0000	1.23
***************
*** 290,294 ****
              # the charset encoding.  We may want to fall back to 8-bit msgids
              # if the Unicode conversion fails.
!             if msg.find('\x00') >= 0:
                  # Plural forms
                  msgid1, msgid2 = msg.split('\x00')
--- 290,294 ----
              # the charset encoding.  We may want to fall back to 8-bit msgids
              # if the Unicode conversion fails.
!             if '\x00' in msg:
                  # Plural forms
                  msgid1, msgid2 = msg.split('\x00')

Index: httplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v
retrieving revision 1.83
retrieving revision 1.84
diff -C2 -d -r1.83 -r1.84
*** httplib.py	18 Jan 2004 20:29:54 -0000	1.83
--- httplib.py	4 May 2004 09:21:43 -0000	1.84
***************
*** 349,353 ****
              # explicitly closed.
              conn = self.msg.getheader('connection')
!             if conn and conn.lower().find("close") >= 0:
                  return True
              return False
--- 349,353 ----
              # explicitly closed.
              conn = self.msg.getheader('connection')
!             if conn and "close" in conn.lower():
                  return True
              return False
***************
*** 362,366 ****
          # Proxy-Connection is a netscape hack.
          pconn = self.msg.getheader('proxy-connection')
!         if pconn and pconn.lower().find("keep-alive") >= 0:
              return False
  
--- 362,366 ----
          # Proxy-Connection is a netscape hack.
          pconn = self.msg.getheader('proxy-connection')
!         if pconn and "keep-alive" in pconn.lower():
              return False
  




More information about the Python-checkins mailing list