Coverage for manila/api/openstack/versioned_method.py: 100%
13 statements
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
1# Copyright 2014 IBM Corp.
2# Copyright 2015 Clinton Knight
3# All Rights Reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
17from manila import utils
20class VersionedMethod(utils.ComparableMixin):
22 def __init__(self, name, start_version, end_version, experimental, func):
23 """Versioning information for a single method.
25 Minimum and maximums are inclusive.
27 :param name: Name of the method
28 :param start_version: Minimum acceptable version
29 :param end_version: Maximum acceptable_version
30 :param experimental: True if method is experimental
31 :param func: Method to call
32 """
33 self.name = name
34 self.start_version = start_version
35 self.end_version = end_version
36 self.experimental = experimental
37 self.func = func
39 def __str__(self):
40 args = {
41 'name': self.name,
42 'start': self.start_version,
43 'end': self.end_version
44 }
45 return ("Version Method %(name)s: min: %(start)s, max: %(end)s" % args)
47 def _cmpkey(self):
48 """Return the value used by ComparableMixin for rich comparisons."""
49 return self.start_version