forked from openlp/openlp
Use future division.
This commit is contained in:
parent
4d8b6f669f
commit
b172153b15
@ -29,6 +29,7 @@
|
||||
"""
|
||||
The duplicate song removal logic for OpenLP.
|
||||
"""
|
||||
from __future__ import division
|
||||
import logging
|
||||
import os
|
||||
|
||||
@ -161,7 +162,7 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
||||
self.notify_no_duplicates()
|
||||
return
|
||||
# With x songs we have x*(x - 1) / 2 comparisons.
|
||||
max_progress_count = max_songs * (max_songs - 1) / 2
|
||||
max_progress_count = max_songs * (max_songs - 1) // 2
|
||||
self.duplicate_search_progress_bar.setMaximum(max_progress_count)
|
||||
songs = self.plugin.manager.get_all_objects(Song)
|
||||
for outer_song_counter in range(max_songs - 1):
|
||||
@ -194,7 +195,6 @@ class DuplicateSongRemovalForm(OpenLPWizard):
|
||||
translate(u'Wizard', u'No duplicate songs have been found in the database.'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||
|
||||
|
||||
def add_duplicates_to_song_list(self, search_song, duplicate_song):
|
||||
"""
|
||||
Inserts a song duplicate (two similar songs) to the duplicate song list.
|
||||
|
@ -43,6 +43,7 @@ Finally two conditions can qualify a song tuple to be a duplicate:
|
||||
This condition should hit if one of the two songs (or both) is small (smaller
|
||||
than the min_block_size), but most of the song is contained in the other song.
|
||||
"""
|
||||
from __future__ import division
|
||||
import difflib
|
||||
|
||||
|
||||
@ -85,7 +86,7 @@ def songs_probably_equal(song1, song2):
|
||||
for element in diff_no_typos:
|
||||
if element[0] == "equal" and _op_length(element) > length_of_longest_equal_block:
|
||||
length_of_longest_equal_block = _op_length(element)
|
||||
if length_of_equal_blocks >= MIN_BLOCK_SIZE or length_of_longest_equal_block > len(small) * 2 / 3:
|
||||
if length_of_equal_blocks >= MIN_BLOCK_SIZE or length_of_longest_equal_block > len(small) * 2 // 3:
|
||||
return True
|
||||
# Both checks failed. We assume the songs are not equal.
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user