Skip to content
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sudo: required
services:
- docker
python:
- '3.5'
- '3.6'
install:
- pip install sphinx mypy
Expand Down
12 changes: 6 additions & 6 deletions bugzoo/core/fileline.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def compactify(d: Dict['FileLine', Any]) -> Dict[str, Dict[int, Any]]:
assert isinstance(d, dict)
assert all(isinstance(x, FileLine) for x in d)

out: Dict[str, Dict[int, Any]] = {}
out = {} # type: Dict[str, Dict[int, Any]]
for (line, val) in d.items():
if not line.filename in out:
out[line.filename] = {}
Expand All @@ -24,7 +24,7 @@ def compactify(d: Dict['FileLine', Any]) -> Dict[str, Dict[int, Any]]:

@staticmethod
def decompactify(d: Dict[str, Dict[int, Any]]) -> 'Dict[FileLine, Any]':
lines: Dict['FileLine', Any] = {}
lines = {} # type: Dict['FileLine', Any]
for fn in d:
for num in d[fn]:
lines[FileLine(fn, num)] = d[fn][num]
Expand Down Expand Up @@ -82,16 +82,16 @@ def from_list(lst: List[FileLine]) -> 'FileLineSet':

@staticmethod
def from_iter(itr: Iterable[FileLine]) -> 'FileLineSet':
d: Dict[str, Set[int]] = {}
d = {} # type: Dict[str, Set[int]]
for line in itr:
if not line.filename in d:
d[line.filename] = set()
d[line.filename].add(line.num)
return FileLineSet(d)

def __init__(self, contents: Dict[str, Set[int]]) -> None:
self.__contents: Dict[str, FrozenSet[int]] = \
{fn: frozenset(line_nums) for (fn, line_nums) in contents.items()}
self.__contents = \
{fn: frozenset(line_nums) for (fn, line_nums) in contents.items()} # type: Dict[str, FrozenSet[int]]

def __iter__(self) -> Iterator[FileLine]:
"""
Expand Down Expand Up @@ -172,7 +172,7 @@ def restricted_to_files(self, filenames: List[str]) -> 'FileLineSet':
any one of the given files. (I.e., returns the intersection of this set
and the set of all lines from a given set of files.)
"""
restricted: Dict[str, Set[int]] = {}
restricted = {} # type: Dict[str, Set[int]]
for fn in filenames:
restricted[fn] = set(self.__contents[fn])
return FileLineSet(restricted)
Expand Down
2 changes: 1 addition & 1 deletion bugzoo/core/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _read_next(cls, lines: List[str]) -> 'Hunk':
last_insertion_at = old_start_at


hunk_lines: List[HunkLine] = []
hunk_lines = [] # type: List[HunkLine]
while True:
# discarding the previous line ensures that we only consume lines
# from the line buffer that belong to the hunk
Expand Down
4 changes: 2 additions & 2 deletions bugzoo/core/spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class Spectra(object):
def from_coverage(coverage: TestSuiteCoverage) -> 'Spectra':
# tally the number of times that each line is touched by a passing
# or failing test
tally_failing: Dict[FileLine, int] = {}
tally_passing: Dict[FileLine, int] = {}
tally_failing = {} # type: Dict[FileLine, int]
tally_passing = {} # type: Dict[FileLine, int]

for test in coverage.passing:
for line in coverage[test].lines:
Expand Down
4 changes: 2 additions & 2 deletions bugzoo/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from bugzoo.server.daemon import Daemon
from bugzoo.server.code import ErrorCode

daemon: Daemon = None
daemon = None # type: Daemon
app = flask.Flask(__name__)


Expand All @@ -18,7 +18,7 @@ def list_bugs():

@app.route('/bugs/<uid>', methods=['GET'])
def show_bug(uid: str):
jsn: Dict[Any, Any] = {}
jsn = {} # type: Dict[Any, Any]
try:
bug = daemon.bugs[uid]
jsn = bug.to_dict()
Expand Down
4 changes: 2 additions & 2 deletions bugzoo/testing/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ def from_dict(yml: dict) -> 'TestSuite':
raise Exception("unexpected test harness type: {}".format(typ))

def __init__(self, tests: List[TestCase]) -> None:
self.__tests: Dict[str, TestCase] = \
{test.name: test for test in tests}
self.__tests = \
{test.name: test for test in tests} # type: Dict[str, TestCase]

def __getitem__(self, name: str) -> TestCase:
"""
Expand Down
4 changes: 2 additions & 2 deletions bugzoo/testing/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def __init__(self,
super().__init__(command, context, time_limit, tests)

# extract the passing and failing test cases
self.__passing: List[TestCase] = []
self.__failing: List[TestCase] = []
self.__passing = [] # type: List[TestCase]
self.__failing = [] # type: List[TestCase]

for t in self.tests:
if t.name.startswith('p'):
Expand Down
2 changes: 1 addition & 1 deletion bugzoo/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.0.4'
__version__ = '2.0.5'