1515from lib .core .data import conf
1616from lib .core .data import kb
1717from lib .core .data import logger
18+ from lib .core .settings import CONSTANT_RATIO
1819from lib .core .settings import DIFF_TOLERANCE
1920
2021def comparison (page , headers = None , getSeqMatcher = False , pageLength = None ):
@@ -102,7 +103,7 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
102103 logger .debug ("setting match ratio for current parameter to %.3f" % conf .matchRatio )
103104
104105 elif not kb .pageStable or ( kb .pageStable and ratio < 0.6 ):
105- conf .matchRatio = 0.900
106+ conf .matchRatio = CONSTANT_RATIO
106107 logger .debug ("setting match ratio for current parameter to default value 0.900" )
107108
108109 # If it has been requested to return the ratio and not a comparison
@@ -116,7 +117,7 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None):
116117 # If the url is not stable it returns sequence matcher between the
117118 # first untouched HTTP response page content and this content
118119 else :
119- if kb . pageStable :
120- return ( ratio - conf .matchRatio ) > DIFF_TOLERANCE
120+ if conf . matchRatio == CONSTANT_RATIO or conf . thold :
121+ return ratio > conf .matchRatio
121122 else :
122- return ratio > conf .matchRatio
123+ return ( ratio - conf .matchRatio ) > DIFF_TOLERANCE
0 commit comments