From 1fe1e0cb7fc7c988941cd3b7adcdcb127b730d56 Mon Sep 17 00:00:00 2001 From: Amandus Butzer Date: Thu, 27 May 2021 15:15:00 +0200 Subject: [PATCH] Fix PEP 8 coding style violations refers to https://github.com/GIScience/orstools-qgis-plugin/issues/133 --- ORStools/common/isochrones_core.py | 6 +++--- ORStools/gui/ORStoolsDialog.py | 18 +++++++++++------- ORStools/proc/isochrones_layer_proc.py | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ORStools/common/isochrones_core.py b/ORStools/common/isochrones_core.py index 4da3cfe8..99cc73b8 100644 --- a/ORStools/common/isochrones_core.py +++ b/ORStools/common/isochrones_core.py @@ -60,7 +60,8 @@ def __init__(self): def set_parameters(self, profile, dimension, factor, id_field_type=QVariant.String, id_field_name='ID'): """ - Sets all parameters defined in __init__, because processing algorithm calls this class when it doesn't know its parameters yet. + Sets all parameters defined in __init__, because processing algorithm calls this class when it doesn't know + its parameters yet. :param profile: Transportation mode being used :type profile: str @@ -116,8 +117,7 @@ def get_features(self, response, id_field_value): # Sort features based on the isochrone value, so that longest isochrone # is added first. This will plot the isochrones on top of each other. - l = lambda x: x['properties']['value'] - for isochrone in sorted(response['features'], key=l, reverse=True): + for isochrone in sorted(response['features'], key=lambda x: x['properties']['value'], reverse=True): feat = QgsFeature() coordinates = isochrone['geometry']['coordinates'] iso_value = isochrone['properties']['value'] diff --git a/ORStools/gui/ORStoolsDialog.py b/ORStools/gui/ORStoolsDialog.py index 477c36a4..96d7a492 100644 --- a/ORStools/gui/ORStoolsDialog.py +++ b/ORStools/gui/ORStoolsDialog.py @@ -76,14 +76,18 @@ def on_help_click(): def on_about_click(parent): """Slot for click event of About button/menu entry.""" - info = f'ORS Tools provides access to openrouteservice routing functionalities.

' \ + info = f'ORS Tools provides access to openrouteservice routing functionalities.' \ + f'

' \ f'
' \ - f'

' \ + f'' \ + f'

' \ f'
' \ f'Author: HeiGIT gGmbH
' \ f'Email: {__email__}
' \ f'Web: {__web__}
' \ - f'Repo: github.com/GIScience/orstools-qgis-plugin
' \ + f'Repo: ' \ + f'github.com/GIScience/orstools-qgis-plugin
' \ f'Version: {__version__}' QMessageBox.information( @@ -258,9 +262,9 @@ def run_gui_control(self): """ Did you forget to set an API key for openrouteservice?

- If you don't have an API key, please visit https://openrouteservice.org/sign-up to get one.

- Then enter the API key for openrouteservice provider in Web ► ORS Tools ► Provider Settings or the settings symbol in the main ORS Tools GUI, next to the provider dropdown. - """ + If you don't have an API key, please visit https://openrouteservice.org/sign-up to get one.

+ Then enter the API key for openrouteservice provider in Web ► ORS Tools ► Provider Settings or the + settings symbol in the main ORS Tools GUI, next to the provider dropdown.""" ) return @@ -379,7 +383,7 @@ def __init__(self, iface, parent=None): self.global_buttons.button(QDialogButtonBox.Ok).setText('Apply') self.global_buttons.button(QDialogButtonBox.Cancel).setText('Close') - #### Set up signals/slots #### + # Set up signals/slots # Config/Help dialogs self.provider_config.clicked.connect(lambda: on_config_click(self)) diff --git a/ORStools/proc/isochrones_layer_proc.py b/ORStools/proc/isochrones_layer_proc.py index 7cbb6cba..911342eb 100644 --- a/ORStools/proc/isochrones_layer_proc.py +++ b/ORStools/proc/isochrones_layer_proc.py @@ -213,7 +213,7 @@ def processAlgorithm(self, parameters, context, feedback): # LookupField will return -1 if the name cannot be found. # Try the first field in this case. - if id_field_id == -1: + if id_field_id == -1: id_field_id = 0 # Populate iso_layer instance with parameters