python 3 updates

- Fix super() calls for python 3
- No need to inherit objects.
- No need for u at the start of strings
- Tidied up some brackets and f-strings too
This commit is contained in:
Mark Mayo
2022-11-19 17:43:41 +13:00
committed by GitHub
parent 02362d8aa4
commit 41508f7f67
354 changed files with 532 additions and 534 deletions

View File

@@ -17,7 +17,7 @@ from flask_wtf.csrf import generate_csrf
import config
class RequestShim(object):
class RequestShim():
"""
A fake request that proxies cookie-related methods to a Flask test client.
"""
@@ -44,14 +44,14 @@ class TestClient(testing.FlaskClient):
def __init__(self, *args, **kwargs):
self.csrf_token = None
self.app = None
super(TestClient, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
def setApp(self, _app):
self.app = _app
def open(self, *args, **kwargs):
if len(args) > 0 and isinstance(args[0], (EnvironBuilder, dict)):
return super(TestClient, self).open(*args, **kwargs)
return super().open(*args, **kwargs)
data = kwargs.get('data', {})
@@ -68,7 +68,7 @@ class TestClient(testing.FlaskClient):
headers.extend(api_key_headers)
kwargs['headers'] = headers
return super(TestClient, self).open(*args, **kwargs)
return super().open(*args, **kwargs)
def fetch_csrf(self, res):
m = re.search(

View File

@@ -24,7 +24,7 @@ class SQLTemplateTestBase(BaseTestGenerator):
]
def __init__(self):
super(SQLTemplateTestBase, self).__init__()
super().__init__()
self.database_name = -1
def test_setup(self, connection, cursor):

View File

@@ -1702,7 +1702,7 @@ def create_user(user_details):
return user_id
except Exception as exception:
traceback.print_exc(file=sys.stderr)
raise ("Error while creating server. %s" % exception)
raise "Error while creating server. %s" % exception
def get_test_user(self, user_details,