Stop using xrange() for python 3 compat
ClosedPublic

Authored by demon on Oct 27 2017, 5:00 PM.

Details

Reviewers
mmodell
Group Reviewers
Release-Engineering-Team
Commits
rMSCAc274e55a0677: Stop using xrange() for python 3 compat
Patch without arc
git checkout -b D852 && curl -L https://phabricator.wikimedia.org/D852?download=true | git apply
Summary

Makes this python 2/3 compatible. Import it as _xrange to avoid pylint warnings about redefining range or xrange

Diff Detail

Repository
rMSCA Scap
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
demon created this revision.Oct 27 2017, 5:00 PM
Restricted Application added a reviewer: mmodell. · View Herald TranscriptOct 27 2017, 5:00 PM
Restricted Application added a reviewer: Release-Engineering-Team. · View Herald Transcript
Restricted Application added a project: Release-Engineering-Team. · View Herald Transcript
mmodell added inline comments.Oct 27 2017, 5:59 PM
scap/cdblib.py
21
from six.moves import xrange
ERROR: Failure: ImportError (No module named builtins)
mmodell requested changes to this revision.Oct 27 2017, 6:03 PM
This revision now requires changes to proceed.Oct 27 2017, 6:03 PM
demon updated this revision to Diff 2250.Oct 27 2017, 6:31 PM
  • Swap builtins -> six.moves
demon updated this revision to Diff 2251.Oct 27 2017, 6:33 PM
  • Add python-six to dependencies
demon retitled this revision from Swap builtin xrange for builtins.range() to Stop using xrange() for python 3 compat.
mmodell accepted this revision.Oct 27 2017, 6:58 PM
This revision is now accepted and ready to land.Oct 27 2017, 6:58 PM
This revision was automatically updated to reflect the committed changes.
hashar added a subscriber: hashar.Oct 29 2017, 9:49 PM

You could just have used range() :d