Page MenuHomeFreeBSD

schedgraph.py: port to Python 3
ClosedPublic

Authored by avg on Dec 23 2021, 10:24 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, May 21, 1:41 AM
Unknown Object (File)
Thu, May 9, 4:34 PM
Unknown Object (File)
Thu, May 9, 12:23 PM
Unknown Object (File)
Tue, May 7, 7:04 PM
Unknown Object (File)
Fri, May 3, 9:22 AM
Unknown Object (File)
Apr 28 2024, 2:05 PM
Unknown Object (File)
Apr 28 2024, 2:19 AM
Unknown Object (File)
Apr 27 2024, 4:55 PM
Subscribers

Details

Summary

The change does not preserve compatibility with Python 2.7.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Errors
Unit
No Test Coverage
Build Status
Buildable 43575
Build 40463: arc lint + arc unit

Event Timeline

avg requested review of this revision.Dec 23 2021, 10:24 AM

I used to program in Python many years ago, but I am not very good with it now.
This is my attempt to make the script work with Python 3 as it is the default Python now.

It may be worthwhile fixing the code style in the script to conform to PEP8, etc just to appease linters, code editors, etc.

jmg added inline comments.
tools/sched/schedgraph.py
800

Looks like you might want to add @total_ordering to class EventSource
from functools. For more information:
https://portingguide.readthedocs.io/en/latest/comparisons.html

and the decorator definition:
https://docs.python.org/3/library/functools.html#functools.total_ordering

This will complete the port from single func cmp to the new Python 3 method.

per jmg's suggestion add total_ordering decorator to get all
comparison operators

This revision was not accepted when it landed; it landed in state Needs Review.Jan 11 2022, 1:37 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.