Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 9, 2024
1 parent dbb48e3 commit 3414038
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
18 changes: 9 additions & 9 deletions felt/core/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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:
"""
Expand Down
17 changes: 12 additions & 5 deletions felt/core/fsl_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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!
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion felt/core/layer_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ def export_raster_layer(
{
'type': Logger.PACKAGING_RASTER,
'error': 'Error packaging layer: {}'.format(error_message)
}
}
)
raise LayerPackagingException(error_message)

Expand Down
4 changes: 3 additions & 1 deletion felt/core/map_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 3414038

Please sign in to comment.