Skip to content

Commit cca3256

Browse files
committed
Pre-commit fixes
1 parent 8709350 commit cca3256

14 files changed

+25
-39
lines changed

.pre-commit-config.yaml

-5
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,11 @@ repos:
1616
rev: 21.7b0
1717
hooks:
1818
- id: black
19-
- repo: https://github.com/pre-commit/mirrors-mypy
20-
rev: v0.910
21-
hooks:
22-
- id: mypy
2319
- repo: https://github.com/PyCQA/flake8
2420
rev: 3.9.2
2521
hooks:
2622
- id: flake8
2723
additional_dependencies:
2824
- flake8-bugbear~=21.4.3
2925
- pep8-naming~=0.12.1
30-
- flake8-annotations~=2.6.2
3126
- flake8-qgis>=0.1.4

LICENCE

-1
Original file line numberDiff line numberDiff line change
@@ -672,4 +672,3 @@ may consider it more useful to permit linking proprietary applications with
672672
the library. If this is what you want to do, use the GNU Lesser General
673673
Public License instead of this License. But first, please read
674674
<https://www.gnu.org/licenses/why-not-lgpl.html>.
675-

nlsgpkgloader/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
# noinspection PyPep8Naming
25-
def classFactory(iface): # pylint: disable=invalid-name
25+
def classFactory(iface): # noqa N802
2626
"""Load NLSGeoPackageLoader class from file NLSGeoPackageLoader.
2727
2828
:param iface: A QGIS interface instance.
@@ -31,4 +31,4 @@ def classFactory(iface): # pylint: disable=invalid-name
3131
#
3232
from .nls_geopackage_loader import NLSGeoPackageLoader
3333

34-
return NLSGeoPackageLoader(iface)
34+
return NLSGeoPackageLoader()

nlsgpkgloader/metadata.txt

-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,3 @@ experimental=False
3737

3838
# deprecated flag (applies to the whole plugin, not just a single version)
3939
deprecated=False
40-

nlsgpkgloader/nls_geopackage_loader.py

+14-21
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from qgis.PyQt.QtCore import QCoreApplication, QSettings, QTimer, QTranslator, qVersion
3939
from qgis.PyQt.QtGui import QIcon
4040
from qgis.PyQt.QtWidgets import QAction, QListWidgetItem, QMessageBox
41+
from qgis.utils import iface
4142

4243
from nlsgpkgloader.nls_geopackage_loader_mtk_productdata import (
4344
MTK_ALL_PRODUCTS_TITLE,
@@ -64,7 +65,7 @@
6465
class NLSGeoPackageLoader:
6566
"""QGIS Plugin Implementation."""
6667

67-
def __init__(self, iface):
68+
def __init__(self):
6869
"""Constructor.
6970
7071
:param iface: An interface instance that will be passed to this class
@@ -469,7 +470,7 @@ def toggle_layers(self):
469470
self.instance.addMapLayer(self.utm10_layer)
470471
if not found_utm5_layer and self.utm5_layer:
471472
self.instance.addMapLayer(self.utm5_layer)
472-
except:
473+
except Exception:
473474
self.load_layers()
474475
if not found_utm200_layer and self.utm200_layer:
475476
self.instance.addMapLayer(self.utm200_layer)
@@ -489,14 +490,14 @@ def toggle_layers(self):
489490
if self.showSeatilesAsLayer and not found_seatiles_layer:
490491
try:
491492
self.instance.addMapLayer(self.seatile_layer)
492-
except:
493+
except Exception:
493494
self.load_layers()
494495
self.instance.addMapLayer(self.seatile_layer)
495496

496497
if self.showMunicipalitiesAsLayer and not found_municipality_layer:
497498
try:
498499
self.instance.addMapLayer(self.municipality_layer)
499-
except:
500+
except Exception:
500501
self.load_layers()
501502
self.instance.addMapLayer(self.municipality_layer)
502503

@@ -704,18 +705,6 @@ def download_data(self, product_types):
704705
self.all_urls.extend(urls)
705706
self.total_download_count += len(urls)
706707

707-
try:
708-
percentage = self.download_count / float(self.total_download_count) * 100.0
709-
percentage_text = "%.2f" % round(percentage, 2)
710-
except ZeroDivisionError:
711-
QMessageBox.critical(
712-
self.iface.mainWindow(),
713-
self.tr(u"Invalid selection"),
714-
self.tr(u"Found nothing to download!"),
715-
)
716-
self.progress_dialog.hide()
717-
return
718-
719708
self.progress_dialog.progressBar.reset()
720709
self.progress_dialog.progressBar.show()
721710
self.progress_dialog.label.setText("Downloading data...")
@@ -746,7 +735,8 @@ def download_nls_product_types(self):
746735
QgsMessageLog.logMessage(id.text, "NLSgpkgloader", 0)
747736

748737
if title.text == "Maastotietokanta, kaikki kohteet":
749-
# TODO let user choose in the options dialog if the individual layers can be selected
738+
# TODO let user choose in the options dialog if the individual
739+
# layers can be selected
750740
for mtk_product_name in MTK_PRODUCT_NAMES:
751741
products[
752742
MTK_LAYERS_KEY_PREFIX + mtk_product_name
@@ -763,7 +753,10 @@ def download_one_file(self):
763753
or self.download_count >= len(self.all_urls)
764754
):
765755
QgsMessageLog.logMessage(
766-
"download_count == total_download_count or download_count >= len(all_urls)",
756+
(
757+
"download_count == total_download_count or "
758+
"download_count >= len(all_urls)"
759+
),
767760
"NLSgpkgloader",
768761
2,
769762
)
@@ -919,9 +912,9 @@ def show_settings_dialog(self):
919912

920913
def create_download_urls(self, product_key, product_title):
921914
urls = []
922-
if (
923-
product_key
924-
== "https://tiedostopalvelu.maanmittauslaitos.fi/tp/feed/mtp/maastotietokanta/kaikki"
915+
if product_key == (
916+
"https://tiedostopalvelu.maanmittauslaitos.fi/tp/feed"
917+
"/mtp/maastotietokanta/kaikki"
925918
):
926919
for utm_feature in self.utm25lr_features:
927920
sheet_name = utm_feature["LEHTITUNNU"]
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0],AUTHORITY["EPSG",3067]]
1+
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0],AUTHORITY["EPSG",3067]]
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
1+
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
1+
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
1+
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
1+
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ISO 88591
1+
ISO 88591
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
1+
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]

nlsgpkgloader/resources/data/utm5.prj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
1+
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
1+
PROJCS["EUREF_FIN_TM35FIN",GEOGCS["GCS_EUREF_FIN",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",27.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]

0 commit comments

Comments
 (0)