mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1142609 - Fix PEP 8 E7xx warnings in dom/bindings's Python code. r=peterv
This commit is contained in:
parent
abc99af344
commit
b77e18ed9a
@ -2418,7 +2418,7 @@ def IsCrossOriginWritable(attr, descriptor):
|
||||
crossOriginWritable = attr.getExtendedAttribute("CrossOriginWritable")
|
||||
if not crossOriginWritable:
|
||||
return False
|
||||
if crossOriginWritable == True:
|
||||
if crossOriginWritable is True:
|
||||
return True
|
||||
assert (isinstance(crossOriginWritable, list) and
|
||||
len(crossOriginWritable) == 1)
|
||||
@ -2598,7 +2598,7 @@ class CGNativeProperties(CGList):
|
||||
if item.get("hasIteratorAlias"):
|
||||
iteratorAliasIndex = index
|
||||
break
|
||||
nativeProps.append(CGGeneric(str(iteratorAliasIndex)));
|
||||
nativeProps.append(CGGeneric(str(iteratorAliasIndex)))
|
||||
return CGWrapper(CGIndenter(CGList(nativeProps, ",\n")),
|
||||
pre="static const NativeProperties %s = {\n" % name,
|
||||
post="\n};\n")
|
||||
@ -12213,7 +12213,7 @@ class CGDictionary(CGThing):
|
||||
"%s");
|
||||
}
|
||||
""" % self.getMemberSourceDescription(member))
|
||||
conversionReplacements["convert"] = indent(conversionReplacements["convert"]).rstrip();
|
||||
conversionReplacements["convert"] = indent(conversionReplacements["convert"]).rstrip()
|
||||
else:
|
||||
conversion += (
|
||||
"if (!isNull && !temp->isUndefined()) {\n"
|
||||
@ -12362,7 +12362,7 @@ class CGDictionary(CGThing):
|
||||
# dictionaries. Either we're being constructed-but-not-initialized
|
||||
# ourselves (and then we don't want to init them) or we're about to
|
||||
# init ourselves and then we'll init them anyway.
|
||||
return CGDictionary.getNonInitializingCtorArg();
|
||||
return CGDictionary.getNonInitializingCtorArg()
|
||||
return None
|
||||
|
||||
def getMemberSourceDescription(self, member):
|
||||
@ -15409,7 +15409,7 @@ class GlobalGenRoots():
|
||||
|
||||
@staticmethod
|
||||
def GeneratedEventList(config):
|
||||
eventList = CGList([]);
|
||||
eventList = CGList([])
|
||||
for generatedEvent in config.generatedEvents:
|
||||
eventList.append(CGGeneric(declare=("GENERATED_EVENT(%s)\n" % generatedEvent)))
|
||||
return eventList
|
||||
@ -15872,7 +15872,7 @@ class CGEventMethod(CGNativeMember):
|
||||
# use AppendElements, which is actually a template on
|
||||
# the incoming type on nsTArray and does the right thing
|
||||
# for this case.
|
||||
target = name;
|
||||
target = name
|
||||
source = "%s.%s" % (self.args[1].name, name)
|
||||
sequenceCopy = "e->%s.AppendElements(%s);\n"
|
||||
if m.type.nullable():
|
||||
|
@ -27,8 +27,8 @@ class Configuration:
|
||||
self.descriptors = []
|
||||
self.interfaces = {}
|
||||
self.optimizedOutDescriptorNames = set()
|
||||
self.generatedEvents = generatedEvents;
|
||||
self.maxProtoChainLength = 0;
|
||||
self.generatedEvents = generatedEvents
|
||||
self.maxProtoChainLength = 0
|
||||
for thing in parseData:
|
||||
if isinstance(thing, IDLImplementsStatement):
|
||||
# Our build system doesn't support dep build involving
|
||||
@ -50,7 +50,7 @@ class Configuration:
|
||||
"%s" %
|
||||
(thing.location, thing.implementor.location))
|
||||
|
||||
assert not thing.isType();
|
||||
assert not thing.isType()
|
||||
|
||||
if not thing.isInterface():
|
||||
continue
|
||||
@ -111,7 +111,7 @@ class Configuration:
|
||||
mainTypes |= set(getFlatTypes(getTypesFromDescriptor(descriptor)))
|
||||
(mainCallbacks, mainDictionaries) = findCallbacksAndDictionaries(mainTypes)
|
||||
|
||||
workerTypes = set();
|
||||
workerTypes = set()
|
||||
for descriptor in ([self.getDescriptor("DummyInterfaceWorkers", workers=True)] +
|
||||
self.getDescriptors(workers=True, isExternal=False, skipGen=False)):
|
||||
workerTypes |= set(getFlatTypes(getTypesFromDescriptor(descriptor)))
|
||||
@ -213,7 +213,7 @@ class Configuration:
|
||||
elif key == 'isJSImplemented':
|
||||
getter = lambda x: x.interface.isJSImplemented()
|
||||
elif key == 'isNavigatorProperty':
|
||||
getter = lambda x: x.interface.getNavigatorProperty() != None
|
||||
getter = lambda x: x.interface.getNavigatorProperty() is not None
|
||||
elif key == 'isExposedInAnyWorker':
|
||||
getter = lambda x: x.interface.isExposedInAnyWorker()
|
||||
elif key == 'isExposedInSystemGlobals':
|
||||
@ -276,7 +276,7 @@ class Configuration:
|
||||
"and a consequential interface) without an explicit "
|
||||
"Bindings.conf annotation." % interfaceName)
|
||||
|
||||
raise NoSuchDescriptorError("For " + interfaceName + " found no matches");
|
||||
raise NoSuchDescriptorError("For " + interfaceName + " found no matches")
|
||||
|
||||
def getDescriptorProvider(self, workers):
|
||||
"""
|
||||
@ -453,7 +453,7 @@ class Descriptor(DescriptorProvider):
|
||||
if m.isMethod() and m.isLegacycaller():
|
||||
if not m.isIdentifierLess():
|
||||
raise TypeError("We don't support legacycaller with "
|
||||
"identifier.\n%s" % m.location);
|
||||
"identifier.\n%s" % m.location)
|
||||
if len(m.signatures()) != 1:
|
||||
raise TypeError("We don't support overloaded "
|
||||
"legacycaller.\n%s" % m.location)
|
||||
@ -511,7 +511,7 @@ class Descriptor(DescriptorProvider):
|
||||
iface.setUserData('hasProxyDescendant', True)
|
||||
iface = iface.parent
|
||||
|
||||
if desc.get('wantsQI', None) != None:
|
||||
if desc.get('wantsQI', None) is not None:
|
||||
self._wantsQI = desc.get('wantsQI', None)
|
||||
self.wrapperCache = (not self.interface.isCallback() and
|
||||
desc.get('wrapperCache', True))
|
||||
|
@ -50,9 +50,9 @@ for [name, prop, id, flags, pref] in propList:
|
||||
", ".join(extendedAttrs),
|
||||
name)
|
||||
|
||||
idlFile = open(sys.argv[1], "r");
|
||||
idlTemplate = idlFile.read();
|
||||
idlFile.close();
|
||||
idlFile = open(sys.argv[1], "r")
|
||||
idlTemplate = idlFile.read()
|
||||
idlFile.close()
|
||||
|
||||
print ("/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT */\n\n" +
|
||||
string.Template(idlTemplate).substitute({"props": props}))
|
||||
|
@ -45,7 +45,7 @@ class WebIDLProvider(MachCommandBase):
|
||||
# objdir. But we're going to try loading it as a python
|
||||
# module, so we need to make sure the objdir is in our search
|
||||
# path.
|
||||
sys.path.insert(0, self.topobjdir);
|
||||
sys.path.insert(0, self.topobjdir)
|
||||
|
||||
from runtests import run_tests
|
||||
return run_tests(None, verbose=verbose)
|
||||
|
@ -176,7 +176,7 @@ class WebIDLCodegenManager(LoggingMixin):
|
||||
self._input_paths = set(input_paths)
|
||||
self._exported_stems = set(exported_stems)
|
||||
self._generated_events_stems = set(generated_events_stems)
|
||||
self._generated_events_stems_as_array = generated_events_stems;
|
||||
self._generated_events_stems_as_array = generated_events_stems
|
||||
self._example_interfaces = set(example_interfaces)
|
||||
self._exported_header_dir = exported_header_dir
|
||||
self._codegen_dir = codegen_dir
|
||||
|
@ -168,7 +168,7 @@ class IDLObject(object):
|
||||
return False
|
||||
|
||||
def isDictionary(self):
|
||||
return False;
|
||||
return False
|
||||
|
||||
def isUnion(self):
|
||||
return False
|
||||
@ -203,7 +203,7 @@ class IDLObject(object):
|
||||
# NB: We can't use visited=set() above because the default value is
|
||||
# evaluated when the def statement is evaluated, not when the function
|
||||
# is executed, so there would be one set for all invocations.
|
||||
if visited == None:
|
||||
if visited is None:
|
||||
visited = set()
|
||||
|
||||
if self in visited:
|
||||
@ -892,7 +892,7 @@ class IDLInterface(IDLObjectWithScope, IDLExposureMixins):
|
||||
iface.identifier.name),
|
||||
[self.maplikeOrSetlike.location,
|
||||
iface.maplikeOrSetlike.location])
|
||||
additionalMembers = iface.originalMembers;
|
||||
additionalMembers = iface.originalMembers
|
||||
for additionalMember in additionalMembers:
|
||||
for member in self.members:
|
||||
if additionalMember.identifier.name == member.identifier.name:
|
||||
@ -1346,7 +1346,7 @@ class IDLInterface(IDLObjectWithScope, IDLExposureMixins):
|
||||
newMethod = self.parentScope.lookupIdentifier(method.identifier)
|
||||
if newMethod == method:
|
||||
self.namedConstructors.append(method)
|
||||
elif not newMethod in self.namedConstructors:
|
||||
elif newMethod not in self.namedConstructors:
|
||||
raise WebIDLError("NamedConstructor conflicts with a NamedConstructor of a different interface",
|
||||
[method.location, newMethod.location])
|
||||
elif (identifier == "ArrayClass"):
|
||||
@ -1558,7 +1558,7 @@ class IDLDictionary(IDLObjectWithScope):
|
||||
return "Dictionary '%s'" % self.identifier.name
|
||||
|
||||
def isDictionary(self):
|
||||
return True;
|
||||
return True
|
||||
|
||||
def canBeEmpty(self):
|
||||
"""
|
||||
@ -2132,10 +2132,10 @@ class IDLSequenceType(IDLType):
|
||||
return False
|
||||
|
||||
def isPrimitive(self):
|
||||
return False;
|
||||
return False
|
||||
|
||||
def isString(self):
|
||||
return False;
|
||||
return False
|
||||
|
||||
def isByteString(self):
|
||||
return False
|
||||
@ -3266,7 +3266,7 @@ class IDLValue(IDLObject):
|
||||
(self.value == float("inf") or self.value == float("-inf") or
|
||||
math.isnan(self.value))):
|
||||
raise WebIDLError("Trying to convert unrestricted value %s to non-unrestricted"
|
||||
% self.value, [location]);
|
||||
% self.value, [location])
|
||||
return self
|
||||
elif self.type.isString() and type.isUSVString():
|
||||
# Allow USVStrings to use default value just like
|
||||
@ -4106,7 +4106,7 @@ class IDLArgument(IDLObjectWithIdentifier):
|
||||
[attribute.location])
|
||||
if self.enforceRange:
|
||||
raise WebIDLError("[EnforceRange] and [Clamp] are mutually exclusive",
|
||||
[self.location]);
|
||||
[self.location])
|
||||
self.clamp = True
|
||||
elif identifier == "EnforceRange":
|
||||
if not attribute.noArguments():
|
||||
@ -4114,7 +4114,7 @@ class IDLArgument(IDLObjectWithIdentifier):
|
||||
[attribute.location])
|
||||
if self.clamp:
|
||||
raise WebIDLError("[EnforceRange] and [Clamp] are mutually exclusive",
|
||||
[self.location]);
|
||||
[self.location])
|
||||
self.enforceRange = True
|
||||
elif identifier == "TreatNonCallableAsNull":
|
||||
self._allowTreatNonCallableAsNull = True
|
||||
@ -4665,10 +4665,10 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
self._unforgeable = True
|
||||
elif identifier == "SameObject":
|
||||
raise WebIDLError("Methods must not be flagged as [SameObject]",
|
||||
[attr.location, self.location]);
|
||||
[attr.location, self.location])
|
||||
elif identifier == "Constant":
|
||||
raise WebIDLError("Methods must not be flagged as [Constant]",
|
||||
[attr.location, self.location]);
|
||||
[attr.location, self.location])
|
||||
elif identifier == "PutForwards":
|
||||
raise WebIDLError("Only attributes support [PutForwards]",
|
||||
[attr.location, self.location])
|
||||
@ -4748,7 +4748,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
class IDLImplementsStatement(IDLObject):
|
||||
def __init__(self, location, implementor, implementee):
|
||||
IDLObject.__init__(self, location)
|
||||
self.implementor = implementor;
|
||||
self.implementor = implementor
|
||||
self.implementee = implementee
|
||||
self._finished = False
|
||||
|
||||
@ -5364,7 +5364,7 @@ class Parser(Tokenizer):
|
||||
# We don't know ahead of time what type the integer literal is.
|
||||
# Determine the smallest type it could possibly fit in and use that.
|
||||
integerType = matchIntegerValueToType(p[1])
|
||||
if integerType == None:
|
||||
if integerType is None:
|
||||
raise WebIDLError("Integer literal out of range", [location])
|
||||
|
||||
p[0] = IDLValue(location, integerType, p[1])
|
||||
|
Loading…
Reference in New Issue
Block a user