Skip to content

Commit b810bb1

Browse files
committed
refactor: remove more of contracts
1 parent 9f7d195 commit b810bb1

File tree

3 files changed

+2
-14
lines changed

3 files changed

+2
-14
lines changed

coverage/misc.py

-5
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ def _decorator(func):
101101
return _decorator
102102

103103

104-
def new_contract(*args_unused, **kwargs_unused):
105-
"""Dummy no-op implementation of `new_contract`."""
106-
pass
107-
108-
109104
def nice_pair(pair):
110105
"""Make a nice string representation of a pair of numbers.
111106

coverage/numbits.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@
1717

1818
from itertools import zip_longest
1919

20-
from coverage.misc import contract, new_contract
20+
from coverage.misc import contract
2121

2222
def _to_blob(b):
2323
"""Convert a bytestring into a type SQLite will accept for a blob."""
2424
return b
2525

26-
new_contract('blob', lambda v: isinstance(v, bytes))
27-
2826

2927
@contract(nums='Iterable', returns='blob')
3028
def nums_to_numbits(nums):

coverage/parser.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from coverage.bytecode import code_objects
1515
from coverage.debug import short_stack
1616
from coverage.exceptions import NoSource, NotPython, _StopEverything
17-
from coverage.misc import contract, join_regex, new_contract, nice_pair
17+
from coverage.misc import contract, join_regex, nice_pair
1818
from coverage.phystokens import generate_tokens
1919

2020

@@ -603,11 +603,6 @@ def __new__(cls, lineno, cause=None):
603603
return super().__new__(cls, lineno, cause)
604604

605605

606-
# Define contract words that PyContract doesn't have.
607-
# ArcStarts is for a list or set of ArcStart's.
608-
new_contract('ArcStarts', lambda seq: all(isinstance(x, ArcStart) for x in seq))
609-
610-
611606
class NodeList:
612607
"""A synthetic fictitious node, containing a sequence of nodes.
613608

0 commit comments

Comments
 (0)