style: autopep8

Bug: 1468273
Reviewed-by: ted
MozReview-Commit-ID: 8j8EU3E08GP
This commit is contained in:
Sylvestre Ledru 2018-06-10 14:13:44 +02:00 committed by Emilio Cobos Álvarez
parent b539ae7fe5
commit 498592ff61
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 12 additions and 7 deletions

View file

@ -28,5 +28,6 @@ predefined! {
f.write(' "%s",\n' % name)
f.write('}\n')
if __name__ == "__main__":
main(os.path.join(os.path.dirname(__file__), "predefined.rs"))

View file

@ -21,7 +21,7 @@ PRELUDE = """
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Autogenerated file created by components/style/gecko/binding_tools/regen_atoms.py, DO NOT EDIT DIRECTLY */
"""[1:]
"""[1:] # NOQA: E501
def gnu_symbolify(source, ident):
@ -57,7 +57,7 @@ class CSSPseudoElementsAtomSource:
class CSSAnonBoxesAtomSource:
PATTERN = re.compile('^(CSS_ANON_BOX|CSS_NON_INHERITING_ANON_BOX|CSS_WRAPPER_ANON_BOX)\(([^,]*),[^"]*"([^"]*)"\)',
PATTERN = re.compile('^(CSS_ANON_BOX|CSS_NON_INHERITING_ANON_BOX|CSS_WRAPPER_ANON_BOX)\(([^,]*),[^"]*"([^"]*)"\)', # NOQA: E501
re.MULTILINE)
FILE = "include/nsCSSAnonBoxList.h"
CLASS = "nsCSSAnonBoxes"

View file

@ -49,7 +49,8 @@ STYLE_STRUCT_LIST = [
def main():
usage = "Usage: %s [ servo | gecko ] [ style-crate | geckolib <template> | html ]" % sys.argv[0]
usage = ("Usage: %s [ servo | gecko ] [ style-crate | geckolib <template> | html ]" %
sys.argv[0])
if len(sys.argv) < 3:
abort(usage)
product = sys.argv[1]
@ -122,7 +123,7 @@ def render(filename, **context):
# Uncomment to debug generated Python code:
# write("/tmp", "mako_%s.py" % os.path.basename(filename), template.code)
return template.render(**context).encode("utf8")
except:
except Exception:
# Uncomment to see a traceback in generated Python code:
# raise
abort(exceptions.text_error_template().render().encode("utf8"))

View file

@ -75,7 +75,8 @@ class Keyword(object):
self.name = name
self.values = values.split()
if gecko_constant_prefix and gecko_enum_prefix:
raise TypeError("Only one of gecko_constant_prefix and gecko_enum_prefix can be specified")
raise TypeError("Only one of gecko_constant_prefix and gecko_enum_prefix "
"can be specified")
self.gecko_constant_prefix = gecko_constant_prefix or \
"NS_STYLE_" + self.name.upper().replace("-", "_")
self.gecko_enum_prefix = gecko_enum_prefix
@ -116,7 +117,8 @@ class Keyword(object):
raise Exception("Bad product: " + product)
def gecko_constant(self, value):
moz_stripped = value.replace("-moz-", '') if self.gecko_strip_moz_prefix else value.replace("-moz-", 'moz-')
moz_stripped = (value.replace("-moz-", '')
if self.gecko_strip_moz_prefix else value.replace("-moz-", 'moz-'))
mapped = self.consts_map.get(value)
if self.gecko_enum_prefix:
parts = moz_stripped.replace('-', '_').split('_')
@ -167,7 +169,8 @@ class Longhand(object):
gecko_ffi_name=None,
allowed_in_keyframe_block=True, cast_type='u8',
logical=False, alias=None, extra_prefixes=None, boxed=False,
flags=None, allowed_in_page_rule=False, allow_quirks=False, ignored_when_colors_disabled=False,
flags=None, allowed_in_page_rule=False, allow_quirks=False,
ignored_when_colors_disabled=False,
vector=False, servo_restyle_damage="repaint"):
self.name = name
if not spec: