From 1ba533af1f96130b7a9615ce78e8ac677c15550e Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Thu, 11 May 2023 15:34:45 +1000 Subject: [PATCH] Lint --- koordinates/gui/datasets_browser_widget.py | 17 +++++++++-------- koordinates/gui/enums.py | 2 +- koordinates/gui/filter_widget.py | 5 +++-- koordinates/gui/koordinates.py | 2 +- koordinates/gui/results_panel.py | 16 +++++++--------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/koordinates/gui/datasets_browser_widget.py b/koordinates/gui/datasets_browser_widget.py index ade21bd..f1c3771 100644 --- a/koordinates/gui/datasets_browser_widget.py +++ b/koordinates/gui/datasets_browser_widget.py @@ -23,17 +23,14 @@ QLabel, QToolButton, QVBoxLayout, - QSizePolicy, QWidget ) -from qgis.gui import QgsScrollArea from .response_table_layout import ResponsiveTableWidget from ..api import ( KoordinatesClient, PAGE_SIZE, - DataBrowserQuery, - ExplorePanel + DataBrowserQuery ) pluginPath = os.path.split(os.path.dirname(__file__))[0] @@ -96,7 +93,8 @@ def _fetch_records(self, query: Optional[DataBrowserQuery] = None, context: Optional[str] = None, page: int = 1): - if self._current_reply is not None and not sip.isdeleted(self._current_reply): + if self._current_reply is not None and not sip.isdeleted( + self._current_reply): self._current_reply.abort() self._current_reply = None @@ -110,7 +108,8 @@ def _fetch_records(self, context=self._current_context, page=page ) - self._current_reply.finished.connect(partial(self._reply_finished, self._current_reply)) + self._current_reply.finished.connect( + partial(self._reply_finished, self._current_reply)) self.setCursor(Qt.WaitCursor) def _reply_finished(self, reply: QNetworkReply): @@ -133,11 +132,13 @@ def _reply_finished(self, reply: QNetworkReply): result = json.loads(reply.readAll().data().decode()) if 'panels' in result: - datasets = [item['content'] for item in result['panels'][0]['items']] + datasets = [item['content'] for item in + result['panels'][0]['items']] else: datasets = result - tokens = reply.rawHeader(b"X-Resource-Range").data().decode().split("/") + tokens = reply.rawHeader(b"X-Resource-Range").data().decode().split( + "/") total = tokens[-1] self.total_count_changed.emit(int(total)) last = tokens[0].split("-")[-1] diff --git a/koordinates/gui/enums.py b/koordinates/gui/enums.py index 3d71f20..d8bfb48 100644 --- a/koordinates/gui/enums.py +++ b/koordinates/gui/enums.py @@ -18,4 +18,4 @@ class ExploreMode: Popular = auto() Browse = auto() Publishers = auto() - Recent = auto() \ No newline at end of file + Recent = auto() diff --git a/koordinates/gui/filter_widget.py b/koordinates/gui/filter_widget.py index 0cff3e7..bb0a1b4 100644 --- a/koordinates/gui/filter_widget.py +++ b/koordinates/gui/filter_widget.py @@ -223,8 +223,9 @@ def set_explore_mode(self, mode: ExploreMode): if show_filters: self.advanced_filter_widget.updateGeometry() - if mode in (ExploreMode.Popular, - ExploreMode.Recent) and self.search_line_edit: + if mode in ( + ExploreMode.Popular, + ExploreMode.Recent) and self.search_line_edit: self.search_line_edit.clear() if mode == ExploreMode.Popular: diff --git a/koordinates/gui/koordinates.py b/koordinates/gui/koordinates.py index 6e316a2..2a14a70 100644 --- a/koordinates/gui/koordinates.py +++ b/koordinates/gui/koordinates.py @@ -673,7 +673,7 @@ def search(self): self.results_panel.populate(browser_query, context) - def explore(self, panel: ExplorePanel = ExplorePanel.Popular ): + def explore(self, panel: ExplorePanel = ExplorePanel.Popular): context = self._current_context self.browse_header_widget.hide() self.results_panel.explore(panel, context) diff --git a/koordinates/gui/results_panel.py b/koordinates/gui/results_panel.py index af06d50..39456e3 100644 --- a/koordinates/gui/results_panel.py +++ b/koordinates/gui/results_panel.py @@ -1,7 +1,6 @@ import json import os import platform - from functools import partial from typing import ( List, @@ -28,8 +27,7 @@ QSizePolicy, QWidget, QLabel, - QStylePainter, - QStyleOption + QStylePainter ) from qgis.gui import QgsScrollArea @@ -45,7 +43,6 @@ class ExplorePanelWidget(QWidget): - CORNER_RADIUS = 4 def __init__(self, content: Dict, parent: Optional[QWidget] = None): @@ -73,7 +70,7 @@ def __init__(self, content: Dict, parent: Optional[QWidget] = None): self.browser.set_datasets(item['content'] for item in content['items']) vl = QVBoxLayout() - vl.setContentsMargins(12,12,12,0) + vl.setContentsMargins(12, 12, 12, 0) vl.addWidget(title_label) vl.addWidget(self.browser) @@ -96,8 +93,8 @@ def paintEvent(self, event): painter.setPen(pen) painter.drawRoundedRect(self.rect(), - self.CORNER_RADIUS, - self.CORNER_RADIUS) + self.CORNER_RADIUS, + self.CORNER_RADIUS) painter.restore() @@ -130,7 +127,8 @@ def __init__(self): self.scroll_area.setStyleSheet( "#qt_scrollarea_viewport{ background: transparent; }") - self.child_items: List[Union[DatasetsBrowserWidget, ExplorePanelWidget]] = [] + self.child_items: List[ + Union[DatasetsBrowserWidget, ExplorePanelWidget]] = [] self.setMinimumWidth(370) self.current_mode: Optional[ExploreMode] = None @@ -219,7 +217,7 @@ def _reply_finished(self, reply: QNetworkReply): if reply.error() != QNetworkReply.NoError: print('error occurred :(') return - # self.error_occurred.emit(request.reply().errorString()) + # self.error_occurred.emit(request.reply().errorString()) result = json.loads(reply.readAll().data().decode()) if 'panels' not in result: