Opened 5 years ago

Closed 4 years ago

#6297 task closed fixed (fixed)

Remove usage of twisted.python.compat.set and frozenset

Reported by: Thijs Triemstra Owned by: Tom Prince
Priority: low Milestone:
Component: core Keywords: easy
Cc: Thijs Triemstra Branch: branches/remove-set-frozenset-6297
branch-diff, diff-cov, branch-cov, buildbot
Author: tomprince

Description (last modified by Thijs Triemstra)

set and frozenset builtins were introduced in python2.4 and the sets module deprecated since python2.6. This makes compat.set and compat.frozenset redundant and the following imports can be removed:

./twisted/trial/runner.py:26:from twisted.python.compat import set
./twisted/trial/reporter.py:21:from twisted.python.compat import set
./twisted/trial/test/test_script.py:13:from twisted.python.compat import set
./twisted/scripts/trial.py:15:from twisted.python.compat import set
./twisted/mail/relaymanager.py:33:from twisted.python.compat import set
./twisted/mail/maildir.py:21:from twisted.python.compat import set
./twisted/web/_newclient.py:36:from twisted.python.compat import set
./twisted/web/test/test_wsgi.py:17:from twisted.python.compat import set
./twisted/web/test/test_static.py:13:from twisted.python.compat import set
./twisted/web/client.py:39:from twisted.python.compat import set
./twisted/protocols/amp.py:185:from twisted.python.compat import set
./twisted/names/test/test_client.py:12:from twisted.python.compat import set
./twisted/python/test/test_zipstream.py:12:from twisted.python.compat import set
./twisted/python/test/test_fakepwd.py:23:from twisted.python.compat import set
./twisted/internet/posixbase.py:18:from twisted.python.compat import set, _PY3
./twisted/internet/base.py:20:from twisted.python.compat import set
./twisted/internet/_glibbase.py:23:from twisted.python.compat import set
./twisted/internet/test/test_posixbase.py:10:from twisted.python.compat import set, _PY3
./twisted/internet/test/test_process.py:14:from twisted.python.compat import set
./twisted/internet/iocpreactor/reactor.py:35:from twisted.python.compat import set
./twisted/conch/test/test_openssh_compat.py:12:from twisted.python.compat import set
./twisted/conch/test/test_tap.py:27:from twisted.python.compat import set
./twisted/test/test_compat.py:15:from twisted.python.compat import set, frozenset, reduce, execfile, _PY3
./twisted/test/test_process.py:31:from twisted.python.compat import set
./twisted/test/test_paths.py:14:from twisted.python.compat import set, _PY3
./twisted/test/test_task.py:10:from twisted.python.compat import set
./twisted/words/protocols/irc.py:44:from twisted.python.compat import set

The compat versions could also be deprecated if deemed necessary.

Attachments (2)

kevinwo-6297.patch (12.8 KB) - added by Kevin W 4 years ago.
remove-set-frozenset-kevinwo-6297-1.patch (17.3 KB) - added by Kevin W 4 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 5 years ago by Thijs Triemstra

Description: modified (diff)

comment:2 Changed 5 years ago by Julian Berman

Keywords: easy added

comment:3 Changed 4 years ago by Kevin W

Owner: set to Kevin W
Status: newassigned

Changed 4 years ago by Kevin W

Attachment: kevinwo-6297.patch added

comment:4 Changed 4 years ago by Kevin W

Keywords: review added
Owner: Kevin W deleted
Status: assignednew

All traces of 'set' and 'frozenset' have been removed

comment:5 Changed 4 years ago by Tom Prince

Owner: set to Tom Prince

comment:6 Changed 4 years ago by Tom Prince

Keywords: review removed
Owner: changed from Tom Prince to Kevin W

Thanks for your contribution.

There are a couple of more uses:

twisted/web/test/test_http_headers.py twisted/web/test/test_http.py twisted/python/test/test_release.py

Also, you need to add news files (.misc probably) to each touched component.

Please resubmit for review after removing the remaining uses and adding a topfile.

Changed 4 years ago by Kevin W

comment:7 Changed 4 years ago by Kevin W

Keywords: review added
Owner: changed from Kevin W to Tom Prince

Thanks, Tom. I've attached an updated patch handling the uses you mentioned along with topfiles.

comment:8 Changed 4 years ago by Tom Prince

Author: tomprince
Branch: branches/remove-set-frozenset-6297

(In [37414]) Branching to remove-set-frozenset-6297.

comment:9 Changed 4 years ago by Tom Prince

Keywords: review removed

build results

Just a note: .misc topfiles don't need (and ignore) conetent. And for the rest of the topfiles, they should contain something appropriate to go in the NEWS files and they get rewrapped. For this particular change, since there is no user visibile change, the misc file just causes the ticket to appear under "Other".

I'll merge.

comment:10 Changed 4 years ago by Tom Prince

Resolution: fixed
Status: newclosed

(In [37416]) Merge remove-set-frozenset-6297: Remove usage of twisted.python.compat.set and frozenset.

Author: kevinwo Reviewers: therve Fixes: #6297

set and frozenset builtins were introduced in python2.4 and the sets module deprecated since python2.6. This makes compat.set and compat.frozenset redundant.

Note: See TracTickets for help on using tickets.