Merge "Run pyupgrade to clean up Python 2 syntaxes"
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,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
|
||||
|
@@ -100,7 +100,7 @@ def _log_and_ignore_error(fn):
|
||||
return wrapper
|
||||
|
||||
|
||||
class InputProxy(object):
|
||||
class InputProxy:
|
||||
"""File-like object that counts bytes read.
|
||||
|
||||
To be swapped in for wsgi.input for accounting purposes.
|
||||
@@ -147,7 +147,7 @@ class KeystoneClientLoader(ksa_adapter.Adapter):
|
||||
return ks_client.Client
|
||||
|
||||
|
||||
class Swift(object):
|
||||
class Swift:
|
||||
"""Swift middleware used for counting requests."""
|
||||
|
||||
event_queue = None
|
||||
@@ -416,7 +416,7 @@ class Swift(object):
|
||||
class SendEventThread(threading.Thread):
|
||||
|
||||
def __init__(self, notifier):
|
||||
super(SendEventThread, self).__init__()
|
||||
super().__init__()
|
||||
self.notifier = notifier
|
||||
|
||||
def run(self):
|
||||
|
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2010-2011 OpenStack Foundation
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
|
@@ -24,7 +24,7 @@ from ceilometermiddleware.tests import base as tests_base
|
||||
from keystoneauth1.fixture import keystoneauth_betamax as betamax
|
||||
|
||||
|
||||
class FakeApp(object):
|
||||
class FakeApp:
|
||||
def __init__(self, body=None):
|
||||
self.body = body or ['This string is 28 bytes long']
|
||||
|
||||
@@ -36,11 +36,10 @@ class FakeApp(object):
|
||||
])
|
||||
while env['wsgi.input'].read(5):
|
||||
pass
|
||||
for line in self.body:
|
||||
yield line
|
||||
yield from self.body
|
||||
|
||||
|
||||
class FakeRequest(object):
|
||||
class FakeRequest:
|
||||
"""A bare bones request object
|
||||
|
||||
The middleware will inspect this for request method,
|
||||
@@ -65,7 +64,7 @@ class FakeRequest(object):
|
||||
class TestSwift(tests_base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestSwift, self).setUp()
|
||||
super().setUp()
|
||||
cfg.CONF([], project='ceilometermiddleware')
|
||||
self.addCleanup(cfg.CONF.reset)
|
||||
|
||||
@@ -261,7 +260,7 @@ class TestSwift(tests_base.TestCase):
|
||||
app = swift.Swift(FakeApp(), {
|
||||
'metadata_headers': 'unicode'
|
||||
})
|
||||
uni = u'\xef\xbd\xa1\xef\xbd\xa5'
|
||||
uni = '\xef\xbd\xa1\xef\xbd\xa5'
|
||||
req = self.get_request('/1.0/account/container',
|
||||
environ={'REQUEST_METHOD': 'GET'},
|
||||
headers={'UNICODE': uni})
|
||||
|
@@ -1,4 +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
|
||||
|
@@ -54,8 +54,8 @@ master_doc = 'index'
|
||||
# General information about the project.
|
||||
author = 'Ceilometer Middleware Contributors'
|
||||
category = 'Miscellaneous'
|
||||
copyright = u'2016, Ceilometer Middleware Developers'
|
||||
project = u'Ceilometer Middleware Release Notes'
|
||||
copyright = '2016, Ceilometer Middleware Developers'
|
||||
project = 'Ceilometer Middleware Release Notes'
|
||||
description = 'Ceilometer Middleware publishes traffic measures for Swift.'
|
||||
title = 'Ceilometer Middleware Release Notes'
|
||||
target_name = 'ceilometermiddleware'
|
||||
|
Reference in New Issue
Block a user