mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-28 02:58:18 +08:00
Drop support for retired Python 3.5
Upgrade syntax using `pyupgrade --py36-plus` . Manually drop several `six` imports. Also: - Remove broken pr_cache in scripts/bootstrap_history.py - Fix broken prefix removal in lib/galaxy/tool_util/deps/mulled/mulled_build.py
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
import six
|
||||
from six.moves.urllib.error import HTTPError
|
||||
from six.moves.urllib.request import (
|
||||
from urllib.error import HTTPError
|
||||
from urllib.request import (
|
||||
build_opener,
|
||||
HTTPRedirectHandler,
|
||||
install_opener,
|
||||
@@ -94,7 +90,7 @@ def display(url, api_key=None, return_formatted=True):
|
||||
# Only return the first 1K of errors.
|
||||
print(e.read(1024))
|
||||
sys.exit(1)
|
||||
if isinstance(r, six.text_type):
|
||||
if isinstance(r, str):
|
||||
print('error: %s' % r)
|
||||
return None
|
||||
if not return_formatted:
|
||||
@@ -111,7 +107,7 @@ def display(url, api_key=None, return_formatted=True):
|
||||
if 'name' in i:
|
||||
print(' name: %s' % i.pop('name'))
|
||||
for k, v in i.items():
|
||||
print(' %s: %s' % (k, v))
|
||||
print(f' {k}: {v}')
|
||||
print()
|
||||
print('%d element(s) in collection' % len(r))
|
||||
elif isinstance(r, dict):
|
||||
@@ -119,7 +115,7 @@ def display(url, api_key=None, return_formatted=True):
|
||||
print('Member Information')
|
||||
print('------------------')
|
||||
for k, v in r.items():
|
||||
print('%s: %s' % (k, v))
|
||||
print(f'{k}: {v}')
|
||||
else:
|
||||
print('response is unknown type: %s' % type(r))
|
||||
|
||||
@@ -133,7 +129,7 @@ def get(url, api_key=None):
|
||||
sys.exit("URL did not return JSON data")
|
||||
|
||||
|
||||
def get_api_url(base, parts=[], params=None):
|
||||
def get_api_url(base, parts, params=None):
|
||||
"""Compose and return a URL for the Tool Shed API."""
|
||||
if 'api' in parts and parts.index('api') != 0:
|
||||
parts.pop(parts.index('api'))
|
||||
@@ -271,7 +267,7 @@ def submit(url, data, api_key=None, return_formatted=True):
|
||||
if 'name' in i:
|
||||
print(' name: %s' % i.pop('name'))
|
||||
for k, v in i.items():
|
||||
print(' %s: %s' % (k, v))
|
||||
print(f' {k}: {v}')
|
||||
else:
|
||||
print(i)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user