mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fix tidiness errors for Python3 compatibility across whole repo
This commit is contained in:
parent
9d04f231f4
commit
7b5fabe855
10 changed files with 51 additions and 41 deletions
|
@ -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():
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue