aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authormarmeladema <xademax@gmail.com>2019-12-10 23:56:12 +0000
committermarmeladema <xademax@gmail.com>2019-12-11 16:03:20 +0000
commit7b5fabe8552b9245a70961db9ec592a55102bb0e (patch)
treeb31bc428ddabb8dfeaabafaff504f4db7e937401 /components/script/dom/bindings/codegen
parent9d04f231f4a32050d78221d4e13d4951df649269 (diff)
downloadservo-7b5fabe8552b9245a70961db9ec592a55102bb0e.tar.gz
servo-7b5fabe8552b9245a70961db9ec592a55102bb0e.zip
Fix tidiness errors for Python3 compatibility across whole repo
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py14
-rw-r--r--components/script/dom/bindings/codegen/Configuration.py6
2 files changed, 11 insertions, 9 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 39e8bfa275d..ec29a59c9d4 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -3943,8 +3943,8 @@ class CGMemberJITInfo(CGThing):
depth=self.descriptor.interface.inheritanceDepth(),
opType=opType,
aliasSet=aliasSet,
- returnType=reduce(CGMemberJITInfo.getSingleReturnType, returnTypes,
- ""),
+ returnType=functools.reduce(CGMemberJITInfo.getSingleReturnType, returnTypes,
+ ""),
isInfallible=toStringBool(infallible),
isMovable=toStringBool(movable),
# FIXME(nox): https://github.com/servo/servo/issues/10991
@@ -4131,8 +4131,8 @@ class CGMemberJITInfo(CGThing):
if u.hasNullableType:
# Might be null or not
return "JSVAL_TYPE_UNKNOWN"
- return reduce(CGMemberJITInfo.getSingleReturnType,
- u.flatMemberTypes, "")
+ return functools.reduce(CGMemberJITInfo.getSingleReturnType,
+ u.flatMemberTypes, "")
if t.isDictionary():
return "JSVAL_TYPE_OBJECT"
if t.isDate():
@@ -4202,8 +4202,8 @@ class CGMemberJITInfo(CGThing):
if t.isUnion():
u = t.unroll()
type = "JSJitInfo::Null as i32" if u.hasNullableType else ""
- return reduce(CGMemberJITInfo.getSingleArgType,
- u.flatMemberTypes, type)
+ return functools.reduce(CGMemberJITInfo.getSingleArgType,
+ u.flatMemberTypes, type)
if t.isDictionary():
return "JSJitInfo_ArgType::Object as i32"
if t.isDate():
@@ -5858,7 +5858,7 @@ class CGInterfaceTrait(CGThing):
def contains_unsafe_arg(arguments):
if not arguments or len(arguments) == 0:
return False
- return reduce((lambda x, y: x or y[1] == '*mut JSContext'), arguments, False)
+ return functools.reduce((lambda x, y: x or y[1] == '*mut JSContext'), arguments, False)
methods = []
for name, arguments, rettype in members():
diff --git a/components/script/dom/bindings/codegen/Configuration.py b/components/script/dom/bindings/codegen/Configuration.py
index 71c988e5378..84d8bd974aa 100644
--- a/components/script/dom/bindings/codegen/Configuration.py
+++ b/components/script/dom/bindings/codegen/Configuration.py
@@ -2,6 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
+import functools
import os
from WebIDL import IDLExternalInterface, IDLSequenceType, IDLWrapperType, WebIDLError
@@ -15,7 +16,7 @@ class Configuration:
def __init__(self, filename, parseData):
# Read the configuration file.
glbl = {}
- execfile(filename, glbl)
+ exec(compile(open(filename).read(), filename, 'exec'), glbl)
config = glbl['DOMInterfaces']
# Build descriptors for all the interfaces we have in the parse data.
@@ -62,7 +63,8 @@ class Configuration:
c.isCallback() and not c.isInterface()]
# Keep the descriptor list sorted for determinism.
- self.descriptors.sort(lambda x, y: cmp(x.name, y.name))
+ cmp = lambda x, y: (x > y) - (x < y)
+ self.descriptors.sort(key=functools.cmp_to_key(lambda x, y: cmp(x.name, y.name)))
def getInterface(self, ifname):
return self.interfaces[ifname]