Run pyupgrade to clean up Python 2 syntaxes
Update all .py source files by $ pyupgrade --py3-only $(git ls-files | grep ".py$") to modernize the code according to Python 3 syntaxes. Also introduce pre-commit and its pyupgrade hook to avoid merging additional Python 2 syntaxes. Change-Id: I12d2ccc679e0fcb3e3f467ee59da0aabb61a04a2
This commit is contained in:
@@ -23,3 +23,8 @@ repos:
|
||||
hooks:
|
||||
- id: hacking
|
||||
additional_dependencies: []
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.18.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py3-only]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2020 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
||||
@@ -28,7 +28,7 @@ from oslo_upgradecheck import upgradecheck
|
||||
class TestUpgradeCheckPolicyJSON(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestUpgradeCheckPolicyJSON, self).setUp()
|
||||
super().setUp()
|
||||
conf_fixture = self.useFixture(config.Config())
|
||||
conf_fixture.load_raw_values()
|
||||
self.conf = conf_fixture.conf
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
|
||||
@@ -50,7 +50,7 @@ UPGRADE_CHECK_MSG_MAP = {
|
||||
}
|
||||
|
||||
|
||||
class Result(object):
|
||||
class Result:
|
||||
"""Class used for 'nova-status upgrade check' results.
|
||||
|
||||
The 'code' attribute is a Code enum.
|
||||
@@ -60,12 +60,12 @@ class Result(object):
|
||||
"""
|
||||
|
||||
def __init__(self, code, details=None):
|
||||
super(Result, self).__init__()
|
||||
super().__init__()
|
||||
self.code = code
|
||||
self.details = details
|
||||
|
||||
|
||||
class UpgradeCommands(object):
|
||||
class UpgradeCommands:
|
||||
"""Base class for upgrade checks
|
||||
|
||||
This class should be inherited by a class in each project that provides
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2020 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
||||
Reference in New Issue
Block a user