mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
use key instead of cmp while sorting list
the cmp kwarg of list.sort method is deprecated in py3
This commit is contained in:
parent
7f500d1ec0
commit
efce0a3e4f
@ -275,7 +275,7 @@ def _writeCustomPackage(f, intf):
|
|||||||
print("attribute enum_encoding: string;", file=f)
|
print("attribute enum_encoding: string;", file=f)
|
||||||
print(file=f)
|
print(file=f)
|
||||||
sortedList = list(_enumPortTypeSet)
|
sortedList = list(_enumPortTypeSet)
|
||||||
sortedList.sort(cmp=lambda a, b: cmp(a._name, b._name))
|
sortedList.sort(key=lambda x: x._name)
|
||||||
for t in sortedList:
|
for t in sortedList:
|
||||||
print(" %s" % t._toVHDL(), file=f)
|
print(" %s" % t._toVHDL(), file=f)
|
||||||
print(file=f)
|
print(file=f)
|
||||||
@ -366,7 +366,7 @@ def _writeConstants(f):
|
|||||||
def _writeTypeDefs(f):
|
def _writeTypeDefs(f):
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
sortedList = list(_enumTypeSet)
|
sortedList = list(_enumTypeSet)
|
||||||
sortedList.sort(cmp=lambda a, b: cmp(a._name, b._name))
|
sortedList.sort(key=lambda x: x._name)
|
||||||
for t in sortedList:
|
for t in sortedList:
|
||||||
f.write("%s\n" % t._toVHDL())
|
f.write("%s\n" % t._toVHDL())
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user