Bug 1142609 - Fix PEP 8 E128 warnings in dom/bindings's Python code. r=peterv
authorSamy Dindane <samy@dindane.com>
Mon, 10 Aug 2015 18:26:29 +0200
changeset 290431 0ed3871c8b48ae9ac5c88498343135ec647fb379
parent 290430 909c65a99bb9c707ce9b9ec5f019af325751b759
child 290432 df60475dada2fecbf061fd204f59491f1760ca31
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1142609
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1142609 - Fix PEP 8 E128 warnings in dom/bindings's Python code. r=peterv
dom/bindings/Codegen.py
dom/bindings/Configuration.py
dom/bindings/GenerateCSS2PropertiesWebIDL.py
dom/bindings/mach_commands.py
dom/bindings/mozwebidlcodegen/__init__.py
dom/bindings/mozwebidlcodegen/test/test_mozwebidlcodegen.py
dom/bindings/parser/WebIDL.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -2886,28 +2886,30 @@ class CGCreateInterfaceObjectsMethod(CGA
                     getSymbolJSID = None
                     defineFn = "JS_DefineProperty"
                     prop = '"%s"' % alias
                 return CGList([
                     getSymbolJSID,
                     # XXX If we ever create non-enumerate properties that can be
                     #     aliased, we should consider making the aliases match
                     #     the enumerability of the property being aliased.
-                    CGGeneric(fill("""
-                    if (!${defineFn}(aCx, proto, ${prop}, aliasedVal, JSPROP_ENUMERATE)) {
-                      return;
-                    }
-                    """,
-                    defineFn=defineFn,
-                    prop=prop))
+                    CGGeneric(fill(
+                        """
+                        if (!${defineFn}(aCx, proto, ${prop}, aliasedVal, JSPROP_ENUMERATE)) {
+                          return;
+                        }
+                        """,
+                        defineFn=defineFn,
+                        prop=prop))
                 ], "\n")
 
             def defineAliasesFor(m):
                 return CGList([
-                    CGGeneric(fill("""
+                    CGGeneric(fill(
+                        """
                         if (!JS_GetProperty(aCx, proto, \"${prop}\", &aliasedVal)) {
                           return;
                         }
                         """,
                         prop=m.identifier.name))
                 ] + [defineAlias(alias) for alias in sorted(m.aliases)])
 
             defineAliases = CGList([
@@ -2986,18 +2988,19 @@ class CGGetProtoObjectHandleMethod(CGGet
 
 
 class CGGetProtoObjectMethod(CGAbstractMethod):
     """
     A method for getting the interface prototype object.
     """
     def __init__(self, descriptor):
         CGAbstractMethod.__init__(
-            self, descriptor, "GetProtoObject", "JSObject*", [Argument('JSContext*', 'aCx'),
-                Argument('JS::Handle<JSObject*>', 'aGlobal')])
+            self, descriptor, "GetProtoObject", "JSObject*",
+            [Argument('JSContext*', 'aCx'),
+             Argument('JS::Handle<JSObject*>', 'aGlobal')])
 
     def definition_body(self):
         return "return GetProtoObjectHandle(aCx, aGlobal);\n"
 
 class CGGetConstructorObjectHandleMethod(CGGetPerInterfaceObject):
     """
     A method for getting the interface constructor object.
     """
@@ -3015,18 +3018,19 @@ class CGGetConstructorObjectHandleMethod
             """) + CGGetPerInterfaceObject.definition_body(self)
 
 class CGGetConstructorObjectMethod(CGAbstractMethod):
     """
     A method for getting the interface constructor object.
     """
     def __init__(self, descriptor):
         CGAbstractMethod.__init__(
-            self, descriptor, "GetConstructorObject", "JSObject*", [Argument('JSContext*', 'aCx'),
-                Argument('JS::Handle<JSObject*>', 'aGlobal')])
+            self, descriptor, "GetConstructorObject", "JSObject*",
+            [Argument('JSContext*', 'aCx'),
+             Argument('JS::Handle<JSObject*>', 'aGlobal')])
 
     def definition_body(self):
         return "return GetConstructorObjectHandle(aCx, aGlobal);\n"
 
 class CGGetNamedPropertiesObjectMethod(CGAbstractStaticMethod):
     def __init__(self, descriptor):
         args = [Argument('JSContext*', 'aCx'),
                 Argument('JS::Handle<JSObject*>', 'aGlobal')]
@@ -3186,18 +3190,20 @@ class CGConstructorEnabled(CGAbstractMet
         if checkAllPermissions is not None:
             conditions.append("CheckAllPermissions(aCx, aObj, allpermissions_%i)" % checkAllPermissions)
         # We should really have some conditions
         assert len(body) or len(conditions)
 
         conditionsWrapper = ""
         if len(conditions):
             conditionsWrapper = CGWrapper(CGList((CGGeneric(cond) for cond in conditions),
-                                               " &&\n"),
-                                        pre="return ", post=";\n", reindent=True)
+                                                 " &&\n"),
+                                          pre="return ",
+                                          post=";\n",
+                                          reindent=True)
         else:
             conditionsWrapper = CGGeneric("return true;\n")
 
         body.append(conditionsWrapper)
         return body.define()
 
 
 def CreateBindingJSObject(descriptor, properties):
@@ -4306,24 +4312,25 @@ def getJSToNativeConversionInfo(type, de
             # We'll get traced by the sequence or dictionary or union tracer
             declType = CGGeneric("JSObject*")
             declArgs = None
         templateBody = "${declName} = &${val}.toObject();\n"
 
         # For JS-implemented APIs, we refuse to allow passing objects that the
         # API consumer does not subsume.
         if not isinstance(descriptorProvider, Descriptor) or descriptorProvider.interface.isJSImplemented():
-            templateBody = fill("""
-                            if ($${passedToJSImpl} && !CallerSubsumes($${val})) {
-                              ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "${sourceDescription}");
-                              $*{exceptionCode}
-                            }
-                            """,
-                            sourceDescription=sourceDescription,
-                            exceptionCode=exceptionCode) + templateBody
+            templateBody = fill(
+                """
+                if ($${passedToJSImpl} && !CallerSubsumes($${val})) {
+                  ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "${sourceDescription}");
+                  $*{exceptionCode}
+                }
+                """,
+                sourceDescription=sourceDescription,
+                exceptionCode=exceptionCode) + templateBody
 
         setToNullCode = "${declName} = nullptr;\n"
         template = wrapObjectTemplate(templateBody, type, setToNullCode,
                                       failureCode)
         return JSToNativeConversionInfo(template, declType=declType,
                                         dealWithOptional=isOptional,
                                         declArgs=declArgs)
 
@@ -5342,24 +5349,25 @@ def getJSToNativeConversionInfo(type, de
             declArgs = "cx"
 
         assert not isOptional
         templateBody = "${declName} = ${val};\n"
 
         # For JS-implemented APIs, we refuse to allow passing objects that the
         # API consumer does not subsume.
         if not isinstance(descriptorProvider, Descriptor) or descriptorProvider.interface.isJSImplemented():
-            templateBody = fill("""
-                            if ($${passedToJSImpl} && !CallerSubsumes($${val})) {
-                              ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "${sourceDescription}");
-                              $*{exceptionCode}
-                            }
-                            """,
-                            sourceDescription=sourceDescription,
-                            exceptionCode=exceptionCode) + templateBody
+            templateBody = fill(
+                """
+                if ($${passedToJSImpl} && !CallerSubsumes($${val})) {
+                  ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "${sourceDescription}");
+                  $*{exceptionCode}
+                }
+                """,
+                sourceDescription=sourceDescription,
+                exceptionCode=exceptionCode) + templateBody
 
         # We may not have a default value if we're being converted for
         # a setter, say.
         if defaultValue:
             if isinstance(defaultValue, IDLNullValue):
                 defaultHandling = "${declName} = JS::NullValue();\n"
             else:
                 assert isinstance(defaultValue, IDLUndefinedValue)
@@ -7814,17 +7822,17 @@ class CGGenericPromiseReturningMethod(CG
 
     Does not handle cross-origin this.
     """
     def __init__(self, descriptor):
         unwrapFailureCode = dedent("""
             ThrowInvalidThis(cx, args, GetInvalidThisErrorForMethod(%%(securityError)s), "%s");\n
             return ConvertExceptionToPromise(cx, xpc::XrayAwareCalleeGlobal(callee),
                                              args.rval());\n""" %
-            descriptor.interface.identifier.name)
+                                   descriptor.interface.identifier.name)
 
         name = "genericPromiseReturningMethod"
         customCallArgs = dedent("""
             JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
             // Make sure to save the callee before someone maybe messes with rval().
             JS::Rooted<JSObject*> callee(cx, &args.callee());
         """)
 
@@ -10562,41 +10570,44 @@ class CGDOMJSProxyHandler_getOwnPropDesc
             computeCondition = dedent("""
                 bool hasOnProto;
                 if (!HasPropertyOnPrototype(cx, proxy, id, &hasOnProto)) {
                   return false;
                 }
                 callNamedGetter = !hasOnProto;
                 """)
             if self.descriptor.interface.getExtendedAttribute('OverrideBuiltins'):
-                computeCondition = fill("""
+                computeCondition = fill(
+                    """
                     if (!isXray) {
                       callNamedGetter = true;
                     } else {
                       $*{hasOnProto}
                     }
                     """,
                     hasOnProto=computeCondition)
 
             outerCondition = "!ignoreNamedProps"
             if self.descriptor.supportsIndexedProperties():
                 outerCondition = "!IsArrayIndex(index) && " + outerCondition
 
+            namedGetCode = CGProxyNamedGetter(self.descriptor,
+                                              templateValues).define()
             namedGet = fill("""
                 bool callNamedGetter = false;
                 if (${outerCondition}) {
                   $*{computeCondition}
                 }
                 if (callNamedGetter) {
                   $*{namedGetCode}
                 }
                 """,
-                outerCondition=outerCondition,
-                computeCondition=computeCondition,
-                namedGetCode=CGProxyNamedGetter(self.descriptor, templateValues).define())
+                            outerCondition=outerCondition,
+                            computeCondition=computeCondition,
+                            namedGetCode=namedGetCode)
             namedGet += "\n"
         else:
             namedGet = ""
 
         return fill(
             """
             bool isXray = xpc::WrapperFactory::IsXrayWrapper(proxy);
             $*{getIndexed}
@@ -10810,17 +10821,18 @@ class CGDOMJSProxyHandler_delete(ClassMe
                 bool deleteSucceeded;
                 $*{namedBody}
                 if (found) {
                   return deleteSucceeded ? opresult.succeed() : opresult.failCantDelete();
                 }
                 """,
                 namedBody=namedBody)
             if not self.descriptor.interface.getExtendedAttribute('OverrideBuiltins'):
-                delete = fill("""
+                delete = fill(
+                    """
                     bool hasOnProto;
                     if (!HasPropertyOnPrototype(cx, proxy, id, &hasOnProto)) {
                       return false;
                     }
                     if (!hasOnProto) {
                       $*{delete}
                     }
                     """,
@@ -10931,17 +10943,18 @@ class CGDOMJSProxyHandler_hasOwn(ClassMe
                 """
                 bool found = false;
                 $*{presenceChecker}
 
                 *bp = found;
                 """,
                 presenceChecker=CGProxyNamedPresenceChecker(self.descriptor, foundVar="found").define())
             if not self.descriptor.interface.getExtendedAttribute('OverrideBuiltins'):
-                named = fill("""
+                named = fill(
+                    """
                     bool hasOnProto;
                     if (!HasPropertyOnPrototype(cx, proxy, id, &hasOnProto)) {
                       return false;
                     }
                     if (!hasOnProto) {
                       $*{protoLacksProperty}
                       return true;
                     }
@@ -11246,18 +11259,19 @@ class CGDOMJSProxyHandler_call(ClassMeth
             """
             return js::ForwardToNative(cx, ${legacyCaller}, args);
             """,
             legacyCaller=LEGACYCALLER_HOOK_NAME)
 
 
 class CGDOMJSProxyHandler_isCallable(ClassMethod):
     def __init__(self):
-        ClassMethod.__init__(self, "isCallable", "bool", [Argument('JSObject*', 'obj')],
-                           virtual=True, override=True, const=True)
+        ClassMethod.__init__(self, "isCallable", "bool",
+                             [Argument('JSObject*', 'obj')],
+                             virtual=True, override=True, const=True)
 
     def getBody(self):
         return dedent("""
             return true;
         """)
 
 
 class CGDOMJSProxyHandler(CGClass):
--- a/dom/bindings/Configuration.py
+++ b/dom/bindings/Configuration.py
@@ -708,20 +708,19 @@ class Descriptor(DescriptorProvider):
         An interface doesn't need a header file if it is not concrete, not
         pref-controlled, has no prototype object, has no static methods or
         attributes and has no parent.  The parent matters because we assert
         things about refcounting that depend on the actual underlying type if we
         have a parent.
 
         """
         return (self.interface.isExternal() or self.concrete or
-            self.interface.hasInterfacePrototypeObject() or
-            any((m.isAttr() or m.isMethod()) and m.isStatic() for m
-                in self.interface.members) or
-            self.interface.parent)
+                self.interface.hasInterfacePrototypeObject() or
+                any((m.isAttr() or m.isMethod()) and m.isStatic() for m in self.interface.members) or
+                self.interface.parent)
 
     def hasThreadChecks(self):
         return ((self.isExposedConditionally() and
                  not self.interface.isExposedInWindow()) or
                 self.interface.isExposedInSomeButNotAllWorkers())
 
     def isExposedConditionally(self):
         return (self.interface.isExposedConditionally() or
--- a/dom/bindings/GenerateCSS2PropertiesWebIDL.py
+++ b/dom/bindings/GenerateCSS2PropertiesWebIDL.py
@@ -41,17 +41,18 @@ for [name, prop, id, flags, pref] in pro
     # but also doesn't match "prop".  So the stuff we did with "prop" covers (3)
     # and all of (1) except "float".   If we now output attributes for all the
     # cases where "name" doesn't match "prop" and "name" doesn't start with "-",
     # that will cover "float" and (2).
     if prop != name and name[0] != "-":
         extendedAttrs.append('BinaryName="%s"' % prop)
         # Throw in a '_' before the attribute name, because some of these
         # property names collide with IDL reserved words.
-        props += "  [%s] attribute DOMString _%s;\n" % (", ".join(extendedAttrs),
-                                                       name)
+        props += "  [%s] attribute DOMString _%s;\n" % (
+            ", ".join(extendedAttrs),
+            name)
 
 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 }))
--- a/dom/bindings/mach_commands.py
+++ b/dom/bindings/mach_commands.py
@@ -14,33 +14,33 @@ from mach.decorators import (
 )
 
 from mozbuild.base import MachCommandBase
 
 
 @CommandProvider
 class WebIDLProvider(MachCommandBase):
     @Command('webidl-example', category='misc',
-        description='Generate example files for a WebIDL interface.')
+             description='Generate example files for a WebIDL interface.')
     @CommandArgument('interface', nargs='+',
-        help='Interface(s) whose examples to generate.')
+                     help='Interface(s) whose examples to generate.')
     def webidl_example(self, interface):
         from mozwebidlcodegen import BuildSystemWebIDL
 
         manager = self._spawn(BuildSystemWebIDL).manager
         for i in interface:
             manager.generate_example_files(i)
 
     @Command('webidl-parser-test', category='testing',
-        description='Run WebIDL tests (Interface Browser parser).')
+             description='Run WebIDL tests (Interface Browser parser).')
     @CommandArgument('--verbose', '-v', action='store_true',
-        help='Run tests in verbose mode.')
+                     help='Run tests in verbose mode.')
     def webidl_test(self, verbose=False):
         sys.path.insert(0, os.path.join(self.topsrcdir, 'other-licenses',
-            'ply'))
+                        'ply'))
 
         # Make sure we drop our cached grammar bits in the objdir, not
         # wherever we happen to be running from.
         os.chdir(self.topobjdir)
 
         # Now we're going to create the cached grammar file in the
         # 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
--- a/dom/bindings/mozwebidlcodegen/__init__.py
+++ b/dom/bindings/mozwebidlcodegen/__init__.py
@@ -143,18 +143,18 @@ class WebIDLCodegenManager(LoggingMixin)
         'RegisterBindings.cpp',
         'RegisterWorkerBindings.cpp',
         'ResolveSystemBinding.cpp',
         'UnionTypes.cpp',
         'PrototypeList.cpp',
     }
 
     def __init__(self, config_path, inputs, exported_header_dir,
-            codegen_dir, state_path, cache_dir=None, make_deps_path=None,
-            make_deps_target=None):
+                 codegen_dir, state_path, cache_dir=None, make_deps_path=None,
+                 make_deps_target=None):
         """Create an instance that manages WebIDLs in the build system.
 
         config_path refers to a WebIDL config file (e.g. Bindings.conf).
         inputs is a 4-tuple describing the input .webidl files and how to
         process them. Members are:
             (set(.webidl files), set(basenames of exported files),
                 set(basenames of generated events files),
                 set(example interface names))
@@ -180,32 +180,32 @@ class WebIDLCodegenManager(LoggingMixin)
         self._example_interfaces = set(example_interfaces)
         self._exported_header_dir = exported_header_dir
         self._codegen_dir = codegen_dir
         self._state_path = state_path
         self._cache_dir = cache_dir
         self._make_deps_path = make_deps_path
         self._make_deps_target = make_deps_target
 
-        if (make_deps_path and not make_deps_target) or (not make_deps_path and
-                make_deps_target):
+        if ((make_deps_path and not make_deps_target) or
+                (not make_deps_path and make_deps_target)):
             raise Exception('Must define both make_deps_path and make_deps_target '
-                'if one is defined.')
+                            'if one is defined.')
 
         self._parser_results = None
         self._config = None
         self._state = WebIDLCodegenManagerState()
 
         if os.path.exists(state_path):
             with open(state_path, 'rb') as fh:
                 try:
                     self._state = WebIDLCodegenManagerState(fh=fh)
                 except Exception as e:
                     self.log(logging.WARN, 'webidl_bad_state', {'msg': str(e)},
-                        'Bad WebIDL state: {msg}')
+                                           'Bad WebIDL state: {msg}')
 
     @property
     def config(self):
         if not self._config:
             self._parse_webidl()
 
         return self._config
 
@@ -308,18 +308,18 @@ class WebIDLCodegenManager(LoggingMixin)
 
         return self._maybe_write_codegen(root, *self._example_paths(interface))
 
     def _parse_webidl(self):
         import WebIDL
         from Configuration import Configuration
 
         self.log(logging.INFO, 'webidl_parse',
-            {'count': len(self._input_paths)},
-            'Parsing {count} WebIDL files.')
+                 {'count': len(self._input_paths)},
+                 'Parsing {count} WebIDL files.')
 
         hashes = {}
         parser = WebIDL.Parser(self._cache_dir)
 
         for path in sorted(self._input_paths):
             with open(path, 'rb') as fh:
                 data = fh.read()
                 hashes[path] = hashlib.sha1(data).hexdigest()
@@ -367,17 +367,17 @@ class WebIDLCodegenManager(LoggingMixin)
             changed_inputs |= self._input_paths
 
         # That's it for examining output files. We /could/ examine SHA-1's of
         # output files from a previous run to detect modifications. But that's
         # a lot of extra work and most build systems don't do that anyway.
 
         # Now we move on to the input files.
         old_hashes = {v['filename']: v['sha1']
-            for v in self._state['webidls'].values()}
+                      for v in self._state['webidls'].values()}
 
         old_filenames = set(old_hashes.keys())
         new_filenames = self._input_paths
 
         # If an old file has disappeared or a new file has arrived, mark
         # it.
         changed_inputs |= old_filenames ^ new_filenames
 
@@ -460,28 +460,28 @@ class WebIDLCodegenManager(LoggingMixin)
 
     def _generate_build_files_for_webidl(self, filename):
         from Codegen import (
             CGBindingRoot,
             CGEventRoot,
         )
 
         self.log(logging.INFO, 'webidl_generate_build_for_input',
-            {'filename': filename},
-            'Generating WebIDL files derived from {filename}')
+                 {'filename': filename},
+                 'Generating WebIDL files derived from {filename}')
 
         stem, binding_stem, is_event, header_dir, files = self._binding_info(filename)
         root = CGBindingRoot(self._config, binding_stem, filename)
 
         result = self._maybe_write_codegen(root, files[0], files[1])
 
         if is_event:
             generated_event = CGEventRoot(self._config, stem)
             result = self._maybe_write_codegen(generated_event, files[2],
-                files[3], result)
+                                               files[3], result)
 
         return result, root.deps()
 
     def _global_dependencies_changed(self):
         """Determine whether the global dependencies have changed."""
         current_files = set(iter_modules_in_path(mozpath.dirname(__file__)))
 
         # We need to catch other .py files from /dom/bindings. We assume these
@@ -539,17 +539,17 @@ def create_build_system_manager(topsrcdi
     """Create a WebIDLCodegenManager for use by the build system."""
     src_dir = os.path.join(topsrcdir, 'dom', 'bindings')
     obj_dir = os.path.join(topobjdir, 'dom', 'bindings')
 
     with open(os.path.join(obj_dir, 'file-lists.json'), 'rb') as fh:
         files = json.load(fh)
 
     inputs = (files['webidls'], files['exported_stems'],
-        files['generated_events_stems'], files['example_interfaces'])
+              files['generated_events_stems'], files['example_interfaces'])
 
     cache_dir = os.path.join(obj_dir, '_cache')
     try:
         os.makedirs(cache_dir)
     except OSError as e:
         if e.errno != errno.EEXIST:
             raise
 
--- a/dom/bindings/mozwebidlcodegen/test/test_mozwebidlcodegen.py
+++ b/dom/bindings/mozwebidlcodegen/test/test_mozwebidlcodegen.py
@@ -37,17 +37,17 @@ class TestWebIDLCodegenManager(unittest.
         'Parent',
         'ExampleBinding',
         'TestEvent',
     }
 
     @property
     def _static_input_paths(self):
         s = {mozpath.join(OUR_DIR, p) for p in os.listdir(OUR_DIR)
-            if p.endswith('.webidl')}
+             if p.endswith('.webidl')}
 
         return s
 
     @property
     def _config_path(self):
         config = mozpath.join(TOPSRCDIR, 'dom', 'bindings', 'Bindings.conf')
         self.assertTrue(os.path.exists(config))
 
@@ -93,17 +93,17 @@ class TestWebIDLCodegenManager(unittest.
             json.dump({
                 'version': WebIDLCodegenManagerState.VERSION + 1,
                 'foobar': '1',
             }, fh)
 
         manager = WebIDLCodegenManager(**args)
 
         self.assertEqual(manager._state['version'],
-            WebIDLCodegenManagerState.VERSION)
+                         WebIDLCodegenManagerState.VERSION)
         self.assertNotIn('foobar', manager._state)
 
     def test_generate_build_files(self):
         """generate_build_files() does the right thing from empty."""
         manager = self._get_manager()
         result = manager.generate_build_files()
         self.assertEqual(len(result.inputs), 5)
 
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -1064,21 +1064,22 @@ class IDLInterface(IDLObjectWithScope, I
                 "%s is an unforgeable consequential interface" %
                 self.identifier.name,
                 [self.location] +
                 list(i.location for i in
                      (self.interfacesBasedOnSelf - { self }) ))
 
         # We also don't support inheriting from unforgeable interfaces.
         if self.getExtendedAttribute("Unforgeable") and self.hasChildInterfaces():
+            locations = ([self.location] +
+                         list(i.location for i in
+                              self.interfacesBasedOnSelf if i.parent == self))
             raise WebIDLError("%s is an unforgeable ancestor interface" %
-                self.identifier.name,
-                [self.location] +
-                list(i.location for i in
-                     self.interfacesBasedOnSelf if i.parent == self))
+                              self.identifier.name,
+                              locations)
 
         for member in self.members:
             member.validate()
 
             if self.isCallback() and member.getExtendedAttribute("Replaceable"):
                 raise WebIDLError("[Replaceable] used on an attribute on "
                                   "interface %s which is a callback interface" %
                                   self.identifier.name,
@@ -4357,17 +4358,17 @@ class IDLMethod(IDLInterfaceMember, IDLS
     def isCreator(self):
         return self._creator
 
     def isDeleter(self):
         return self._deleter
 
     def isNamed(self):
         assert (self._specialType == IDLMethod.NamedOrIndexed.Named or
-               self._specialType == IDLMethod.NamedOrIndexed.Indexed)
+                self._specialType == IDLMethod.NamedOrIndexed.Indexed)
         return self._specialType == IDLMethod.NamedOrIndexed.Named
 
     def isIndexed(self):
         assert (self._specialType == IDLMethod.NamedOrIndexed.Named or
                 self._specialType == IDLMethod.NamedOrIndexed.Indexed)
         return self._specialType == IDLMethod.NamedOrIndexed.Indexed
 
     def isLegacycaller(self):
@@ -4900,20 +4901,20 @@ class Tokenizer(object):
         "maplike": "MAPLIKE",
         "setlike": "SETLIKE"
         }
 
     tokens.extend(keywords.values())
 
     def t_error(self, t):
         raise WebIDLError("Unrecognized Input",
-               [Location(lexer=self.lexer,
-                         lineno=self.lexer.lineno,
-                         lexpos=self.lexer.lexpos,
-                         filename = self.filename)])
+                          [Location(lexer=self.lexer,
+                                    lineno=self.lexer.lineno,
+                                    lexpos=self.lexer.lexpos,
+                                    filename=self.filename)])
 
     def __init__(self, outputdir, lexer=None):
         if lexer:
             self.lexer = lexer
         else:
             self.lexer = lex.lex(object=self,
                                  outputdir=outputdir,
                                  lextab='webidllex',
@@ -5529,25 +5530,28 @@ class Parser(Tokenizer):
         # identifier might be None.  This is only permitted for special methods.
         if not identifier:
             if (not getter and not setter and not creator and
                 not deleter and not legacycaller and not stringifier):
                 raise WebIDLError("Identifier required for non-special methods",
                                   [self.getLocation(p, 2)])
 
             location = BuiltinLocation("<auto-generated-identifier>")
-            identifier = IDLUnresolvedIdentifier(location, "__%s%s%s%s%s%s%s" %
-                ("named" if specialType == IDLMethod.NamedOrIndexed.Named else \
+            identifier = IDLUnresolvedIdentifier(
+                location,
+                "__%s%s%s%s%s%s%s" %
+                ("named" if specialType == IDLMethod.NamedOrIndexed.Named else
                  "indexed" if specialType == IDLMethod.NamedOrIndexed.Indexed else "",
                  "getter" if getter else "",
                  "setter" if setter else "",
                  "deleter" if deleter else "",
                  "creator" if creator else "",
                  "legacycaller" if legacycaller else "",
-                 "stringifier" if stringifier else ""), allowDoubleUnderscore=True)
+                 "stringifier" if stringifier else ""),
+                allowDoubleUnderscore=True)
 
         method = IDLMethod(self.getLocation(p, 2), identifier, returnType, arguments,
                            static=static, getter=getter, setter=setter, creator=creator,
                            deleter=deleter, specialType=specialType,
                            legacycaller=legacycaller, stringifier=stringifier)
         p[0] = method
 
     def p_Stringifier(self, p):