Skip to content
This repository was archived by the owner on Apr 30, 2021. It is now read-only.

Commit 0cba5cf

Browse files
author
Yevgeny Pats
authored
Merge pull request #5 from jvoisin/simplify_init
Simplify a bit the code for the Corpus' constructor
2 parents 53cdb65 + 3fa3998 commit 0cba5cf

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pythonfuzz/corpus.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Corpus(object):
1515
def __init__(self, dirs=None, max_input_size=4096):
1616
self._inputs = []
1717
self._max_input_size = max_input_size
18-
self._dirs = [] if dirs is None else dirs
18+
self._dirs = dirs if dirs else []
1919
for i, path in enumerate(dirs):
2020
if i == 0 and not os.path.exists(path):
2121
os.mkdir(path)
@@ -27,9 +27,9 @@ def __init__(self, dirs=None, max_input_size=4096):
2727
fname = os.path.join(path, i)
2828
if os.path.isfile(fname):
2929
self._add_file(fname)
30-
self._seed_run_finished = True if len(self._inputs) == 0 else False
30+
self._seed_run_finished = not self._inputs
3131
self._seed_idx = 0
32-
self._save_corpus = True if len(dirs) > 0 and os.path.isdir(dirs[0]) else False
32+
self._save_corpus = dirs and os.path.isdir(dirs[0])
3333

3434
def _add_file(self, path):
3535
with open(path, 'rb') as f:

0 commit comments

Comments
 (0)