Remove redundant Exception handlers.
This commit is contained in:
parent
961fde3457
commit
c7b4d710bb
15
buku.py
15
buku.py
@ -1617,8 +1617,7 @@ def is_bad_url(url):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
# netloc should have at least one '.'
|
# netloc should have at least one '.'
|
||||||
index = netloc.rfind('.')
|
if netloc.rfind('.') < 0:
|
||||||
if index < 0:
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
@ -1985,11 +1984,7 @@ def prompt(obj, results, noninteractive=False, deep=False, subprompt=False):
|
|||||||
# open all results and re-prompt with 'a'
|
# open all results and re-prompt with 'a'
|
||||||
if nav == 'a':
|
if nav == 'a':
|
||||||
for index in range(0, count):
|
for index in range(0, count):
|
||||||
try:
|
|
||||||
open_in_browser(results[index][1])
|
open_in_browser(results[index][1])
|
||||||
except Exception as e:
|
|
||||||
logerr('prompt() 1: %s', e)
|
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# iterate over white-space separated indices
|
# iterate over white-space separated indices
|
||||||
@ -1999,10 +1994,7 @@ def prompt(obj, results, noninteractive=False, deep=False, subprompt=False):
|
|||||||
if index < 0 or index >= count:
|
if index < 0 or index >= count:
|
||||||
print('No matching index %s' % nav)
|
print('No matching index %s' % nav)
|
||||||
continue
|
continue
|
||||||
try:
|
|
||||||
open_in_browser(results[index][1])
|
open_in_browser(results[index][1])
|
||||||
except Exception as e:
|
|
||||||
logerr('prompt() 2: %s', e)
|
|
||||||
elif '-' in nav and is_int(nav.split('-')[0]) \
|
elif '-' in nav and is_int(nav.split('-')[0]) \
|
||||||
and is_int(nav.split('-')[1]):
|
and is_int(nav.split('-')[1]):
|
||||||
lower = int(nav.split('-')[0])
|
lower = int(nav.split('-')[0])
|
||||||
@ -2010,13 +2002,10 @@ def prompt(obj, results, noninteractive=False, deep=False, subprompt=False):
|
|||||||
if lower > upper:
|
if lower > upper:
|
||||||
lower, upper = upper, lower
|
lower, upper = upper, lower
|
||||||
for index in range(lower-1, upper):
|
for index in range(lower-1, upper):
|
||||||
try:
|
|
||||||
if 0 <= index < count:
|
if 0 <= index < count:
|
||||||
open_in_browser(results[index][1])
|
open_in_browser(results[index][1])
|
||||||
else:
|
else:
|
||||||
print('No matching index %d' % (index + 1))
|
print('No matching index %d' % (index + 1))
|
||||||
except Exception as e:
|
|
||||||
logerr('prompt() 3: %s', e)
|
|
||||||
else:
|
else:
|
||||||
print('Invalid input')
|
print('Invalid input')
|
||||||
break
|
break
|
||||||
@ -2313,7 +2302,7 @@ def edit_rec(editor, url, title_in, tags_in, desc):
|
|||||||
fp.flush()
|
fp.flush()
|
||||||
logdbg('Edited content written to %s', tmpfile)
|
logdbg('Edited content written to %s', tmpfile)
|
||||||
|
|
||||||
p = subprocess.call([editor, tmpfile])
|
subprocess.call([editor, tmpfile])
|
||||||
|
|
||||||
with open(tmpfile, 'r', encoding='utf-8') as f:
|
with open(tmpfile, 'r', encoding='utf-8') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
Loading…
Reference in New Issue
Block a user