Commit b719b459 authored by Matt Harbison's avatar Matt Harbison

cleanup: use set literals instead of set()

Flagged by PyCharm.
parent 1ae09a28243f
......@@ -102,9 +102,9 @@ def test_makeannotatepalette_fold_same_color():
palette = colormap.makeannotatepalette(filectxs, now=0,
maxcolors=4, maxhues=8)
assert_equals(2, len(palette))
assert_equals(set([filectxs[0], filectxs[1], filectxs[2]]),
assert_equals({filectxs[0], filectxs[1], filectxs[2]},
set(palette['#ffaaaa']))
assert_equals(set([filectxs[3], filectxs[4]]), set(palette['#ffaae9']))
assert_equals({filectxs[3], filectxs[4]}, set(palette['#ffaae9']))
def test_makeannotatepalette_mindate_included():
agestep = 10 * SECS_PER_DAY
......
......@@ -337,7 +337,7 @@ def setup_straightenedbyrevset():
def test_linecolor_straightened_by_revset():
repo = openrepo('straightened-by-revset')
revset = set([0, 1, 2, 4, 6, 7]) # exclude 3, 5
revset = {0, 1, 2, 4, 6, 7} # exclude 3, 5
grapher = graph.revision_grapher(repo, {"revset": revset})
c0, c1 = 0, 1
actualtable = buildlinecolortable(grapher)
......@@ -359,7 +359,7 @@ def test_linecolor_straightened_by_revset():
def test_linecolor_straightened_by_revset_2():
repo = openrepo('straightened-by-revset')
revset = set([0, 1, 2, 3, 4, 6, 7]) # exclude 5
revset = {0, 1, 2, 3, 4, 6, 7} # exclude 5
grapher = graph.revision_grapher(repo, {"revset": revset})
c0, c1 = 0, 1
actualtable = buildlinecolortable(grapher)
......@@ -383,7 +383,7 @@ def test_linecolor_straightened_by_revset_2():
def test_linecolor_straightened_by_revset_3():
repo = openrepo('straightened-by-revset')
revset = set([0, 1, 2, 3, 6, 7]) # exclude 4, 5
revset = {0, 1, 2, 3, 6, 7} # exclude 4, 5
grapher = graph.revision_grapher(repo, {"revset": revset})
c0, c1 = 0, 1
actualtable = buildlinecolortable(grapher)
......@@ -405,7 +405,7 @@ def test_linecolor_straightened_by_revset_3():
def test_linecolor_straightened_by_revset_4():
repo = openrepo('straightened-by-revset')
revset = set([0, 1, 3, 4, 6, 7]) # exclude 2, 5
revset = {0, 1, 3, 4, 6, 7} # exclude 2, 5
grapher = graph.revision_grapher(repo, {"revset": revset})
c0, c1 = 0, 1
actualtable = buildlinecolortable(grapher)
......@@ -634,7 +634,7 @@ def test_grapher_branch_allparents_2():
def test_grapher_revset_1():
repo = openrepo('manyheads')
revset = set([8, 6, 5, 4, 3])
revset = {8, 6, 5, 4, 3}
grapher = graph.revision_grapher(repo, {'revset': revset})
actualtable = buildlinecolumntable(grapher)
expectedtable = {
......@@ -653,7 +653,7 @@ def test_grapher_revset_1():
def test_grapher_revset_2():
repo = openrepo('manyheads')
revset = set([5, 4, 3, 2, 1])
revset = {5, 4, 3, 2, 1}
grapher = graph.revision_grapher(repo, {'revset': revset})
actualtable = buildlinecolumntable(grapher)
expectedtable = {
......@@ -672,7 +672,7 @@ def test_grapher_revset_2():
def test_grapher_revset_3():
repo = openrepo('manyheads')
revset = set([8, 5, 3])
revset = {8, 5, 3}
grapher = graph.revision_grapher(repo, {'revset': revset})
actualtable = buildlinecolumntable(grapher)
expectedtable = {
......@@ -819,7 +819,7 @@ def setup_familyline():
def test_grapher_familyline_islands():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([12, 11])})
'revset': {12, 11}})
actualtable = buildlinecolumntable(grapher)
expectedtable = {
12: [],
......@@ -830,7 +830,7 @@ def test_grapher_familyline_islands():
def test_grapher_familyline_1_parent():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([12, 10])})
'revset': {12, 10}})
actualtable = buildlinecolumntable(grapher)
expectedtable = {
12: ['0-0'],
......@@ -841,7 +841,7 @@ def test_grapher_familyline_1_parent():
def test_grapher_familyline_2_parents():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([9, 7, 6])})
'revset': {9, 7, 6}})
actualtable = buildlinecolumntable(grapher)
expectedtable = { # 9
9: ['0-0', '0-1'], # |\
......@@ -855,7 +855,7 @@ def test_grapher_familyline_2_parents():
def test_grapher_familyline_1_nva():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([9, 4])})
'revset': {9, 4}})
actualtable = buildlinecolumntable(grapher)
expectedtable = {
9: ['0-0F'],
......@@ -866,7 +866,7 @@ def test_grapher_familyline_1_nva():
def test_grapher_familyline_2_nvas():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([7, 3, 2])})
'revset': {7, 3, 2}})
actualtable = buildlinecolumntable(grapher)
expectedtable = { # 7
7: ['0-0F', '0-1F'], # |\
......@@ -880,7 +880,7 @@ def test_grapher_familyline_2_nvas():
def test_grapher_familyline_simple_case_1():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([7, 4, 3, 1])})
'revset': {7, 4, 3, 1}})
actualtable = buildlinecolumntable(grapher)
expectedtable = { # 7
7: ['0-0', '0-1F'], # |\
......@@ -896,7 +896,7 @@ def test_grapher_familyline_simple_case_1():
def test_grapher_familyline_simple_case_2():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([7, 5, 4, 1])})
'revset': {7, 5, 4, 1}})
actualtable = buildlinecolumntable(grapher)
expectedtable = { # 7
7: ['0-0', '0-1'], # |\
......@@ -912,7 +912,7 @@ def test_grapher_familyline_simple_case_2():
def test_grapher_familyline_many_parents():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([12, 11, 8, 7, 6])})
'revset': {12, 11, 8, 7, 6}})
actualtable = buildlinecolumntable(grapher)
expectedtable = { # 12--+
12: ['0-0F', '0-1F', '0-2F'], # |\ |
......@@ -930,7 +930,7 @@ def test_grapher_familyline_many_parents():
def test_grapher_familyline_dont_draw_familyline_to_parent():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([6, 2])})
'revset': {6, 2}})
actualtable = buildlinecolumntable(grapher)
expectedtable = { # 6
6: ['0-0'], # | familyline between 6 and 2 (from 6-4-2) is
......@@ -942,7 +942,7 @@ def test_grapher_familyline_dont_draw_familyline_to_parent():
def test_grapher_familyline_dont_draw_familyline_to_ancestor_of_visible_p1():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([9, 7, 2])})
'revset': {9, 7, 2}})
actualtable = buildlinecolumntable(grapher)
expectedtable = { # 9
9: ['0-0'], # | familyline between 9 and 2 (from 9-6-2) is
......@@ -956,7 +956,7 @@ def test_grapher_familyline_dont_draw_familyline_to_ancestor_of_visible_p1():
def test_grapher_familyline_dont_draw_familyline_to_ancestor_of_visible_p2():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([9, 6, 1])})
'revset': {9, 6, 1}})
actualtable = buildlinecolumntable(grapher)
expectedtable = { # 9
9: ['0-0'], # | familyline between 9 and 2 (from 9-7-2) is
......@@ -970,7 +970,7 @@ def test_grapher_familyline_dont_draw_familyline_to_ancestor_of_visible_p2():
def test_grapher_familyline_dont_draw_familyline_to_ancestor_of_other_nva():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([9, 5, 1])})
'revset': {9, 5, 1}})
actualtable = buildlinecolumntable(grapher)
expectedtable = { # 9
9: ['0-0F'], # | familyline between 9 and 1 (from 9-7-4-1) is
......@@ -984,7 +984,7 @@ def test_grapher_familyline_dont_draw_familyline_to_ancestor_of_other_nva():
def test_grapher_familyline_branch():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([10, 9, 8, 6, 5]),
'revset': {10, 9, 8, 6, 5},
'branch': 'foo'})
actualtable = buildlinecolumntable(grapher)
expectedtable = { # 9
......@@ -999,7 +999,7 @@ def test_grapher_familyline_branch():
def test_grapher_familyline_invisible_earliest():
repo = openrepo('familyline')
grapher = graph.revision_grapher(repo, {'showfamilyline': True,
'revset': set([1, 0]),
'revset': {1, 0},
'branch': 'foo'})
# should empty queue even if the earliest revision is invisible
actualtable = buildlinecolumntable(grapher)
......
......@@ -387,7 +387,7 @@ def test_files():
0
""")
assert_equal(set([helpers.GraphBuilder.DUMMYFILE, "foo", "bar/baz"]),
assert_equal({helpers.GraphBuilder.DUMMYFILE, "foo", "bar/baz"},
set(repo[1].files()))
def test_file_move():
......@@ -396,11 +396,11 @@ def test_file_move():
1 [files="foo,bar"]
0
""")
assert_equal(set([helpers.GraphBuilder.DUMMYFILE, "foo", "baz/foo2"]),
assert_equal({helpers.GraphBuilder.DUMMYFILE, "foo", "baz/foo2"},
set(repo[2].files()))
assert_equal(set([helpers.GraphBuilder.DUMMYFILE, ".hgignore",
"bar", "baz/foo2"]),
set(repo[2].manifest()))
assert_equal(
{helpers.GraphBuilder.DUMMYFILE, ".hgignore", "bar", "baz/foo2"},
set(repo[2].manifest()))
def test_file_remove():
repo = createrepo(r"""
......@@ -408,9 +408,9 @@ def test_file_remove():
1 [files="foo,bar"]
0
""")
assert_equal(set([helpers.GraphBuilder.DUMMYFILE, "foo"]),
assert_equal({helpers.GraphBuilder.DUMMYFILE, "foo"},
set(repo[2].files()))
assert_equal(set([helpers.GraphBuilder.DUMMYFILE, ".hgignore", "bar"]),
assert_equal({helpers.GraphBuilder.DUMMYFILE, ".hgignore", "bar"},
set(repo[2].manifest()))
def _contentgetter(repo, path):
......
......@@ -160,11 +160,11 @@ class _RepoAgentChangedSignalTestBase(unittest.TestCase):
def test_invalidate_on_dirstate_changed(self):
repo = self.agent.rawRepo()
self.assertEqual(set(['foo']), set(repo.dirstate)) # preload cache
self.assertEqual({'foo'}, set(repo.dirstate)) # preload cache
self.hg.ftouch('bar')
self.agent.runCommand(['add', 'bar'])
self.wait()
self.assertEqual(set(['bar', 'foo']), set(repo.dirstate))
self.assertEqual({'bar', 'foo'}, set(repo.dirstate))
def test_immediate_hiddenfilter(self):
self.agent.setHiddenRevsIncluded(not self.agent.hiddenRevsIncluded())
......
......@@ -127,7 +127,7 @@ def check_dict_setitem_preserve_order():
@with_both
def check_dict_iter():
c = newwconfig({'foo.bar': 'x', 'foo.baz': 'y'})
assert_equals(set(['bar', 'baz']), set(c['foo']))
assert_equals({'bar', 'baz'}, set(c['foo']))
@with_both
def check_dict_len():
......@@ -150,7 +150,7 @@ def check_dict_delitem():
@with_both
def check_iter():
c = newwconfig({'foo.bar': 'x', 'baz.bax': 'y'})
assert_equals(set(['foo', 'baz']), set(c))
assert_equals({'foo', 'baz'}, set(c))
@with_both
def check_update():
......
......@@ -142,7 +142,7 @@ class Graph(object):
if add_none:
self._revset.insert(0, None)
self._revset_set_pure = self._revset_set
self._revset_set = frozenset(self._revset_set | set([None]))
self._revset_set = frozenset(self._revset_set | {None})
self._edge_color_cache = {}
self._grapher = self._build_nodes()
self._row_to_rev = dict(
......
......@@ -679,8 +679,8 @@ class KeyPressInterceptor(QObject):
def __init__(self, parent=None, keys=None, keyseqs=None):
super(KeyPressInterceptor, self).__init__(parent)
self._keys = set((Qt.Key_Escape,))
self._keyseqs = set((QKeySequence.Refresh,))
self._keys = {Qt.Key_Escape}
self._keyseqs = {QKeySequence.Refresh}
if keys:
self._keys.update(keys)
if keyseqs:
......
......@@ -170,7 +170,7 @@ class WebconfForm(QWidget):
origpath, origlocalpath = self._webconfmodel.getpathmapat(index.row())
path, localpath = _PathDialog.geteditpathmap(
self, path=origpath, localpath=origlocalpath,
invalidpaths=set(self._webconfmodel.paths) - set([origpath]))
invalidpaths=set(self._webconfmodel.paths) - {origpath})
if not path:
return
if path != origpath:
......
......@@ -281,11 +281,11 @@ class menuThg:
if cachethg.ROOT in states and len(states) == 1:
states.add(cachethg.MODIFIED)
changed = bool(states & set([cachethg.ADDED, cachethg.MODIFIED]))
changed = bool(states & {cachethg.ADDED, cachethg.MODIFIED})
modified = cachethg.MODIFIED in states
clean = cachethg.UNCHANGED in states
tracked = changed or modified or clean
new = bool(states & set([cachethg.UNKNOWN, cachethg.IGNORED]))
new = bool(states & {cachethg.UNKNOWN, cachethg.IGNORED})
menu = thg_menu(repo.ui, self.promoted, self.name)
if changed or cachethg.UNKNOWN in states or 'qtip' in repo['.'].tags():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment