@bdd.when(bdd.parsers.parse('I open {path}'))
def open_path(quteproc, path):
 new_tab = False
 new_bg_tab = False
 new_window = False
 as_url = False
 wait = True
 new_tab_suffix = ' in a new tab'
 new_bg_tab_suffix = ' in a new background tab'
 new_window_suffix = ' in a new window'
 do_not_wait_suffix = ' without waiting'
 as_url_suffix = ' as a URL'
 while True:
  if path.endswith(new_tab_suffix):
   path = path[:(- len(new_tab_suffix))]
   new_tab = True
  elif path.endswith(new_bg_tab_suffix):
   path = path[:(- len(new_bg_tab_suffix))]
   new_bg_tab = True
  elif path.endswith(new_window_suffix):
   path = path[:(- len(new_window_suffix))]
   new_window = True
  elif path.endswith(as_url_suffix):
   path = path[:(- len(as_url_suffix))]
   as_url = True
  elif path.endswith(do_not_wait_suffix):
   path = path[:(- len(do_not_wait_suffix))]
   wait = False
  else:
   break
 quteproc.open_path(path, new_tab=new_tab, new_bg_tab=new_bg_tab, new_window=new_window, as_url=as_url, wait=wait)

@ bdd . when ( bdd . parsers . parse ( 'I open {path}' ) ) def open_path ( quteproc , path ) : new_tab = False new_bg_tab = False new_window = False as_url = False wait = True new_tab_suffix = ' in a new tab' new_bg_tab_suffix = ' in a new background tab' new_window_suffix = ' in a new window' do_not_wait_suffix = ' without waiting' as_url_suffix = ' as a URL' while True : if path . endswith ( new_tab_suffix ) : path = path [ : ( - len ( new_tab_suffix ) ) ] new_tab = True elif path . endswith ( new_bg_tab_suffix ) : path = path [ : ( - len ( new_bg_tab_suffix ) ) ] new_bg_tab = True elif path . endswith ( new_window_suffix ) : path = path [ : ( - len ( new_window_suffix ) ) ] new_window = True elif path . endswith ( as_url_suffix ) : path = path [ : ( - len ( as_url_suffix ) ) ] as_url = True elif path . endswith ( do_not_wait_suffix ) : path = path [ : ( - len ( do_not_wait_suffix ) ) ] wait = False else : break quteproc . open_path ( path , new_tab = new_tab , new_bg_tab = new_bg_tab , new_window = new_window , as_url = as_url , wait = wait )
open a url .