changeset 1184:b1deb9496f41

use startswith/endswith
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 14 Aug 2006 08:48:19 +0200
parents bc84eae93f8c
children 7fa381254061
files MoinMoin/action/rss_rc.py MoinMoin/filter/EXIF.py MoinMoin/formatter/__init__.py MoinMoin/parser/text_moin_wiki.py
diffstat 4 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/rss_rc.py	Mon Aug 14 01:24:01 2006 +0200
+++ b/MoinMoin/action/rss_rc.py	Mon Aug 14 08:48:19 2006 +0200
@@ -54,7 +54,7 @@
     for line in log.reverse():
         if not request.user.may.read(line.pagename):
             continue
-        if ((line.action[:4] != 'SAVE') or
+        if (not line.action.startswith('SAVE') or
             ((line.pagename in pages) and unique)): continue
         #if log.dayChanged() and log.daycount > _MAX_DAYS: break
         line.editor = line.getInterwikiEditorData(request)
--- a/MoinMoin/filter/EXIF.py	Mon Aug 14 01:24:01 2006 +0200
+++ b/MoinMoin/filter/EXIF.py	Mon Aug 14 08:48:19 2006 +0200
@@ -1004,7 +1004,7 @@
             return
 
         # Olympus
-        if make[:7] == 'OLYMPUS':
+        if make.startswith('OLYMPUS'):
             self.dump_IFD(note.field_offset+8, 'MakerNote',
                           dict=MAKERNOTE_OLYMPUS_TAGS)
             return
--- a/MoinMoin/formatter/__init__.py	Mon Aug 14 01:24:01 2006 +0200
+++ b/MoinMoin/formatter/__init__.py	Mon Aug 14 08:48:19 2006 +0200
@@ -296,7 +296,7 @@
         return macro_obj.execute(name, args)
 
     def _get_bang_args(self, line):
-        if line[:2] == '#!':
+        if line.startswith('#!'):
             try:
                 name, args = line[2:].split(None, 1)
             except ValueError:
--- a/MoinMoin/parser/text_moin_wiki.py	Mon Aug 14 01:24:01 2006 +0200
+++ b/MoinMoin/parser/text_moin_wiki.py	Mon Aug 14 08:48:19 2006 +0200
@@ -758,7 +758,7 @@
     
     def _parser_repl(self, word):
         """Handle parsed code displays."""
-        if word[:3] == '{{{':
+        if word.startswith('{{{'):
             word = word[3:]
 
         self.parser = None
@@ -770,7 +770,7 @@
             word = ''
             self.in_pre = 3
             return self._closeP() + self.formatter.preformatted(1)
-        elif s_word[:2] == '#!':
+        elif s_word.startswith('#!'):
             # First try to find a parser for this (will go away in 2.0)
             parser_name = s_word[2:].split()[0]
             self.setParser(parser_name)
@@ -972,7 +972,7 @@
                 if self.in_pre == 1:
                     self.parser = None
                     parser_name = ''
-                    if (line.strip()[:2] == "#!"):
+                    if line.strip().startswith("#!"):
                         parser_name = line.strip()[2:].split()[0]
                         self.setParser(parser_name)
 
@@ -1054,7 +1054,7 @@
                 # Table mode
                 # TODO: move into function?                
                 if (not self.in_table and line[indlen:indlen + 2] == "||"
-                    and line[-3:] == "|| " and len(line) >= 5 + indlen):
+                    and line.endswith("|| ") and len(line) >= 5 + indlen):
                     # Start table
                     if self.list_types and not self.in_li:
                         self.request.write(self.formatter.listitem(1, style="list-style-type:none"))
@@ -1071,9 +1071,9 @@
                     self.in_table = True # self.lineno
                 elif (self.in_table and not
                       # intra-table comments should not break a table
-                      (line[:2] == "##" or  
+                      (line.startswith("##") or
                        line[indlen:indlen + 2] == "||" and
-                       line[-3:] == "|| " and
+                       line.endswith("|| ") and
                        len(line) >= 5 + indlen)):
                     
                     # Close table