Fix pep8 failures seen on submitted patches
Seems like with some possible change in infra we see some
pep8 failures. These are related to Python 3 checks. Handling these
so that code is functional in either Python 2.7 or Python 3 envs.
An attempt is made to be in line with handling this in other community
projects.
Change-Id: Iec4c919bebb70365f932f23b926aa80bf4da6048
(cherry picked from commit 409c1517ab
)
This commit is contained in:
parent
6b02f21230
commit
c9a2bbbed1
|
@ -27,6 +27,10 @@ and also converting to dictionaries.
|
|||
|
||||
from gbpservice.contrib.nfp.configurator.lib import lbv2_constants as l_const
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
|
||||
class BaseDataModel(object):
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@ setattr(pecan, 'mode', constants.advanced)
|
|||
|
||||
from gbpservice.contrib.nfp.configurator.advanced_controller import controller
|
||||
from gbpservice.nfp.pecan.api import root_controller
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
from importlib import reload
|
||||
reload(root_controller)
|
||||
pika.BlockingConnection = mock.MagicMock(return_value=None)
|
||||
|
||||
|
|
|
@ -21,6 +21,10 @@ import zlib
|
|||
|
||||
from gbpservice.nfp.pecan import constants
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
from importlib import reload
|
||||
|
||||
setattr(pecan, 'mode', constants.base)
|
||||
|
||||
|
||||
|
|
|
@ -63,6 +63,9 @@ from gbpservice.neutron.tests.unit.services.grouppolicy import (
|
|||
from gbpservice.neutron.tests.unit.services.grouppolicy import (
|
||||
test_neutron_resources_driver as test_nr_base)
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
ML2PLUS_PLUGIN = 'gbpservice.neutron.plugins.ml2plus.plugin.Ml2PlusPlugin'
|
||||
DEFAULT_FILTER_ENTRY = {'arp_opcode': u'unspecified',
|
||||
|
|
|
@ -35,6 +35,10 @@ from gbpservice.neutron.tests.unit.services.grouppolicy import (
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
from importlib import reload
|
||||
|
||||
|
||||
class Rollback(Exception):
|
||||
pass
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import io
|
||||
|
||||
from gbpclient.v2_0 import client as gbp_client
|
||||
from keystoneauth1.identity import v2
|
||||
from keystoneauth1.identity import v3
|
||||
|
@ -497,7 +499,7 @@ class NovaClient(OpenstackApi):
|
|||
if config_drive is True:
|
||||
kwargs.update(config_drive=True)
|
||||
if userdata is not None and \
|
||||
(type(userdata) is str or type(userdata) is file):
|
||||
(type(userdata) is str or type(userdata) is io.IOBase):
|
||||
kwargs.update(userdata=userdata)
|
||||
if metadata is not None and type(metadata) is dict and metadata != {}:
|
||||
kwargs.update(meta=metadata)
|
||||
|
|
|
@ -32,7 +32,7 @@ class ForkedPdb(pdb.Pdb):
|
|||
def interaction(self, *args, **kwargs):
|
||||
_stdin = sys.stdin
|
||||
try:
|
||||
sys.stdin = file('/dev/stdin')
|
||||
sys.stdin = open('/dev/stdin', 'r')
|
||||
pdb.Pdb.interaction(self, *args, **kwargs)
|
||||
finally:
|
||||
sys.stdin = _stdin
|
||||
|
|
Loading…
Reference in New Issue