diff options
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/collector.py | 2 | ||||
-rw-r--r-- | coverage/html.py | 2 | ||||
-rw-r--r-- | coverage/misc.py | 2 | ||||
-rw-r--r-- | coverage/parser.py | 18 | ||||
-rw-r--r-- | coverage/phystokens.py | 2 | ||||
-rw-r--r-- | coverage/sqldata.py | 4 |
6 files changed, 15 insertions, 15 deletions
diff --git a/coverage/collector.py b/coverage/collector.py index 9333d66a..a4f1790d 100644 --- a/coverage/collector.py +++ b/coverage/collector.py @@ -55,7 +55,7 @@ class Collector(object): _collectors = [] # The concurrency settings we support here. - SUPPORTED_CONCURRENCIES = set(["greenlet", "eventlet", "gevent", "thread"]) + SUPPORTED_CONCURRENCIES = {"greenlet", "eventlet", "gevent", "thread"} def __init__( self, should_trace, check_include, should_start_context, file_mapper, diff --git a/coverage/html.py b/coverage/html.py index 247d2ae1..ef50b56b 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -84,7 +84,7 @@ class HtmlDataGeneration(object): data = self.coverage.get_data() self.has_arcs = data.has_arcs() if self.config.show_contexts: - if data.measured_contexts() == set([""]): + if data.measured_contexts() == {""}: self.coverage._warn("No contexts were measured") data.set_query_contexts(self.config.report_contexts) diff --git a/coverage/misc.py b/coverage/misc.py index 5c4381ab..96573f7a 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -77,7 +77,7 @@ if USE_CONTRACTS: def one_of(argnames): """Ensure that only one of the argnames is non-None.""" def _decorator(func): - argnameset = set(name.strip() for name in argnames.split(",")) + argnameset = {name.strip() for name in argnames.split(",")} def _wrapper(*args, **kwargs): vals = [kwargs.get(name) for name in argnameset] assert sum(val is not None for val in vals) == 1 diff --git a/coverage/parser.py b/coverage/parser.py index e3e43149..f5a8ddd9 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -220,7 +220,7 @@ class PythonParser(object): Returns a set of the first lines. """ - return set(self.first_line(l) for l in lines) + return {self.first_line(l) for l in lines} def translate_lines(self, lines): """Implement `FileReporter.translate_lines`.""" @@ -520,7 +520,7 @@ class AstArcAnalyzer(object): def __init__(self, text, statements, multiline): self.root_node = ast.parse(neuter_encoding_declaration(text)) # TODO: I think this is happening in too many places. - self.statements = set(multiline.get(l, l) for l in statements) + self.statements = {multiline.get(l, l) for l in statements} self.multiline = multiline if AST_DUMP: # pragma: debugging @@ -626,10 +626,10 @@ class AstArcAnalyzer(object): return 1 # The node types that just flow to the next node with no complications. - OK_TO_DEFAULT = set([ + OK_TO_DEFAULT = { "Assign", "Assert", "AugAssign", "Delete", "Exec", "Expr", "Global", "Import", "ImportFrom", "Nonlocal", "Pass", "Print", - ]) + } @contract(returns='ArcStarts') def add_arcs(self, node): @@ -661,7 +661,7 @@ class AstArcAnalyzer(object): print("*** Unhandled: {}".format(node)) # Default for simple statements: one exit from this node. - return set([ArcStart(self.line_for_node(node))]) + return {ArcStart(self.line_for_node(node))} @one_of("from_start, prev_starts") @contract(returns='ArcStarts') @@ -677,7 +677,7 @@ class AstArcAnalyzer(object): """ if prev_starts is None: - prev_starts = set([from_start]) + prev_starts = {from_start} for body_node in body: lineno = self.line_for_node(body_node) first_line = self.multiline.get(lineno, lineno) @@ -890,7 +890,7 @@ class AstArcAnalyzer(object): self.add_arc(last, lineno) last = lineno # The body is handled in collect_arcs. - return set([ArcStart(last)]) + return {ArcStart(last)} _handle__ClassDef = _handle_decorated @@ -984,7 +984,7 @@ class AstArcAnalyzer(object): # If there are `except` clauses, then raises in the try body # will already jump to them. Start this set over for raises in # `except` and `else`. - try_block.raise_from = set([]) + try_block.raise_from = set() else: self.block_stack.pop() @@ -1079,7 +1079,7 @@ class AstArcAnalyzer(object): if start.cause is not None: causes.append(start.cause.format(lineno=start.lineno)) cause = " or ".join(causes) - exits = set(ArcStart(xit.lineno, cause) for xit in exits) + exits = {ArcStart(xit.lineno, cause) for xit in exits} return exits @contract(returns='ArcStarts') diff --git a/coverage/phystokens.py b/coverage/phystokens.py index b6866e7d..54378b3b 100644 --- a/coverage/phystokens.py +++ b/coverage/phystokens.py @@ -87,7 +87,7 @@ def source_token_lines(source): """ - ws_tokens = set([token.INDENT, token.DEDENT, token.NEWLINE, tokenize.NL]) + ws_tokens = {token.INDENT, token.DEDENT, token.NEWLINE, tokenize.NL} line = [] col = 0 diff --git a/coverage/sqldata.py b/coverage/sqldata.py index 7a3b5c79..b28b83b4 100644 --- a/coverage/sqldata.py +++ b/coverage/sqldata.py @@ -784,7 +784,7 @@ class CoverageData(SimpleReprMixin): """ self._start_using() with self._connect() as con: - contexts = set(row[0] for row in con.execute("select distinct(context) from context")) + contexts = {row[0] for row in con.execute("select distinct(context) from context")} return contexts def file_tracer(self, filename): @@ -857,7 +857,7 @@ class CoverageData(SimpleReprMixin): arcs = self.arcs(filename) if arcs is not None: all_lines = itertools.chain.from_iterable(arcs) - return list(set(l for l in all_lines if l > 0)) + return list({l for l in all_lines if l > 0}) with self._connect() as con: file_id = self._file_id(filename) |