Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 131789a

Browse files
committed
some code refactoring
1 parent 19a82e1 commit 131789a

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

lib/request/comparison.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,11 @@ def comparison(page, headers=None, getSeqMatcher=False):
5353

5454
# String to match in page when the query is valid
5555
if conf.string:
56-
if conf.string in page:
57-
return True
58-
else:
59-
return False
56+
return conf.string in page
6057

6158
# Regular expression to match in page when the query is valid
6259
if conf.regexp:
63-
if re.search(conf.regexp, page, re.I | re.M):
64-
return True
65-
else:
66-
return False
60+
return re.search(conf.regexp, page, re.I | re.M) is not None
6761

6862
if conf.seqLock:
6963
conf.seqLock.acquire()
@@ -102,7 +96,5 @@ def comparison(page, headers=None, getSeqMatcher=False):
10296

10397
# If the url is not stable it returns sequence matcher between the
10498
# first untouched HTTP response page content and this content
105-
elif ratio > conf.matchRatio:
106-
return True
10799
else:
108-
return False
100+
return ratio > conf.matchRatio

0 commit comments

Comments
 (0)