-
Notifications
You must be signed in to change notification settings - Fork 7
Conversation
download_url="{}/tarball/{}".format(BASE_CVS_URL, VERSION), | ||
download_url=f"{BASE_CVS_URL}/tarball/{VERSION}", | ||
test_suite="tests", | ||
tests_require=[x.strip() for x in open("requirements_test.txt").readlines()], | ||
tests_require=[ | ||
x.strip() for x in open("requirements_test.txt").readlines() | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 16-18
refactored with the following changes:
- Replace call to format with f-string (
use-fstring-for-formatting
)
str_i += str(i) + " " | ||
str_i += f"{str(i)} " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function display
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
sys.stderr.write("BLOOM: HASHID: %s\n" % self.hashid.hexdigest()[0:8]) | ||
sys.stderr.write("BLOOM: HASHID: %s\n" % self.hashid.hexdigest()[:8]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function BloomFilter.calc_hashid
refactored with the following changes:
- Replace a[0:x] with a[:x] and a[x:len(a)] with a[x:] (
remove-redundant-slice-index
)
elif self.data_is_hex: | ||
digest = int(value, 16) | ||
else: | ||
if self.data_is_hex: | ||
digest = int(value, 16) | ||
else: | ||
try: | ||
digest = int(value.hex(), 16) | ||
except: | ||
digest = int(binascii.hexlify(value), 16) | ||
try: | ||
digest = int(value.hex(), 16) | ||
except: | ||
digest = int(binascii.hexlify(value), 16) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function BloomFilter._hash
refactored with the following changes:
- Merge else clause's nested if statement into elif (
merge-else-if-into-elif
)
if self.fast: | ||
self.bitset += 1 | ||
else: | ||
self.bitset += self.slices | ||
self.bitset += 1 if self.fast else self.slices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function BloomFilter._add
refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp
)
if not self.saving: | ||
if filename is None and self.filename is None: | ||
sys.stderr.write("A Filename must be provided\n") | ||
return False | ||
else: | ||
self.saving = True | ||
if filename is not None: | ||
self.filename = filename | ||
compress_pickle(self.filename, self) | ||
self.saving = False | ||
return True | ||
if self.saving: | ||
return | ||
if filename is None and self.filename is None: | ||
sys.stderr.write("A Filename must be provided\n") | ||
return False | ||
else: | ||
self.saving = True | ||
if filename is not None: | ||
self.filename = filename | ||
compress_pickle(self.filename, self) | ||
self.saving = False | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function BloomFilter.save
refactored with the following changes:
- Add guard clause (
last-if-guard
)
f2c37be
to
5200cdf
Compare
Branch
master
refactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run:Help us improve this pull request!