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. Change-Id: Iee7bdff54efe4bea1b255c1114a4291c3e62fea0
This commit is contained in:
parent
82d872cc99
commit
066baeb179
@ -24,3 +24,8 @@ repos:
|
||||
- id: hacking
|
||||
additional_dependencies: []
|
||||
exclude: '^(doc|releasenotes|tools)/.*$'
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.18.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py3-only]
|
||||
|
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# etcd3-gateway documentation build configuration file, created by
|
||||
# sphinx-quickstart on Sat Mar 25 20:42:09 2017.
|
||||
|
@ -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
|
||||
@ -12,7 +10,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from __future__ import absolute_import
|
||||
import pbr.version
|
||||
|
||||
from etcd3gw.client import client
|
||||
|
@ -41,7 +41,7 @@ _EXCEPTIONS_BY_CODE = {
|
||||
DEFAULT_API_PATH = os.getenv('ETCD3GW_API_PATH')
|
||||
|
||||
|
||||
class Etcd3Client(object):
|
||||
class Etcd3Client:
|
||||
def __init__(self, host='localhost', port=2379, protocol="http",
|
||||
ca_cert=None, cert_key=None, cert_cert=None, timeout=None,
|
||||
api_path=DEFAULT_API_PATH):
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
class Etcd3Exception(Exception):
|
||||
def __init__(self, detail_text=None, *args):
|
||||
super(Etcd3Exception, self).__init__(*args)
|
||||
super().__init__(*args)
|
||||
self.detail_text = detail_text
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
from etcd3gw.utils import _decode
|
||||
|
||||
|
||||
class Lease(object):
|
||||
class Lease:
|
||||
def __init__(self, id, client=None):
|
||||
"""Lease object for expiring keys
|
||||
|
||||
|
@ -17,7 +17,7 @@ from etcd3gw.utils import DEFAULT_TIMEOUT
|
||||
from etcd3gw.utils import LOCK_PREFIX
|
||||
|
||||
|
||||
class Lock(object):
|
||||
class Lock:
|
||||
def __init__(self, name, ttl=DEFAULT_TIMEOUT, client=None):
|
||||
"""Create a lock using the given name with specified timeout
|
||||
|
||||
|
@ -360,7 +360,7 @@ class TestEtcd3Gateway(base.TestCase):
|
||||
|
||||
self.assertEqual(
|
||||
event['kv']['key'],
|
||||
('%s%s' % (key, change_count)).encode("latin-1"),
|
||||
('{}{}'.format(key, change_count)).encode("latin-1"),
|
||||
)
|
||||
self.assertEqual(
|
||||
event['kv']['value'],
|
||||
|
@ -39,7 +39,7 @@ def _watch(resp, callback):
|
||||
callback(event)
|
||||
|
||||
|
||||
class Watcher(object):
|
||||
class Watcher:
|
||||
|
||||
KW_ARGS = ['start_revision', 'progress_notify', 'filters', 'prev_kv']
|
||||
KW_ENCODED_ARGS = ['range_end']
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user