|
@@ -18,11 +18,10 @@ |
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
|
# SOFTWARE. |
|
|
# SOFTWARE. |
|
|
|
|
|
|
|
|
|
|
|
import urllib.parse |
|
|
from threading import Event |
|
|
from threading import Event |
|
|
from time import time |
|
|
from time import time |
|
|
|
|
|
|
|
|
import urlparse |
|
|
|
|
|
|
|
|
|
|
|
from earwigbot.wiki.copyvios.markov import EMPTY, EMPTY_INTERSECTION |
|
|
from earwigbot.wiki.copyvios.markov import EMPTY, EMPTY_INTERSECTION |
|
|
|
|
|
|
|
|
__all__ = ["CopyvioSource", "CopyvioCheckResult"] |
|
|
__all__ = ["CopyvioSource", "CopyvioCheckResult"] |
|
@@ -89,7 +88,7 @@ class CopyvioSource: |
|
|
@property |
|
|
@property |
|
|
def domain(self): |
|
|
def domain(self): |
|
|
"""The source URL's domain name, or None.""" |
|
|
"""The source URL's domain name, or None.""" |
|
|
return urlparse.urlparse(self.url).netloc or None |
|
|
|
|
|
|
|
|
return urllib.parse.urlparse(self.url).netloc or None |
|
|
|
|
|
|
|
|
def start_work(self): |
|
|
def start_work(self): |
|
|
"""Mark this source as being worked on right now.""" |
|
|
"""Mark this source as being worked on right now.""" |
|
@@ -182,13 +181,11 @@ class CopyvioCheckResult: |
|
|
@property |
|
|
@property |
|
|
def confidence(self): |
|
|
def confidence(self): |
|
|
"""The confidence of the best source, or 0 if no sources exist.""" |
|
|
"""The confidence of the best source, or 0 if no sources exist.""" |
|
|
return ( |
|
|
|
|
|
self.unified_confidence |
|
|
|
|
|
if self.unified_confidence is not None |
|
|
|
|
|
else self.best.confidence |
|
|
|
|
|
if self.best |
|
|
|
|
|
else 0.0 |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
if self.unified_confidence is not None: |
|
|
|
|
|
return self.unified_confidence |
|
|
|
|
|
if self.best: |
|
|
|
|
|
return self.best.confidence |
|
|
|
|
|
return 0.0 |
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def url(self): |
|
|
def url(self): |
|
|