From 81aa9727aa2ff29856c3aed2167fd4203476d379 Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Fri, 6 May 2022 15:43:51 +0100 Subject: [PATCH] run black --- Lib/axisregistry/__init__.py | 50 ++-- Lib/axisregistry/axes_pb2.py | 467 ++++++++++++++++++++++----------- setup.py | 37 ++- tests/test_axisregistry_api.py | 4 +- 4 files changed, 355 insertions(+), 203 deletions(-) diff --git a/Lib/axisregistry/__init__.py b/Lib/axisregistry/__init__.py index 07106d7b7..7de00b155 100644 --- a/Lib/axisregistry/__init__.py +++ b/Lib/axisregistry/__init__.py @@ -22,29 +22,31 @@ def AxisRegistry(): axis = get_Protobuf_Message(AxisProto, path) registry[axis.tag] = axis # pylint: disable=E1101 - for axis in ["casual.textproto", - "cursive.textproto", - "fill.textproto", - "flair.textproto", - "grade.textproto", - "italic.textproto", - "monospace.textproto", - "optical_size.textproto", - "slant.textproto", - "softness.textproto", - "volume.textproto", - "weight.textproto", - "width.textproto", - "wonky.textproto", - "x_opaque.textproto", - "x_transparent_figures.textproto", - "x_transparent.textproto", - "y_opaque.textproto", - "y_transparent_ascender.textproto", - "y_transparent_descender.textproto", - "y_transparent_figures.textproto", - "y_transparent_lowercase.textproto", - "y_transparent_uppercase.textproto"]: - append_AxisMessage(resource_filename('axisregistry', 'data/' + axis)) + for axis in [ + "casual.textproto", + "cursive.textproto", + "fill.textproto", + "flair.textproto", + "grade.textproto", + "italic.textproto", + "monospace.textproto", + "optical_size.textproto", + "slant.textproto", + "softness.textproto", + "volume.textproto", + "weight.textproto", + "width.textproto", + "wonky.textproto", + "x_opaque.textproto", + "x_transparent_figures.textproto", + "x_transparent.textproto", + "y_opaque.textproto", + "y_transparent_ascender.textproto", + "y_transparent_descender.textproto", + "y_transparent_figures.textproto", + "y_transparent_lowercase.textproto", + "y_transparent_uppercase.textproto", + ]: + append_AxisMessage(resource_filename("axisregistry", "data/" + axis)) return registry diff --git a/Lib/axisregistry/axes_pb2.py b/Lib/axisregistry/axes_pb2.py index 88b456d47..3eb64026d 100644 --- a/Lib/axisregistry/axes_pb2.py +++ b/Lib/axisregistry/axes_pb2.py @@ -6,182 +6,337 @@ from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database + # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() - - DESCRIPTOR = _descriptor.FileDescriptor( - name='axes.proto', - package='', - syntax='proto2', - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\naxes.proto\"\xe6\x01\n\tAxisProto\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x07 \x01(\t\x12\x11\n\tmin_value\x18\x02 \x01(\x02\x12\x15\n\rdefault_value\x18\x03 \x01(\x02\x12\x11\n\tmax_value\x18\x04 \x01(\x02\x12\x11\n\tprecision\x18\x05 \x01(\x05\x12 \n\x08\x66\x61llback\x18\x06 \x03(\x0b\x32\x0e.FallbackProto\x12\x13\n\x0b\x64\x65scription\x18\x08 \x01(\t\x12\x15\n\rfallback_only\x18\t \x01(\x08\x12\x18\n\x10illustration_url\x18\n \x01(\t\"B\n\rFallbackProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02\x12\x14\n\x0c\x64isplay_name\x18\x03 \x01(\t' + name="axes.proto", + package="", + syntax="proto2", + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\naxes.proto"\xe6\x01\n\tAxisProto\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x07 \x01(\t\x12\x11\n\tmin_value\x18\x02 \x01(\x02\x12\x15\n\rdefault_value\x18\x03 \x01(\x02\x12\x11\n\tmax_value\x18\x04 \x01(\x02\x12\x11\n\tprecision\x18\x05 \x01(\x05\x12 \n\x08\x66\x61llback\x18\x06 \x03(\x0b\x32\x0e.FallbackProto\x12\x13\n\x0b\x64\x65scription\x18\x08 \x01(\t\x12\x15\n\rfallback_only\x18\t \x01(\x08\x12\x18\n\x10illustration_url\x18\n \x01(\t"B\n\rFallbackProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x02\x12\x14\n\x0c\x64isplay_name\x18\x03 \x01(\t', ) - - _AXISPROTO = _descriptor.Descriptor( - name='AxisProto', - full_name='AxisProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='tag', full_name='AxisProto.tag', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='display_name', full_name='AxisProto.display_name', index=1, - number=7, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='min_value', full_name='AxisProto.min_value', index=2, - number=2, type=2, cpp_type=6, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='default_value', full_name='AxisProto.default_value', index=3, - number=3, type=2, cpp_type=6, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_value', full_name='AxisProto.max_value', index=4, - number=4, type=2, cpp_type=6, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='precision', full_name='AxisProto.precision', index=5, - number=5, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='fallback', full_name='AxisProto.fallback', index=6, - number=6, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='description', full_name='AxisProto.description', index=7, - number=8, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='fallback_only', full_name='AxisProto.fallback_only', index=8, - number=9, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='illustration_url', full_name='AxisProto.illustration_url', index=9, - number=10, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - serialized_start=15, - serialized_end=245, + name="AxisProto", + full_name="AxisProto", + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name="tag", + full_name="AxisProto.tag", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="display_name", + full_name="AxisProto.display_name", + index=1, + number=7, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="min_value", + full_name="AxisProto.min_value", + index=2, + number=2, + type=2, + cpp_type=6, + label=1, + has_default_value=False, + default_value=float(0), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="default_value", + full_name="AxisProto.default_value", + index=3, + number=3, + type=2, + cpp_type=6, + label=1, + has_default_value=False, + default_value=float(0), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="max_value", + full_name="AxisProto.max_value", + index=4, + number=4, + type=2, + cpp_type=6, + label=1, + has_default_value=False, + default_value=float(0), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="precision", + full_name="AxisProto.precision", + index=5, + number=5, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="fallback", + full_name="AxisProto.fallback", + index=6, + number=6, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="description", + full_name="AxisProto.description", + index=7, + number=8, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="fallback_only", + full_name="AxisProto.fallback_only", + index=8, + number=9, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="illustration_url", + full_name="AxisProto.illustration_url", + index=9, + number=10, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto2", + extension_ranges=[], + oneofs=[], + serialized_start=15, + serialized_end=245, ) _FALLBACKPROTO = _descriptor.Descriptor( - name='FallbackProto', - full_name='FallbackProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='FallbackProto.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='value', full_name='FallbackProto.value', index=1, - number=2, type=2, cpp_type=6, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='display_name', full_name='FallbackProto.display_name', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto2', - extension_ranges=[], - oneofs=[ - ], - serialized_start=247, - serialized_end=313, + name="FallbackProto", + full_name="FallbackProto", + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="FallbackProto.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="FallbackProto.value", + index=1, + number=2, + type=2, + cpp_type=6, + label=1, + has_default_value=False, + default_value=float(0), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="display_name", + full_name="FallbackProto.display_name", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto2", + extension_ranges=[], + oneofs=[], + serialized_start=247, + serialized_end=313, ) -_AXISPROTO.fields_by_name['fallback'].message_type = _FALLBACKPROTO -DESCRIPTOR.message_types_by_name['AxisProto'] = _AXISPROTO -DESCRIPTOR.message_types_by_name['FallbackProto'] = _FALLBACKPROTO +_AXISPROTO.fields_by_name["fallback"].message_type = _FALLBACKPROTO +DESCRIPTOR.message_types_by_name["AxisProto"] = _AXISPROTO +DESCRIPTOR.message_types_by_name["FallbackProto"] = _FALLBACKPROTO _sym_db.RegisterFileDescriptor(DESCRIPTOR) -AxisProto = _reflection.GeneratedProtocolMessageType('AxisProto', (_message.Message,), { - 'DESCRIPTOR' : _AXISPROTO, - '__module__' : 'axes_pb2' - # @@protoc_insertion_point(class_scope:AxisProto) - }) +AxisProto = _reflection.GeneratedProtocolMessageType( + "AxisProto", + (_message.Message,), + { + "DESCRIPTOR": _AXISPROTO, + "__module__": "axes_pb2" + # @@protoc_insertion_point(class_scope:AxisProto) + }, +) _sym_db.RegisterMessage(AxisProto) -FallbackProto = _reflection.GeneratedProtocolMessageType('FallbackProto', (_message.Message,), { - 'DESCRIPTOR' : _FALLBACKPROTO, - '__module__' : 'axes_pb2' - # @@protoc_insertion_point(class_scope:FallbackProto) - }) +FallbackProto = _reflection.GeneratedProtocolMessageType( + "FallbackProto", + (_message.Message,), + { + "DESCRIPTOR": _FALLBACKPROTO, + "__module__": "axes_pb2" + # @@protoc_insertion_point(class_scope:FallbackProto) + }, +) _sym_db.RegisterMessage(FallbackProto) diff --git a/setup.py b/setup.py index 5d6a1b159..34df052bd 100644 --- a/setup.py +++ b/setup.py @@ -18,35 +18,30 @@ from setuptools import setup # Read the contents of the README file -with open('README.md') as f: +with open("README.md") as f: long_description = f.read() setup( name="axisregistry", use_scm_version={"write_to": "Lib/axisregistry/_version.py"}, - url='https://github.com/googlefonts/axisregistry/', - description='A python API to access data from the Google Fonts variable fonts axis registry.', + url="https://github.com/googlefonts/axisregistry/", + description="A python API to access data from the Google Fonts variable fonts axis registry.", long_description=long_description, - long_description_content_type='text/markdown', # This is important! - author=('Felipe Sanches'), - author_email='juca@members.fsf.org', - package_dir={'': 'Lib'}, - packages=['axisregistry'], - package_data={'axisregistry': [ - "data/*.textproto" - ] - }, + long_description_content_type="text/markdown", # This is important! + author=("Felipe Sanches"), + author_email="juca@members.fsf.org", + package_dir={"": "Lib"}, + packages=["axisregistry"], + package_data={"axisregistry": ["data/*.textproto"]}, zip_safe=False, classifiers=[ - 'Intended Audience :: Developers', - 'Topic :: Text Processing :: Fonts', - 'License :: OSI Approved :: Apache Software License', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3' + "Intended Audience :: Developers", + "Topic :: Text Processing :: Fonts", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", ], python_requires=">=3.7", - setup_requires=['setuptools_scm>=4,<6.1'], - install_requires=[ - 'protobuf' - ] + setup_requires=["setuptools_scm>=4,<6.1"], + install_requires=["protobuf"], ) diff --git a/tests/test_axisregistry_api.py b/tests/test_axisregistry_api.py index 49c9369e6..ec78dec12 100644 --- a/tests/test_axisregistry_api.py +++ b/tests/test_axisregistry_api.py @@ -3,7 +3,7 @@ from axisregistry import AxisRegistry def test_AxisRegistry(): registry = AxisRegistry() - assert 'GRAD' in registry.keys() + assert "GRAD" in registry.keys() for axis_tag in registry.keys(): assert len(axis_tag) == 4 for f in range(len(registry[axis_tag].fallback)): @@ -11,4 +11,4 @@ def test_AxisRegistry(): # fallback names should not be space-separated. # (see: https://github.com/googlefonts/axisregistry/issues/7) - assert ' ' not in fallback.name + assert " " not in fallback.name