Merge "Remove six murano/packages"
This commit is contained in:
commit
90def4e28b
|
@ -13,15 +13,11 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import six
|
||||
|
||||
import murano.common.exceptions as e
|
||||
|
||||
|
||||
class PackageException(e.Error):
|
||||
if six.PY2:
|
||||
def __str__(self):
|
||||
return six.text_type(self.message).encode('UTF-8')
|
||||
pass
|
||||
|
||||
|
||||
class PackageClassLoadError(PackageException):
|
||||
|
|
|
@ -16,7 +16,6 @@ import os
|
|||
import shutil
|
||||
import sys
|
||||
|
||||
import six
|
||||
import yaml
|
||||
|
||||
from murano.common.helpers import path
|
||||
|
@ -253,7 +252,7 @@ class HotPackage(package_base.PackageBase):
|
|||
|
||||
@staticmethod
|
||||
def _format_value(value):
|
||||
if isinstance(value, six.string_types):
|
||||
if isinstance(value, str):
|
||||
return str("'" + value + "'")
|
||||
return str(value)
|
||||
|
||||
|
|
|
@ -19,11 +19,11 @@ import sys
|
|||
import tempfile
|
||||
import zipfile
|
||||
|
||||
import six
|
||||
import yaml
|
||||
|
||||
from murano.common.helpers import path
|
||||
from murano.common.plugins import package_types_loader
|
||||
from murano.common import utils
|
||||
import murano.packages.exceptions as e
|
||||
import murano.packages.hot_package
|
||||
import murano.packages.mpl_package
|
||||
|
@ -93,7 +93,7 @@ def load_from_dir(source_directory, filename='manifest.yaml'):
|
|||
content = yaml.safe_load(stream)
|
||||
except Exception as ex:
|
||||
trace = sys.exc_info()[2]
|
||||
six.reraise(
|
||||
utils.reraise(
|
||||
e.PackageLoadError,
|
||||
e.PackageLoadError("Unable to load due to '{0}'".format(ex)),
|
||||
trace)
|
||||
|
|
|
@ -18,8 +18,6 @@ import io
|
|||
import os
|
||||
import zipfile
|
||||
|
||||
import six
|
||||
|
||||
from murano.common.helpers import path
|
||||
|
||||
|
||||
|
@ -29,8 +27,7 @@ class PackageType(object):
|
|||
ALL = [Library, Application]
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Package(object):
|
||||
class Package(object, metaclass=abc.ABCMeta):
|
||||
def __init__(self, format_name, runtime_version, source_directory):
|
||||
self._source_directory = source_directory
|
||||
self._format_name = format_name
|
||||
|
|
|
@ -20,10 +20,10 @@ import re
|
|||
import sys
|
||||
|
||||
import semantic_version
|
||||
import six
|
||||
|
||||
from murano.common.helpers import path
|
||||
from murano.common.i18n import _
|
||||
from murano.common import utils
|
||||
from murano.packages import exceptions
|
||||
from murano.packages import package
|
||||
|
||||
|
@ -153,10 +153,11 @@ class PackageBase(package.Package):
|
|||
|
||||
except Exception as ex:
|
||||
trace = sys.exc_info()[2]
|
||||
six.reraise(exceptions.PackageLoadError,
|
||||
exceptions.PackageLoadError(
|
||||
'Unable to load {0}: {1}'.format(what_image, ex)),
|
||||
trace)
|
||||
utils.reraise(
|
||||
exceptions.PackageLoadError,
|
||||
exceptions.PackageLoadError(
|
||||
'Unable to load {0}: {1}'.format(what_image, ex)),
|
||||
trace)
|
||||
|
||||
@staticmethod
|
||||
def _check_full_name(full_name):
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from murano.packages import exceptions
|
||||
import murano.tests.unit.base as test_base
|
||||
|
||||
|
@ -28,10 +26,7 @@ class TestExceptions(test_base.MuranoTestCase):
|
|||
message=message)
|
||||
expected = 'Unable to load class "{0}" from package: {1}'\
|
||||
.format(class_name, message)
|
||||
if six.PY2:
|
||||
self.assertEqual(expected, error.message)
|
||||
elif six.PY34:
|
||||
self.assertEqual(expected, error.args[0])
|
||||
self.assertEqual(expected, error.args[0])
|
||||
|
||||
def test_package_ui_load_error(self):
|
||||
messages = ['', 'test_message']
|
||||
|
@ -40,10 +35,7 @@ class TestExceptions(test_base.MuranoTestCase):
|
|||
expected = 'Unable to load ui definition from package'
|
||||
if message:
|
||||
expected += ': {0}'.format(message)
|
||||
if six.PY2:
|
||||
self.assertEqual(expected, error.message)
|
||||
elif six.PY34:
|
||||
self.assertEqual(expected, error.args[0])
|
||||
self.assertEqual(expected, error.args[0])
|
||||
|
||||
def test_package_format_error(self):
|
||||
messages = ['', 'test_message']
|
||||
|
@ -52,7 +44,4 @@ class TestExceptions(test_base.MuranoTestCase):
|
|||
expected = 'Incorrect package format'
|
||||
if message:
|
||||
expected += ': {0}'.format(message)
|
||||
if six.PY2:
|
||||
self.assertEqual(expected, error.message)
|
||||
elif six.PY34:
|
||||
self.assertEqual(expected, error.args[0])
|
||||
self.assertEqual(expected, error.args[0])
|
||||
|
|
Loading…
Reference in New Issue