def requirement_args(argv, want_paths=False, want_other=False):
 was_r = False
 for arg in argv:
  if was_r:
   if want_paths:
    (yield arg)
   was_r = False
  elif (arg in ['-r', '--requirement']):
   was_r = True
  elif want_other:
   (yield arg)

def requirement_args ( argv , want_paths = False , want_other = False ) : was_r = False for arg in argv : if was_r : if want_paths : ( yield arg ) was_r = False elif ( arg in [ '-r' , '--requirement' ] ) : was_r = True elif want_other : ( yield arg )
return an iterable of filtered arguments .