@@ -191,7 +191,7 @@ def _parse_draftname(self):
191191 name , __ = base .split ("." , 1 )
192192 else :
193193 name = base
194- revmatch = re .search ("\d\d$" , name )
194+ revmatch = re .search (r "\d\d$" , name )
195195 if revmatch :
196196 filename = name [:- 3 ]
197197 revision = name [- 2 :]
@@ -243,36 +243,36 @@ def begpage(pages, page, newpage, line=None):
243243 for line in self .rawlines :
244244 linecount += 1
245245 line = line .rstrip ()
246- if re .search ("\[?page [0-9ivx]+\]?[ \t \f ]*$" , line , re .I ):
246+ if re .search (r "\[?page [0-9ivx]+\]?[ \t\f]*$" , line , re .I ):
247247 pages , page , newpage = endpage (pages , page , newpage , line )
248248 continue
249- if re .search ("\f " , line , re .I ):
249+ if re .search (r "\f" , line , re .I ):
250250 pages , page , newpage = begpage (pages , page , newpage )
251251 continue
252- if re .search ("^ *Internet.Draft.+ .+[12][0-9][0-9][0-9] *$" , line , re .I ):
252+ if re .search (r "^ *Internet.Draft.+ .+[12][0-9][0-9][0-9] *$" , line , re .I ):
253253 pages , page , newpage = begpage (pages , page , newpage , line )
254254 continue
255255 # if re.search("^ *Internet.Draft +", line, re.I):
256256 # newpage = True
257257 # continue
258- if re .search ("^ *Draft.+[12][0-9][0-9][0-9] *$" , line , re .I ):
258+ if re .search (r "^ *Draft.+[12][0-9][0-9][0-9] *$" , line , re .I ):
259259 pages , page , newpage = begpage (pages , page , newpage , line )
260260 continue
261- if re .search ("^RFC[ -]?[0-9]+.*( +)[12][0-9][0-9][0-9]$" , line , re .I ):
261+ if re .search (r "^RFC[ -]?[0-9]+.*( +)[12][0-9][0-9][0-9]$" , line , re .I ):
262262 pages , page , newpage = begpage (pages , page , newpage , line )
263263 continue
264- if re .search ("^draft-[-a-z0-9_.]+.*[0-9][0-9][0-9][0-9]$" , line , re .I ):
264+ if re .search (r "^draft-[-a-z0-9_.]+.*[0-9][0-9][0-9][0-9]$" , line , re .I ):
265265 pages , page , newpage = endpage (pages , page , newpage , line )
266266 continue
267- if linecount > 15 and re .search (".{58,}(Jan|Feb|Mar|March|Apr|April|May|Jun|June|Jul|July|Aug|Sep|Oct|Nov|Dec) (19[89][0-9]|20[0-9][0-9]) *$" , line , re .I ):
267+ if linecount > 15 and re .search (r ".{58,}(Jan|Feb|Mar|March|Apr|April|May|Jun|June|Jul|July|Aug|Sep|Oct|Nov|Dec) (19[89][0-9]|20[0-9][0-9]) *$" , line , re .I ):
268268 pages , page , newpage = begpage (pages , page , newpage , line )
269269 continue
270- if newpage and re .search ("^ *draft-[-a-z0-9_.]+ *$" , line , re .I ):
270+ if newpage and re .search (r "^ *draft-[-a-z0-9_.]+ *$" , line , re .I ):
271271 pages , page , newpage = begpage (pages , page , newpage , line )
272272 continue
273- if re .search ("^[^ \t ]+" , line ):
273+ if re .search (r "^[^ \t]+" , line ):
274274 sentence = True
275- if re .search ("[^ \t ]" , line ):
275+ if re .search (r "[^ \t]" , line ):
276276 if newpage :
277277 # 36 is a somewhat arbitrary count for a 'short' line
278278 shortthis = len (line .strip ()) < 36 # 36 is a somewhat arbitrary count for a 'short' line
@@ -300,7 +300,7 @@ def begpage(pages, page, newpage, line=None):
300300 # ----------------------------------------------------------------------
301301 def get_pagecount (self ):
302302 if self ._pagecount == None :
303- label_pages = len (re .findall ("\[page [0-9ixldv]+\]" , self .text , re .I ))
303+ label_pages = len (re .findall (r "\[page [0-9ixldv]+\]" , self .text , re .I ))
304304 count_pages = len (self .pages )
305305 if label_pages > count_pages / 2 :
306306 self ._pagecount = label_pages
@@ -343,7 +343,7 @@ def get_formal_languages(self):
343343 def get_status (self ):
344344 if self ._status == None :
345345 for line in self .lines [:10 ]:
346- status_match = re .search ("^\s*Intended [Ss]tatus:\s*(.*?) " , line )
346+ status_match = re .search (r "^\s*Intended [Ss]tatus:\s*(.*?) " , line )
347347 if status_match :
348348 self ._status = status_match .group (1 )
349349 break
@@ -416,8 +416,8 @@ def get_creation_date(self):
416416 def get_abstract (self ):
417417 if self ._abstract :
418418 return self ._abstract
419- abstract_re = re .compile ('^(\s*)abstract' , re .I )
420- header_re = re .compile ("^(\s*)([0-9]+\.? |Appendix|Status of|Table of|Full Copyright|Copyright|Intellectual Property|Acknowled|Author|Index|Disclaimer).*" , re .I )
419+ abstract_re = re .compile (r '^(\s*)abstract' , re .I )
420+ header_re = re .compile (r "^(\s*)([0-9]+\.? |Appendix|Status of|Table of|Full Copyright|Copyright|Intellectual Property|Acknowled|Author|Index|Disclaimer).*" , re .I )
421421 begin = False
422422 abstract = []
423423 abstract_indent = 0
@@ -446,7 +446,7 @@ def get_abstract(self):
446446
447447
448448 def _check_abstract_indent (self , abstract , indent ):
449- indentation_re = re .compile ('^(\s)*' )
449+ indentation_re = re .compile (r '^(\s)*' )
450450 indent_lines = []
451451 for line in abstract .split ('\n ' ):
452452 if line :
@@ -807,7 +807,7 @@ def dotexp(s):
807807 _debug ( "Cut: '%s'" % form [beg :end ])
808808 author_match = re .search (authpat , columns [col ].strip ()).group (1 )
809809 _debug ( "AuthMatch: '%s'" % (author_match ,))
810- if re .search ('\(.*\)$' , author_match .strip ()):
810+ if re .search (r '\(.*\)$' , author_match .strip ()):
811811 author_match = author_match .rsplit ('(' ,1 )[0 ].strip ()
812812 if author_match in companies_seen :
813813 companies [i ] = authors [i ]
@@ -887,7 +887,7 @@ def dotexp(s):
887887 # for a in authors:
888888 # if a and a not in companies_seen:
889889 # _debug("Search for: %s"%(r"(^|\W)"+re.sub("\.? ", ".* ", a)+"(\W|$)"))
890- authmatch = [ a for a in authors [i + 1 :] if a and not a .lower () in companies_seen and (re .search ((r"(?i)(^|\W)" + re .sub ("[. ]+" , ".*" , a )+ "(\W|$)" ), line .strip ()) or acronym_match (a , line .strip ()) )]
890+ authmatch = [ a for a in authors [i + 1 :] if a and not a .lower () in companies_seen and (re .search ((r"(?i)(^|\W)" + re .sub (r "[. ]+" , ".*" , a )+ r "(\W|$)" ), line .strip ()) or acronym_match (a , line .strip ()) )]
891891
892892 if authmatch :
893893 _debug (" ? Other author or company ? : %s" % authmatch )
@@ -915,9 +915,9 @@ def columnify(l):
915915 column = l .replace ('\t ' , 8 * ' ' )[max (0 , beg - 1 ):end ].strip ()
916916 except :
917917 column = l
918- column = re .sub (" *(?:\(at\)| <at> | at ) *" , "@" , column )
919- column = re .sub (" *(?:\(dot\)| <dot> | dot ) *" , "." , column )
920- column = re .sub ("&cisco.com" , "@cisco.com" , column )
918+ column = re .sub (r " *(?:\(at\)| <at> | at ) *" , "@" , column )
919+ column = re .sub (r " *(?:\(dot\)| <dot> | dot ) *" , "." , column )
920+ column = re .sub (r "&cisco.com" , "@cisco.com" , column )
921921 column = column .replace ("\xa0 " , " " )
922922 return column
923923
@@ -1003,13 +1003,13 @@ def columnify(l):
10031003 def get_title (self ):
10041004 if self ._title :
10051005 return self ._title
1006- match = re .search ('(?:\n \s*\n \s*)((.+\n ){0,2}(.+\n *))(\s+<?draft-\S+\s*\n )\s*\n ' , self .pages [0 ])
1006+ match = re .search (r '(?:\n\s*\n\s*)((.+\n){0,2}(.+\n*))(\s+<?draft-\S+\s*\n)\s*\n' , self .pages [0 ])
10071007 if not match :
1008- match = re .search ('(?:\n \s*\n \s*)<?draft-\S+\s*\n *((.+\n ){1,3})\s*\n ' , self .pages [0 ])
1008+ match = re .search (r '(?:\n\s*\n\s*)<?draft-\S+\s*\n*((.+\n){1,3})\s*\n' , self .pages [0 ])
10091009 if not match :
1010- match = re .search ('(?:\n \s*\n \s*)((.+\n ){0,2}(.+\n *))(\s*\n ){2}' , self .pages [0 ])
1010+ match = re .search (r '(?:\n\s*\n\s*)((.+\n){0,2}(.+\n*))(\s*\n){2}' , self .pages [0 ])
10111011 if not match :
1012- match = re .search ('(?i)(.+\n |.+\n .+\n )(\s*status of this memo\s*\n )' , self .pages [0 ])
1012+ match = re .search (r '(?i)(.+\n|.+\n.+\n)(\s*status of this memo\s*\n)' , self .pages [0 ])
10131013 if match :
10141014 title = match .group (1 )
10151015 title = title .strip ()
@@ -1147,10 +1147,10 @@ def old_get_refs( self ):
11471147 para += " "
11481148 para += line
11491149 refs += [ para ]
1150- rfc_match = re .search ("(?i)rfc ?\d+" , para )
1150+ rfc_match = re .search (r "(?i)rfc ?\d+" , para )
11511151 if rfc_match :
11521152 rfcrefs += [ rfc_match .group (0 ).replace (" " ,"" ).lower () ]
1153- draft_match = re .search ("draft-[a-z0-9-]+" , para )
1153+ draft_match = re .search (r "draft-[a-z0-9-]+" , para )
11541154 if draft_match :
11551155 draft = draft_match .group (0 ).lower ()
11561156 if not draft in draftrefs :
@@ -1185,7 +1185,7 @@ def getmeta(fn):
11851185 if not os .path .exists (filename ):
11861186 fn = filename
11871187 while not "-00." in fn :
1188- revmatch = re .search ("-(\d\d)\." , fn )
1188+ revmatch = re .search (r "-(\d\d)\." , fn )
11891189 if revmatch :
11901190 rev = revmatch .group (1 )
11911191 prev = "%02d" % (int (rev )- 1 )
@@ -1312,7 +1312,7 @@ def _main(outfile=sys.stdout):
13121312 # Option processing
13131313 # ----------------------------------------------------------------------
13141314 options = ""
1315- for line in re .findall ("\n +(if|elif) +opt in \[(.+)\]:\s+#(.+)\n " , open (sys .argv [0 ]).read ()):
1315+ for line in re .findall (r "\n +(if|elif) +opt in \[(.+)\]:\s+#(.+)\n" , open (sys .argv [0 ]).read ()):
13161316 if not options :
13171317 options += "OPTIONS\n "
13181318 options += " %-16s %s\n " % (line [1 ].replace ('"' , '' ), line [2 ])
0 commit comments