diff --git a/ironic/common/glance_service/base_image_service.py b/ironic/common/glance_service/base_image_service.py index 8b6664edd8..396442c679 100644 --- a/ironic/common/glance_service/base_image_service.py +++ b/ironic/common/glance_service/base_image_service.py @@ -234,7 +234,7 @@ class BaseImageService(object): """ sent_service_image_meta = service_utils.translate_to_glance(image_meta) - #TODO(ghe): Allow copy-from or location headers Bug #1199532 + # TODO(ghe): Allow copy-from or location headers Bug #1199532 if data: sent_service_image_meta['data'] = data @@ -265,7 +265,7 @@ class BaseImageService(object): if data: image_meta['data'] = data - #NOTE(bcwaldon): id is not an editable field, but it is likely to be + # NOTE(bcwaldon): id is not an editable field, but it is likely to be # passed in by calling code. Let's be nice and ignore it. image_meta.pop('id', None) diff --git a/ironic/common/safe_utils.py b/ironic/common/safe_utils.py index 1e8e8ad586..0d4572e213 100644 --- a/ironic/common/safe_utils.py +++ b/ironic/common/safe_utils.py @@ -30,7 +30,7 @@ def getcallargs(function, *args, **kwargs): keyed_args.update(kwargs) - #NOTE(alaski) the implicit 'self' or 'cls' argument shows up in + # NOTE(alaski) the implicit 'self' or 'cls' argument shows up in # argnames but not in args or kwargs. Uses 'in' rather than '==' because # some tests use 'self2'. if 'self' in argnames[0] or 'cls' == argnames[0]: diff --git a/ironic/common/utils.py b/ironic/common/utils.py index 89e58c5633..efd8d87146 100644 --- a/ironic/common/utils.py +++ b/ironic/common/utils.py @@ -409,7 +409,7 @@ def mkfs(fs, path, label=None): args = ['mkswap'] else: args = ['mkfs', '-t', fs] - #add -F to force no interactive execute on non-block device. + # add -F to force no interactive execute on non-block device. if fs in ('ext3', 'ext4'): args.extend(['-F']) if label: diff --git a/ironic/db/sqlalchemy/alembic/versions/2581ebaf0cb2_initial_migration.py b/ironic/db/sqlalchemy/alembic/versions/2581ebaf0cb2_initial_migration.py index fa02b47803..868b8db677 100644 --- a/ironic/db/sqlalchemy/alembic/versions/2581ebaf0cb2_initial_migration.py +++ b/ironic/db/sqlalchemy/alembic/versions/2581ebaf0cb2_initial_migration.py @@ -28,7 +28,7 @@ import sqlalchemy as sa def upgrade(): - ### commands auto generated by Alembic - please adjust! ### + # commands auto generated by Alembic - please adjust! op.create_table( 'conductors', sa.Column('created_at', sa.DateTime(), nullable=True), @@ -98,7 +98,7 @@ def upgrade(): mysql_ENGINE='InnoDB', mysql_DEFAULT_CHARSET='UTF8' ) - ### end Alembic commands ### + # end Alembic commands def downgrade(): diff --git a/ironic/db/sqlalchemy/alembic/versions/31baaf680d2b_add_node_instance_info.py b/ironic/db/sqlalchemy/alembic/versions/31baaf680d2b_add_node_instance_info.py index e20b5a4837..1e7b5d4936 100644 --- a/ironic/db/sqlalchemy/alembic/versions/31baaf680d2b_add_node_instance_info.py +++ b/ironic/db/sqlalchemy/alembic/versions/31baaf680d2b_add_node_instance_info.py @@ -27,14 +27,14 @@ import sqlalchemy as sa def upgrade(): - ### commands auto generated by Alembic - please adjust! ### + # commands auto generated by Alembic - please adjust op.add_column('nodes', sa.Column('instance_info', sa.Text(), nullable=True)) - ### end Alembic commands ### + # end Alembic commands def downgrade(): - ### commands auto generated by Alembic - please adjust! ### + # commands auto generated by Alembic - please adjust op.drop_column('nodes', 'instance_info') - ### end Alembic commands ### + # end Alembic commands diff --git a/ironic/drivers/modules/ilo/deploy.py b/ironic/drivers/modules/ilo/deploy.py index 8d0cc3087d..859079a64b 100644 --- a/ironic/drivers/modules/ilo/deploy.py +++ b/ironic/drivers/modules/ilo/deploy.py @@ -65,7 +65,7 @@ def _update_ipmi_properties(task): node = task.node info = node.driver_info - #updating ipmi credentials + # updating ipmi credentials info['ipmi_address'] = info['ilo_address'] info['ipmi_username'] = info['ilo_username'] info['ipmi_password'] = info['ilo_password'] @@ -73,7 +73,7 @@ def _update_ipmi_properties(task): if 'console_port' in info: info['ipmi_terminal_port'] = info['console_port'] - #saving ipmi credentials to task object + # saving ipmi credentials to task object task.node.driver_info = info diff --git a/ironic/drivers/modules/image_cache.py b/ironic/drivers/modules/image_cache.py index 194c4f9d6f..8f1f54100b 100644 --- a/ironic/drivers/modules/image_cache.py +++ b/ironic/drivers/modules/image_cache.py @@ -87,7 +87,7 @@ class ImageCache(object): """ img_download_lock_name = 'download-image' if self.master_dir is None: - #NOTE(ghe): We don't share images between instances/hosts + # NOTE(ghe): We don't share images between instances/hosts if not CONF.parallel_image_downloads: with lockutils.lock(img_download_lock_name, 'ironic-'): _fetch(ctx, uuid, dest_path, self._image_service, @@ -96,7 +96,7 @@ class ImageCache(object): _fetch(ctx, uuid, dest_path, self._image_service, force_raw) return - #TODO(ghe): have hard links and counts the same behaviour in all fs + # TODO(ghe): have hard links and counts the same behaviour in all fs master_file_name = service_utils.parse_image_ref(uuid)[0] master_path = os.path.join(self.master_dir, master_file_name) @@ -145,8 +145,8 @@ class ImageCache(object): :param force_raw: boolean value, whether to convert the image to raw format """ - #TODO(ghe): timeout and retry for downloads - #TODO(ghe): logging when image cannot be created + # TODO(ghe): timeout and retry for downloads + # TODO(ghe): logging when image cannot be created tmp_dir = tempfile.mkdtemp(dir=self.master_dir) tmp_path = os.path.join(tmp_dir, uuid) try: diff --git a/ironic/tests/api/v1/test_nodes.py b/ironic/tests/api/v1/test_nodes.py index 67649de749..40ba7a0e1d 100644 --- a/ironic/tests/api/v1/test_nodes.py +++ b/ironic/tests/api/v1/test_nodes.py @@ -68,14 +68,14 @@ class TestListNodes(api_base.FunctionalTest): self.addCleanup(p.stop) def _create_association_test_nodes(self): - #create some unassociated nodes + # create some unassociated nodes unassociated_nodes = [] for id in range(3): node = obj_utils.create_test_node(self.context, uuid=utils.generate_uuid()) unassociated_nodes.append(node.uuid) - #created some associated nodes + # created some associated nodes associated_nodes = [] for id in range(4): node = obj_utils.create_test_node( diff --git a/ironic/tests/drivers/test_ipmitool.py b/ironic/tests/drivers/test_ipmitool.py index 49c6015a10..f58daff9ce 100644 --- a/ironic/tests/drivers/test_ipmitool.py +++ b/ironic/tests/drivers/test_ipmitool.py @@ -1009,7 +1009,7 @@ class IPMIToolDriverTestCase(db_base.DbTestCase): @mock.patch.object(ipmi, '_power_on', autospec=False) def test_reboot_ok(self, mock_on, mock_off): manager = mock.MagicMock() - #NOTE(rloo): if autospec is True, then manager.mock_calls is empty + # NOTE(rloo): if autospec is True, then manager.mock_calls is empty mock_on.return_value = states.POWER_ON manager.attach_mock(mock_off, 'power_off') manager.attach_mock(mock_on, 'power_on') @@ -1026,7 +1026,7 @@ class IPMIToolDriverTestCase(db_base.DbTestCase): @mock.patch.object(ipmi, '_power_on', autospec=False) def test_reboot_fail(self, mock_on, mock_off): manager = mock.MagicMock() - #NOTE(rloo): if autospec is True, then manager.mock_calls is empty + # NOTE(rloo): if autospec is True, then manager.mock_calls is empty mock_on.return_value = states.ERROR manager.attach_mock(mock_off, 'power_off') manager.attach_mock(mock_on, 'power_on') diff --git a/ironic/tests/stubs.py b/ironic/tests/stubs.py index 69d797a528..7d43d26769 100644 --- a/ironic/tests/stubs.py +++ b/ironic/tests/stubs.py @@ -25,12 +25,12 @@ class StubGlanceClient(object): _images = images or [] map(lambda image: self.create(**image), _images) - #NOTE(bcwaldon): HACK to get client.images.* to work + # NOTE(bcwaldon): HACK to get client.images.* to work self.images = lambda: None for fn in ('list', 'get', 'data', 'create', 'update', 'delete'): setattr(self.images, fn, getattr(self, fn)) - #TODO(bcwaldon): implement filters + # TODO(bcwaldon): implement filters def list(self, filters=None, marker=None, limit=30): if marker is None: index = 0 diff --git a/ironic/tests/test_glance_service.py b/ironic/tests/test_glance_service.py index c9bd466dc1..8ba1bb3a7c 100644 --- a/ironic/tests/test_glance_service.py +++ b/ironic/tests/test_glance_service.py @@ -489,7 +489,7 @@ class TestGlanceImageService(base.TestCase): stub_service.download(image_id, writer) def test_download_file_url(self): - #NOTE: only in v2 API + # NOTE: only in v2 API class MyGlanceStubClient(stubs.StubGlanceClient): """A client that returns a file url.""" diff --git a/tox.ini b/tox.ini index 1288424c49..3064fc9545 100644 --- a/tox.ini +++ b/tox.ini @@ -46,8 +46,7 @@ commands = {posargs} [flake8] # E711: ignored because it is normal to use "column == None" in sqlalchemy -# TODO(yuriyz): Analyze or fix the warnings blacklisted below -ignore = E12,E265,E711 +ignore = E12,E711 exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,*ironic/nova* max-complexity=17