From 341403811526f1fc015a4bdb6e0935503dfe5b4b Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Thu, 9 May 2024 12:18:32 +1000 Subject: [PATCH] Lint --- felt/core/api_client.py | 18 +++++++++--------- felt/core/fsl_converter.py | 17 ++++++++++++----- felt/core/layer_exporter.py | 2 +- felt/core/map_uploader.py | 4 +++- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/felt/core/api_client.py b/felt/core/api_client.py index 48d68d9..b0e32ad 100644 --- a/felt/core/api_client.py +++ b/felt/core/api_client.py @@ -289,9 +289,9 @@ def prepare_layer_upload(self, ) def prepare_layer_upload_v2(self, - map_id: str, - name: str, - feedback: Optional[QgsFeedback] = None) \ + map_id: str, + name: str, + feedback: Optional[QgsFeedback] = None) \ -> Union[QNetworkReply, QgsNetworkReplyContent]: """ Prepares a layer upload, using v2 api @@ -308,10 +308,10 @@ def prepare_layer_upload_v2(self, json_data = json.dumps(request_params) reply = QgsNetworkAccessManager.instance().blockingPost( - request, - json_data.encode(), - feedback=feedback - ) + request, + json_data.encode(), + feedback=feedback + ) return reply @@ -420,8 +420,8 @@ def finalize_layer_upload(self, ) def patch_style(self, - map_id: str, - layer_id: str, + map_id: str, + layer_id: str, fsl: Dict) \ -> QNetworkReply: """ diff --git a/felt/core/fsl_converter.py b/felt/core/fsl_converter.py index c28093e..99984a2 100644 --- a/felt/core/fsl_converter.py +++ b/felt/core/fsl_converter.py @@ -1186,7 +1186,8 @@ def label_settings_to_fsl(settings: QgsPalLayerSettings, return None if settings.isExpression: - context.push_warning('Expression based labels are not supported', LogLevel.Warning) + context.push_warning('Expression based labels are not supported', + LogLevel.Warning) return None converted_format = FslConverter.text_format_to_fsl( @@ -1195,9 +1196,11 @@ def label_settings_to_fsl(settings: QgsPalLayerSettings, if settings.autoWrapLength > 0: converted_format['maxLineChars'] = settings.autoWrapLength if settings.scaleVisibility: - converted_format['minZoom'] = MapUtils.map_scale_to_leaflet_tile_zoom( + converted_format[ + 'minZoom'] = MapUtils.map_scale_to_leaflet_tile_zoom( settings.minimumScale) - converted_format['maxZoom'] = MapUtils.map_scale_to_leaflet_tile_zoom( + converted_format[ + 'maxZoom'] = MapUtils.map_scale_to_leaflet_tile_zoom( settings.maximumScale) else: # these are mandatory! @@ -1279,8 +1282,12 @@ def text_format_to_fsl(text_format: QgsTextFormat, res['textTransform'] = 'lowercase' elif text_format.capitalization() != QgsStringUtils.MixedCase: try: - context.push_warning('Text transform {} is not supported'.format(text_format.capitalization().name)) + context.push_warning( + 'Text transform {} is not supported'.format( + text_format.capitalization().name)) except AttributeError: - context.push_warning('Text transform option {} is not supported'.format(text_format.capitalization())) + context.push_warning( + 'Text transform option {} is not supported'.format( + text_format.capitalization())) return res diff --git a/felt/core/layer_exporter.py b/felt/core/layer_exporter.py index 350e6ff..8da56c2 100644 --- a/felt/core/layer_exporter.py +++ b/felt/core/layer_exporter.py @@ -541,7 +541,7 @@ def export_raster_layer( { 'type': Logger.PACKAGING_RASTER, 'error': 'Error packaging layer: {}'.format(error_message) - } + } ) raise LayerPackagingException(error_message) diff --git a/felt/core/map_uploader.py b/felt/core/map_uploader.py index 569bc72..60c11f9 100644 --- a/felt/core/map_uploader.py +++ b/felt/core/map_uploader.py @@ -475,7 +475,9 @@ def _upload_progress(sent, total): if self.isCanceled(): return False - layer_id = upload_details.get('data', {}).get('attributes', {}).get('first_layer_id') + layer_id = upload_details.get('data', {}).get('attributes', + {}).get( + 'first_layer_id') if details.style.fsl is not None: if not layer_id: Logger.instance().log_error_json(