def _re_pattern_pprint(obj, p, cycle):
 p.text('re.compile(')
 pattern = repr(obj.pattern)
 if (pattern[:1] in 'uU'):
  pattern = pattern[1:]
  prefix = 'ur'
 else:
  prefix = 'r'
 pattern = (prefix + pattern.replace('\\\\', '\\'))
 p.text(pattern)
 if obj.flags:
  p.text(',')
  p.breakable()
  done_one = False
  for flag in ('TEMPLATE', 'IGNORECASE', 'LOCALE', 'MULTILINE', 'DOTALL', 'UNICODE', 'VERBOSE', 'DEBUG'):
   if (obj.flags & getattr(re, flag)):
    if done_one:
     p.text('|')
    p.text(('re.' + flag))
    done_one = True
 p.text(')')

def _re_pattern_pprint ( obj , p , cycle ) : p . text ( 're.compile(' ) pattern = repr ( obj . pattern ) if ( pattern [ : 1 ] in 'uU' ) : pattern = pattern [ 1 : ] prefix = 'ur' else : prefix = 'r' pattern = ( prefix + pattern . replace ( '\\\\' , '\\' ) ) p . text ( pattern ) if obj . flags : p . text ( ',' ) p . breakable ( ) done_one = False for flag in ( 'TEMPLATE' , 'IGNORECASE' , 'LOCALE' , 'MULTILINE' , 'DOTALL' , 'UNICODE' , 'VERBOSE' , 'DEBUG' ) : if ( obj . flags & getattr ( re , flag ) ) : if done_one : p . text ( '|' ) p . text ( ( 're.' + flag ) ) done_one = True p . text ( ')' )
the pprint function for regular expression patterns .