Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Python - Upgrade metasearch to Python 3.7 minimum
  • Loading branch information
Gustry authored and nyalldawson committed Apr 18, 2023
1 parent cf77ddb commit 3ebb5af
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 28 deletions.
1 change: 0 additions & 1 deletion python/plugins/MetaSearch/__init__.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2010 NextGIS (http://nextgis.org),
Expand Down
1 change: 0 additions & 1 deletion python/plugins/MetaSearch/dialogs/__init__.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2014 Tom Kralidis (tomkralidis@gmail.com)
Expand Down
1 change: 0 additions & 1 deletion python/plugins/MetaSearch/dialogs/apidialog.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# CSW Client
Expand Down
5 changes: 2 additions & 3 deletions python/plugins/MetaSearch/dialogs/maindialog.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# CSW Client
Expand Down Expand Up @@ -985,12 +984,12 @@ def install_proxy(self):
proxy_port = ''

if all([user != '', password != '']):
proxy_up = '%s:%s@' % (user, password)
proxy_up = f'{user}:{password}@'

if port != '':
proxy_port = ':%s' % port

conn = '%s://%s%s%s' % (ptype, proxy_up, host, proxy_port)
conn = f'{ptype}://{proxy_up}{host}{proxy_port}'
install_opener(build_opener(ProxyHandler({ptype: conn})))


Expand Down
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# CSW Client
Expand Down
1 change: 0 additions & 1 deletion python/plugins/MetaSearch/dialogs/newconnectiondialog.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# CSW Client
Expand Down
1 change: 0 additions & 1 deletion python/plugins/MetaSearch/dialogs/recorddialog.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# CSW Client
Expand Down
1 change: 0 additions & 1 deletion python/plugins/MetaSearch/link_types.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# MetaSearch Catalog Client
Expand Down
8 changes: 3 additions & 5 deletions python/plugins/MetaSearch/pavement.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2014 Tom Kralidis (tomkralidis@gmail.com)
Expand Down Expand Up @@ -151,8 +150,7 @@ def upload():
options.upload.port,
options.upload.endpoint)

info('Uploading to http://%s/%s' % (options.upload.host,
options.upload.endpoint))
info('Uploading to http://{}/{}'.format(options.upload.host, options.upload.endpoint))

server = xmlrpc.client.ServerProxy(url, verbose=False)

Expand Down Expand Up @@ -225,6 +223,6 @@ def generate_csw_connections_file():
def get_package_filename():
"""return filepath of plugin zipfile"""

filename = '%s-%s.zip' % (PLUGIN_NAME, options.base.version)
package_file = '%s/%s' % (options.base.tmp, filename)
filename = f'{PLUGIN_NAME}-{options.base.version}.zip'
package_file = f'{options.base.tmp}/{filename}'
return package_file
7 changes: 2 additions & 5 deletions python/plugins/MetaSearch/plugin.py
@@ -1,5 +1,3 @@
from builtins import object
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2010 NextGIS (http://nextgis.org),
Expand Down Expand Up @@ -37,7 +35,7 @@
LOGGER = logging.getLogger('MetaSearch')


class MetaSearchPlugin(object):
class MetaSearchPlugin:
"""base plugin"""

def __init__(self, iface):
Expand All @@ -54,8 +52,7 @@ def initGui(self):
"""startup"""

# run
run_icon = QIcon('%s/%s' % (self.context.ppath,
'images/MetaSearch.svg'))
run_icon = QIcon('{}/{}'.format(self.context.ppath, 'images/MetaSearch.svg'))
self.action_run = QAction(run_icon, 'MetaSearch',
self.iface.mainWindow())
self.action_run.setWhatsThis(
Expand Down
1 change: 0 additions & 1 deletion python/plugins/MetaSearch/search_backend.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# CSW Client
Expand Down
12 changes: 5 additions & 7 deletions python/plugins/MetaSearch/util.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2010 NextGIS (http://nextgis.org),
Expand Down Expand Up @@ -49,7 +48,7 @@
LOGGER = logging.getLogger('MetaSearch')


class StaticContext(object):
class StaticContext:
"""base configuration / scaffolding"""

def __init__(self):
Expand All @@ -59,8 +58,7 @@ def __init__(self):

def get_ui_class(ui_file):
"""return class object of a uifile"""
ui_file_full = '%s%sui%s%s' % (os.path.dirname(os.path.abspath(__file__)),
os.sep, os.sep, ui_file)
ui_file_full = '{}{}ui{}{}'.format(os.path.dirname(os.path.abspath(__file__)), os.sep, os.sep, ui_file)
return loadUiType(ui_file_full)[0]


Expand Down Expand Up @@ -88,7 +86,7 @@ def get_connections_from_file(parent, filename):
except etree.ParseError as err:
error = 1
msg = parent.tr('Cannot parse XML file: {0}').format(err)
except IOError as err:
except OSError as err:
error = 1
msg = parent.tr('Cannot open file: {0}').format(err)

Expand Down Expand Up @@ -142,7 +140,7 @@ def get_help_url():
else:
version = '.'.join([major, minor])

path = '%s/%s/docs/user_manual/plugins/core_plugins/plugins_metasearch.html' % (version, locale_name) # noqa
path = f'{version}/{locale_name}/docs/user_manual/plugins/core_plugins/plugins_metasearch.html' # noqa

return '/'.join(['https://docs.qgis.org', path])

Expand All @@ -168,7 +166,7 @@ def serialize_string(input_string):
all_other_tokens_as_string = input_string.replace(last_token, '')

if last_token.isdigit():
value = '%s%s' % (all_other_tokens_as_string, int(last_token) + 1)
value = f'{all_other_tokens_as_string}{int(last_token) + 1}'
else:
value = '%s 1' % input_string

Expand Down

0 comments on commit 3ebb5af

Please sign in to comment.