From 426ee13a6cd91d19b58d773452c28acdad92e355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Wed, 8 Jan 2020 10:03:15 +0100 Subject: [PATCH] Runs black --- geoportal/geomapfish_geoportal/__init__.py | 20 ++++++++------- geoportal/geomapfish_geoportal/models.py | 2 +- geoportal/geomapfish_geoportal/subscribers.py | 16 ++++++------ geoportal/setup.py | 25 ++++++------------- 4 files changed, 28 insertions(+), 35 deletions(-) diff --git a/geoportal/geomapfish_geoportal/__init__.py b/geoportal/geomapfish_geoportal/__init__.py index 836a75376..bdd335dbb 100644 --- a/geoportal/geomapfish_geoportal/__init__.py +++ b/geoportal/geomapfish_geoportal/__init__.py @@ -14,17 +14,18 @@ def main(global_config, **settings): del global_config # Unused config = Configurator( - root_factory=Root, settings=settings, + root_factory=Root, + settings=settings, locale_negotiator=locale_negotiator, - authentication_policy=create_authentication(settings) + authentication_policy=create_authentication(settings), ) # Workaround to not have the error: distutils.errors.DistutilsArgError: no commands supplied - distutils.core._setup_stop_after = 'config' - config.include('c2cgeoportal_geoportal') + distutils.core._setup_stop_after = "config" + config.include("c2cgeoportal_geoportal") distutils.core._setup_stop_after = None - config.add_translation_dirs('geomapfish_geoportal:locale/') + config.add_translation_dirs("geomapfish_geoportal:locale/") # Scan view decorator for adding routes config.scan() @@ -33,14 +34,15 @@ def main(global_config, **settings): for interface in config.get_settings().get("interfaces", []): add_interface( config, - interface['name'], - interface.get('type', INTERFACE_TYPE_NGEO), - default=interface.get('default', False) + interface["name"], + interface.get("type", INTERFACE_TYPE_NGEO), + default=interface.get("default", False), ) try: import ptvsd - ptvsd.enable_attach(address=('172.17.0.1', 5678)) + + ptvsd.enable_attach(address=("172.17.0.1", 5678)) # ptvsd.wait_for_attach() except ModuleNotFoundError as e: pass diff --git a/geoportal/geomapfish_geoportal/models.py b/geoportal/geomapfish_geoportal/models.py index 848d1fc69..11b9ee77f 100644 --- a/geoportal/geomapfish_geoportal/models.py +++ b/geoportal/geomapfish_geoportal/models.py @@ -6,5 +6,5 @@ from c2cgeoportal_commons.models.main import * # noqa -_ = TranslationStringFactory('geomapfish-server') +_ = TranslationStringFactory("geomapfish-server") LOG = logging.getLogger(__name__) diff --git a/geoportal/geomapfish_geoportal/subscribers.py b/geoportal/geomapfish_geoportal/subscribers.py index 89f85cc66..e8d06a746 100644 --- a/geoportal/geomapfish_geoportal/subscribers.py +++ b/geoportal/geomapfish_geoportal/subscribers.py @@ -5,10 +5,10 @@ # use two translator to translate each strings in Make -tsf_server = TranslationStringFactory('geomapfish-server') -tsf_geoportal = TranslationStringFactory('c2cgeoportal') -tsf_admin = TranslationStringFactory('c2cgeoportal_admin') -tsf_c2cgeoform = TranslationStringFactory('c2cgeoform') +tsf_server = TranslationStringFactory("geomapfish-server") +tsf_geoportal = TranslationStringFactory("c2cgeoportal") +tsf_admin = TranslationStringFactory("c2cgeoportal_admin") +tsf_c2cgeoform = TranslationStringFactory("c2cgeoform") @subscriber(NewRequest) @@ -17,7 +17,7 @@ def add_localizer(event): localizer = get_localizer(request) def auto_translate(string): - if request.path_info.startswith('/admin/'): + if request.path_info.startswith("/admin/"): tsf_list = [tsf_admin, tsf_c2cgeoform] else: tsf_list = [tsf_server, tsf_geoportal] @@ -33,7 +33,7 @@ def auto_translate(string): @subscriber(BeforeRender) def add_renderer_globals(event): - request = event.get('request') + request = event.get("request") if request: - event['_'] = request.translate - event['localizer'] = request.localizer + event["_"] = request.translate + event["localizer"] = request.localizer diff --git a/geoportal/setup.py b/geoportal/setup.py index e7054ae98..00b7462a0 100644 --- a/geoportal/setup.py +++ b/geoportal/setup.py @@ -4,24 +4,15 @@ from setuptools import find_packages, setup setup( - name='geomapfish_geoportal', - version='1.0', - description='geomapfish, a c2cgeoportal project', - author='geomapfish', - author_email='info@geomapfish.com', - url='https://www.geomapfish.com/', - install_requires=[ - 'c2cgeoportal_geoportal', - 'c2cgeoportal_admin', - ], + name="geomapfish_geoportal", + version="1.0", + description="geomapfish, a c2cgeoportal project", + author="geomapfish", + author_email="info@geomapfish.com", + url="https://www.geomapfish.com/", + install_requires=["c2cgeoportal_geoportal", "c2cgeoportal_admin",], packages=find_packages(), include_package_data=True, zip_safe=False, - entry_points={ - 'paste.app_factory': [ - 'main = geomapfish_geoportal:main', - ], - 'console_scripts': [ - ], - }, + entry_points={"paste.app_factory": ["main = geomapfish_geoportal:main",], "console_scripts": [],}, )