Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple changes; python 2 support, dictionary, mutator refactor #26

Merged
merged 15 commits into from Jan 19, 2020
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Fix for the dictionary text insert leaving NUL characters in string.

The dictionary text insert wasn't working properly, despite looking
just fine. I think the reason is that the parameters on 'copy' are
transposed. The parameter called 'src' is actually the destination,
(and vice-versa). This caused much confusion when trying to work out
what was happening there.

This change fixes the behaviour of the dictionary insert, but defers
fixing the parameter names until it can be confirmed what was meant
and that the strings are being manipulated correctly.

The change also corrects a mistaken format character in the mutator
__repr__ method.
  • Loading branch information
gerph committed Jan 11, 2020
commit 6daa2b534add813e4acd83be67ee1b402b0b5ae2
@@ -359,7 +359,7 @@ def mutate(self, res):
pos = self._rand(len(res) + 1)
for _ in word:
res.append(0)
self.copy(res, res, pos, pos+len(word))
self.copy(res, res, pos+len(word), pos)
for k in range(len(word)):
res[pos+k] = word[k]
return res
@@ -433,7 +433,7 @@ def acceptable(cls):
raise CorpusError("No mutators are available")

def __repr__(self):
return "<{}(corpus of {}, %i mutators)>".format(self.__class__.__name__,
return "<{}(corpus of {}, {} mutators)>".format(self.__class__.__name__,
len(self._inputs),
len(self.mutators))

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.