pass
if v < StrictVersion("9.0.0") or cheroot_version < StrictVersion("6.5.5"):
- import six
- if six.PY3:
- generic_socket_error = OSError
- else:
- import socket
- generic_socket_error = socket.error
+ generic_socket_error = OSError
def accept_socket_error_0(func):
def wrapper(self, sock):
import json
import os
-import six
-from six.moves.html_parser import HTMLParser
+from html.parser import HTMLParser
class TemplateParser(HTMLParser):
def __init__(self, _file, search_tag):
- if six.PY3:
- super(TemplateParser, self).__init__()
- else:
- # HTMLParser is not a new-style class in py2
- HTMLParser.__init__(self)
+ super().__init__()
self.search_tag = search_tag
self.file = _file
self.parsed_data = []
exit(error_msg)
-def stdout(msg):
- six.print_(msg)
-
-
def get_files(base_dir, file_ext):
result = []
for root, _, files in os.walk(base_dir):
exit(error_msg)
if verbose:
- stdout('Found mappings:')
+ print('Found mappings:')
no_dashboard_tags = []
for tag in tags:
uid = tag['attrs']['uid']
format(uid, tag['file'], tag['line'],
grafana_dashboards[uid]['title'],
grafana_dashboards[uid]['file'])
- stdout(msg)
+ print(msg)
if no_dashboard_tags:
title = ('Checking Grafana dashboards UIDs: ERROR\n'
error_msg = title + '\n'.join(lines)
exit(error_msg)
else:
- stdout('Checking Grafana dashboards UIDs: OK')
+ print('Checking Grafana dashboards UIDs: OK')
if __name__ == '__main__':
python3-saml==1.4.1
requests==2.20.0
Routes==2.4.1
-six==1.14.0
import pkgutil
import re
import sys
+import urllib
-import six
-from six.moves.urllib.parse import unquote
+from functools import wraps
# pylint: disable=wrong-import-position
import cherrypy
from ..security import Scope, Permission
-from ..tools import wraps, getargspec, TaskManager, get_request_body_params
+from ..tools import getargspec, TaskManager, get_request_body_params
from ..exceptions import ScopeNotValid, PermissionNotValid
from ..services.auth import AuthManager, JwtManager
from ..plugins import PLUGIN_MANAGER
@wraps(func)
def inner(*args, **kwargs):
for key, value in kwargs.items():
- if isinstance(value, six.text_type):
- kwargs[key] = unquote(value)
+ if isinstance(value, str):
+ kwargs[key] = urllib.parse.unquote(value)
# Process method arguments.
params = get_request_body_params(cherrypy.request)
import os.path
import time
+from functools import wraps
from . import ApiController, Endpoint, ReadPermission, UpdatePermission
from . import RESTController, Task
from ..security import Scope
from ..services.exception import handle_orchestrator_error
from ..services.orchestrator import OrchClient
-from ..tools import TaskManager, wraps
+from ..tools import TaskManager
def get_device_osd_map():
from __future__ import absolute_import
import abc
-import six
from .pluggy import HookspecMarker, HookimplMarker, PluginManager
-@six.add_metaclass(abc.ABCMeta)
-class Interface(object):
+class Interface(object, metaclass=abc.ABCMeta):
pass
python3-saml
requests
Routes
-six
-e ../../../python-common
prettytable
pyyaml
import datetime
import os
-import six
import cephfs
from .. import mgr
]
:rtype: list
"""
- if isinstance(path, six.string_types):
+ if isinstance(path, str):
path = path.encode()
logger.debug("get_dir_list dirpath=%s depth=%s", path,
depth)
import json
from contextlib import contextmanager
import logging
-import six
import cherrypy
from ..services.ceph_service import SendCommandError
from ..exceptions import ViewCacheNoDataException, DashboardException
-from ..tools import wraps
logger = logging.getLogger('exception')
-if six.PY2:
- # Monkey-patch a __call__ method into @contextmanager to make
- # it compatible to Python 3
-
- # pylint: disable=no-name-in-module,ungrouped-imports
- from contextlib import GeneratorContextManager
-
- def init(self, *args):
- if len(args) == 1:
- self.gen = args[0]
- elif len(args) == 3:
- self.func, self.args, self.kwargs = args
- else:
- raise TypeError()
-
- def enter(self):
- if hasattr(self, 'func'):
- self.gen = self.func(*self.args, **self.kwargs)
- try:
- return self.gen.next()
- except StopIteration:
- raise RuntimeError("generator didn't yield")
-
- def call(self, f):
- @wraps(f)
- def wrapper(*args, **kwargs):
- with self:
- return f(*args, **kwargs)
-
- return wrapper
-
- GeneratorContextManager.__init__ = init
- GeneratorContextManager.__enter__ = enter
- GeneratorContextManager.__call__ = call
-
- # pylint: disable=function-redefined
- def contextmanager(func): # noqa: F811
-
- @wraps(func)
- def helper(*args, **kwds):
- return GeneratorContextManager(func, args, kwds)
-
- return helper
-
-
def serialize_dashboard_exception(e, include_http_status=False, task=None):
"""
:type e: Exception
from __future__ import absolute_import
import logging
+from functools import wraps
from typing import List, Optional
from orchestrator import InventoryFilter, DeviceLightLoc, Completion
from orchestrator import OrchestratorClientMixin, raise_if_exception, OrchestratorError
from orchestrator import HostSpec
from .. import mgr
-from ..tools import wraps
logger = logging.getLogger('orchestrator')
# pylint: disable=unused-argument
from __future__ import absolute_import
-import six
-
import cherrypy
import rbd
@DISABLEDOCTEST: >>> format_features('deep-flatten, exclusive-lock')
32
"""
- if isinstance(features, six.string_types):
+ if isinstance(features, str):
features = features.split(',')
if not isinstance(features, list):
import ipaddress
from distutils.util import strtobool
import xml.etree.ElementTree as ET # noqa: N814
-import six
from ..awsauth import S3Auth
from ..exceptions import DashboardException
from ..settings import Settings, Options
# Group 2: 2001:db8:85a3::8a2e:370:7334
addr = match.group(3) if match.group(3) else match.group(2)
try:
- ipaddress.ip_address(six.u(addr))
+ ipaddress.ip_address(addr)
return addr
except ValueError:
raise LookupError('Invalid RGW address \'{}\' found'.format(addr))
import threading
import warnings
-import six
-from six.moves.urllib import parse
+from urllib import parse
from .. import mgr
from ..tools import prepare_url_prefix
-if six.PY2:
- FileNotFoundError = IOError # pylint: disable=redefined-builtin
-
logger = logging.getLogger('sso')
try:
import errno
import inspect
-from six import add_metaclass
from . import mgr
# pylint: disable=no-init
-@add_metaclass(SettingsMeta)
-class Settings(object):
+class Settings(object, metaclass=SettingsMeta):
pass
import json
import logging
import threading
-import sys
import time
import cherrypy
fs = fake_filesystem.FakeFilesystem()
f_open = fake_filesystem.FakeFileOpen(fs)
f_os = fake_filesystem.FakeOsModule(fs)
-
- if sys.version_info > (3, 0):
- builtins_open = 'builtins.open'
- else:
- builtins_open = '__builtin__.open'
+ builtins_open = 'builtins.open'
class ControllerTestCase(helper.CPWebCase):
# -*- coding: utf-8 -*-
from __future__ import absolute_import
-import sys
import inspect
import json
-import functools
import ipaddress
import logging
import fnmatch
import time
import threading
-import six
-from six.moves import urllib
-import cherrypy
+import urllib
-try:
- from urlparse import urljoin
-except ImportError:
- from urllib.parse import urljoin
+import cherrypy
from . import mgr
from .exceptions import ViewCacheNoDataException
:rtype: str
"""
try:
- try:
- u_host = six.u(host)
- except TypeError:
- u_host = host
-
- ipaddress.IPv6Address(u_host)
+ ipaddress.IPv6Address(host)
netloc = '[{}]'.format(host)
except ValueError:
netloc = host
"""
return '' if no prefix, or '/prefix' without slash in the end.
"""
- url_prefix = urljoin('/', url_prefix)
+ url_prefix = urllib.parse.urljoin('/', url_prefix)
return url_prefix.rstrip('/')
return current
-if sys.version_info > (3, 0):
- wraps = functools.wraps
- _getargspec = inspect.getfullargspec
-else:
- def wraps(func):
- def decorator(wrapper):
- new_wrapper = functools.wraps(func)(wrapper)
- new_wrapper.__wrapped__ = func # set __wrapped__ even for Python 2
- return new_wrapper
- return decorator
-
- _getargspec = inspect.getargspec
-
-
def getargspec(func):
try:
while True:
except AttributeError:
pass
# pylint: disable=deprecated-method
- return _getargspec(func)
+ return inspect.getfullargspec(func)
def str_to_bool(val):
[testenv:check]
-deps =
- six==1.14.0
commands =
python ci/check_grafana_uids.py frontend/src/app ../../../../monitoring/grafana/dashboards