Merge "Remove six"

This commit is contained in:
Zuul 2020-08-29 08:46:12 +00:00 committed by Gerrit Code Review
commit 649c583e71
6 changed files with 11 additions and 18 deletions

View File

@ -89,7 +89,6 @@ requestsexceptions==1.4.0
rfc3986==1.1.0
Routes==2.4.1
simplejson==3.13.2
six==1.10.0
snowballstemmer==1.2.1
Sphinx==2.0.0
sphinxcontrib-websupport==1.0.1

View File

@ -13,11 +13,9 @@
# limitations under the License.
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class DriverBase(object):
class DriverBase(object, metaclass=abc.ABCMeta):
"""Driver Base class.
This class is base of monitoring hosts.

View File

@ -78,7 +78,7 @@ class TestProcessmonitorManager(testtools.TestCase):
@mock.patch.object(handle_process.HandleProcess, 'start_processes')
@mock.patch.object(handle_process.HandleProcess, 'set_process_list')
@mock.patch.object(yaml, 'load')
@mock.patch('six.moves.builtins.open')
@mock.patch('builtins.open')
def test_main(self,
mock_file,
mock_load,
@ -110,7 +110,7 @@ class TestProcessmonitorManager(testtools.TestCase):
@mock.patch.object(handle_process.HandleProcess, 'start_processes')
@mock.patch.object(handle_process.HandleProcess, 'set_process_list')
@mock.patch.object(yaml, 'load')
@mock.patch('six.moves.builtins.open')
@mock.patch('builtins.open')
def test_main_exception(self,
mock_file,
mock_load,
@ -133,7 +133,7 @@ class TestProcessmonitorManager(testtools.TestCase):
@mock.patch.object(handle_process.HandleProcess, 'set_process_list')
@mock.patch.object(yaml, 'load')
@mock.patch('six.moves.builtins.open')
@mock.patch('builtins.open')
def test_load_process_list_yaml_error(self,
mock_file,
mock_load,
@ -148,7 +148,7 @@ class TestProcessmonitorManager(testtools.TestCase):
@mock.patch.object(handle_process.HandleProcess, 'set_process_list')
@mock.patch.object(yaml, 'load')
@mock.patch('six.moves.builtins.open')
@mock.patch('builtins.open')
def test_load_process_list_exception(self,
mock_file,
mock_load,

View File

@ -15,6 +15,7 @@
"""Utilities and helper functions."""
import contextlib
import functools
import inspect
import pyclbr
import shutil
@ -25,7 +26,6 @@ from oslo_concurrency import lockutils
from oslo_concurrency import processutils
from oslo_log import log as logging
from oslo_utils import importutils
import six
import masakarimonitors.conf
from masakarimonitors.i18n import _
@ -52,12 +52,9 @@ def monkey_patch():
# If CONF.monkey_patch is not True, this function do nothing.
if not CONF.monkey_patch:
return
if six.PY2:
is_method = inspect.ismethod
else:
def is_method(obj):
# Unbound methods became regular functions on Python 3
return inspect.ismethod(obj) or inspect.isfunction(obj)
def is_method(obj):
return inspect.ismethod(obj) or inspect.isfunction(obj)
# Get list of modules and decorators
for module_and_decorator in CONF.monkey_patch_modules:
md_value = module_and_decorator.split(':')
@ -116,7 +113,7 @@ def execute(*cmd, **kwargs):
def synchronized(name, semaphores=None, blocking=False):
def wrap(f):
@six.wraps(f)
@functools.wraps(f)
def inner(*args, **kwargs):
lock_str = 'masakarimonitors-%s' % name
int_lock = lockutils.internal_lock(lock_str,

View File

@ -27,7 +27,7 @@ def _load_config():
# Don't load in global context, since we can't assume
# these modules are accessible when distutils uses
# this module
from six.moves import configparser
import configparser
from oslo_config import cfg

View File

@ -16,4 +16,3 @@ oslo.privsep>=1.23.0 # Apache-2.0
oslo.service!=1.28.1,>=1.24.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
pbr!=2.1.0,>=2.0.0 # Apache-2.0
six>=1.10.0 # MIT