def convert_line(line, comments):
 for (pattern, repl) in comments['replace'].items():
  line = re.sub(pattern, repl, line)
 pkgname = line.split('=')[0]
 if (pkgname in comments['ignore']):
  line = ('# ' + line)
 try:
  line += ('  # ' + comments['comment'][pkgname])
 except KeyError:
  pass
 try:
  line += '  # rq.filter: {}'.format(comments['filter'][pkgname])
 except KeyError:
  pass
 return line

def convert_line ( line , comments ) : for ( pattern , repl ) in comments [ 'replace' ] . items ( ) : line = re . sub ( pattern , repl , line ) pkgname = line . split ( '=' ) [ 0 ] if ( pkgname in comments [ 'ignore' ] ) : line = ( '# ' + line ) try : line += ( '  # ' + comments [ 'comment' ] [ pkgname ] ) except KeyError : pass try : line += '  # rq.filter: {}' . format ( comments [ 'filter' ] [ pkgname ] ) except KeyError : pass return line
convert the given requirement line to place into the output .