Convert to Python3 (#160)

* Convert to python3

* Remove .bak

* Remove (( and )) in print
This commit is contained in:
Ralic Lo 2017-05-18 18:40:43 -07:00 committed by Arun Prakash Jana
parent 6f3ca731d6
commit 7ee95f7f1e
3 changed files with 7 additions and 7 deletions

View File

@ -41,7 +41,7 @@ def bookmarks():
result_bookmark = { result_bookmark = {
'url': bookmark[1], 'url': bookmark[1],
'title': bookmark[2], 'title': bookmark[2],
'tags': list(filter(None, bookmark[3].split(','))), 'tags': list([_f for _f in bookmark[3].split(',') if _f]),
'description': bookmark[4] 'description': bookmark[4]
} }
result['bookmarks'].append(result_bookmark) result['bookmarks'].append(result_bookmark)
@ -92,7 +92,7 @@ def bookmark_api(id):
result = { result = {
'url': bookmark[1], 'url': bookmark[1],
'title': bookmark[2], 'title': bookmark[2],
'tags': list(filter(None, bookmark[3].split(','))), 'tags': list([_f for _f in bookmark[3].split(',') if _f]),
'description': bookmark[4] 'description': bookmark[4]
} }
return jsonify(result) return jsonify(result)
@ -199,7 +199,7 @@ def bookmark_range_operations(starting_id, ending_id):
bookmarks[i] = { bookmarks[i] = {
'url': bookmark[1], 'url': bookmark[1],
'title': bookmark[2], 'title': bookmark[2],
'tags': list(filter(None, bookmark[3].split(','))), 'tags': list([_f for _f in bookmark[3].split(',') if _f]),
'description': bookmark[4] 'description': bookmark[4]
} }
return jsonify(result) return jsonify(result)
@ -247,7 +247,7 @@ def search_bookmarks():
'id': bookmark[0], 'id': bookmark[0],
'url': bookmark[1], 'url': bookmark[1],
'title': bookmark[2], 'title': bookmark[2],
'tags': list(filter(None, bookmark[3].split(','))), 'tags': list([_f for _f in bookmark[3].split(',') if _f]),
'description': bookmark[4] 'description': bookmark[4]
} }
results['bookmarks'].append(result_bookmark) results['bookmarks'].append(result_bookmark)

View File

@ -140,7 +140,7 @@ def test_edit_at_prompt(nav, is_editor_valid_retval, edit_rec_retval):
@pytest.mark.parametrize( @pytest.mark.parametrize(
'field_filter, single_record', 'field_filter, single_record',
product(range(4), [True, False]) product(list(range(4)), [True, False])
) )
def test_format_json(field_filter, single_record): def test_format_json(field_filter, single_record):
"""test func.""" """test func."""

View File

@ -92,7 +92,7 @@ class TestBukuDb(unittest.TestCase):
except KeyError: except KeyError:
pass pass
self.assertEqual(dbdir_relative_expected, BukuDb.get_default_dbdir()) self.assertEqual(dbdir_relative_expected, BukuDb.get_default_dbdir())
for key, value in originals.items(): for key, value in list(originals.items()):
os.environ[key] = value os.environ[key] = value
# # not sure how to test this in nondestructive manner # # not sure how to test this in nondestructive manner
@ -929,7 +929,7 @@ def split_and_test_membership(a, b):
def inclusive_range(start, end): def inclusive_range(start, end):
return range(start, end + 1) return list(range(start, end + 1))
def normalize_range(db_len, low, high): def normalize_range(db_len, low, high):