Closed Bug 1248406 Opened 10 years ago Closed 10 years ago

Miscellaneous Python 3 syntax fixes

Categories

(Tree Management :: Treeherder, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

Details

Attachments

(1 file)

Not that we want to (or will be able to) switch to Python 3 any time soon, however the Python 3 linters found a few instances of where we're using outdated (or not best practice) Python syntax.
Attachment #8719497 - Flags: review?(cdawson)
Attachment #8719497 - Flags: review?(cdawson) → review+
Commits pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/388a4d6af02a04094c4a9027208c8e1713558dc9 Bug 1248406 - Correct syntax of imports that are actually relative paths In Python 2 you can get away with using relative paths for imports without the dot syntax. However it's best practice to use it when the import path is relative to the current directory rather than the project root. This also makes it Python 3 compatible. https://github.com/mozilla/treeherder/commit/41526006c50e9ff240665fb78d016a4b646625a0 Bug 1248406 - Replace print statements with print() For future Python 3 compatibility. (Whilst for 100% Python 3 equivalence we should be using `from __future__ import print_function`, it doesn't seem worth it.) https://github.com/mozilla/treeherder/commit/7f02d6a7e7b9310fc9f338a6cbea181b52638e8c Bug 1248406 - Use the new style try-except syntax The Python 3 `as` syntax was backported to Python 2.6+ and by switching to it, it makes us more Python 3 compatible: https://www.python.org/dev/peps/pep-3110/#compatibility https://github.com/mozilla/treeherder/commit/ed469da7e451d4637a6cbfec0ca6ea4ff3132321 Bug 1248406 - Use ints rather than longs for model max_length properties For Python 3 compatibility. This is effectively a no-op (migrate and makemigrations say there have been no changes), so I've just edited the existing migrations.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: