The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/pylxd/pull/420
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) ===
From c3b9b68b75a7ab55d52322e43f5546a8ab1b45df Mon Sep 17 00:00:00 2001 From: Dougal Matthews <dou...@dougalmatthews.com> Date: Fri, 4 Dec 2020 09:59:49 +0000 Subject: [PATCH] Remove uses of NOQA --- pylxd/models/__init__.py | 41 ++++++++++++----- pylxd/tests/mock_lxd.py | 68 ++++++++++++++-------------- pylxd/tests/models/test_image.py | 30 ++++++------ pylxd/tests/models/test_operation.py | 2 +- pylxd/tests/models/test_storage.py | 2 +- pylxd/tests/test_client.py | 2 +- 6 files changed, 80 insertions(+), 65 deletions(-) diff --git a/pylxd/models/__init__.py b/pylxd/models/__init__.py index aa3a3a61..51c3954c 100644 --- a/pylxd/models/__init__.py +++ b/pylxd/models/__init__.py @@ -1,12 +1,29 @@ -from pylxd.models.certificate import Certificate # NOQA -from pylxd.models.cluster import Cluster, ClusterMember # NOQA -from pylxd.models.container import Container # NOQA -from pylxd.models.image import Image # NOQA -from pylxd.models.instance import Instance, Snapshot # NOQA -from pylxd.models.network import Network # NOQA -from pylxd.models.operation import Operation # NOQA -from pylxd.models.profile import Profile # NOQA -from pylxd.models.storage_pool import StoragePool # NOQA; NOQA -from pylxd.models.storage_pool import StorageResources # NOQA -from pylxd.models.storage_pool import StorageVolume # NOQA -from pylxd.models.virtual_machine import VirtualMachine # NOQA +from pylxd.models.certificate import Certificate +from pylxd.models.cluster import Cluster, ClusterMember +from pylxd.models.container import Container +from pylxd.models.image import Image +from pylxd.models.instance import Instance, Snapshot +from pylxd.models.network import Network +from pylxd.models.operation import Operation +from pylxd.models.profile import Profile +from pylxd.models.project import Project +from pylxd.models.storage_pool import StoragePool, StorageResources, StorageVolume +from pylxd.models.virtual_machine import VirtualMachine + +__all__ = [ + "Certificate", + "Cluster", + "ClusterMember", + "Container", + "Image", + "Instance", + "Network", + "Operation", + "Profile", + "Project", + "Snapshot", + "StoragePool", + "StorageResources", + "StorageVolume", + "VirtualMachine", +] diff --git a/pylxd/tests/mock_lxd.py b/pylxd/tests/mock_lxd.py index 0e1febd0..c408cac8 100644 --- a/pylxd/tests/mock_lxd.py +++ b/pylxd/tests/mock_lxd.py @@ -185,13 +185,13 @@ def snapshot_DELETE(request, context): "type": "sync", "metadata": { "certificate": "certificate-content", - "fingerprint": "eaf55b72fc23aa516d709271df9b0116064bf8cfa009cf34c67c33ad32c2320c", # NOQA + "fingerprint": "eaf55b72fc23aa516d709271df9b0116064bf8cfa009cf34c67c33ad32c2320c", "type": "client", }, } ), "method": "GET", - "url": r"^http://pylxd.test/1.0/certificates/eaf55b72fc23aa516d709271df9b0116064bf8cfa009cf34c67c33ad32c2320c$", # NOQA + "url": r"^http://pylxd.test/1.0/certificates/eaf55b72fc23aa516d709271df9b0116064bf8cfa009cf34c67c33ad32c2320c$", }, { "text": json.dumps( @@ -275,7 +275,7 @@ def snapshot_DELETE(request, context): } ), "method": "GET", - "url": r"^http://pylxd.test/1.0/cluster/members/an-member$", # NOQA + "url": r"^http://pylxd.test/1.0/cluster/members/an-member$", }, # Instances { @@ -431,7 +431,7 @@ def snapshot_DELETE(request, context): }, }, "method": "GET", - "url": r"^http://pylxd.test/1.0/instances/an-instance/state$", # NOQA + "url": r"^http://pylxd.test/1.0/instances/an-instance/state$", }, { "json": { @@ -465,7 +465,7 @@ def snapshot_DELETE(request, context): "operation": "/1.0/operations/operation-abc?project=default", }, "method": "PUT", - "url": r"^http://pylxd.test/1.0/instances/an-instance/state$", # NOQA + "url": r"^http://pylxd.test/1.0/instances/an-instance/state$", }, { "json": instance_POST, @@ -505,7 +505,7 @@ def snapshot_DELETE(request, context): }, "status_code": 202, "method": "POST", - "url": r"^http://pylxd.test/1.0/instances/an-instance/exec$", # NOQA + "url": r"^http://pylxd.test/1.0/instances/an-instance/exec$", }, { "json": instance_PUT, @@ -523,7 +523,7 @@ def snapshot_DELETE(request, context): } ), "method": "GET", - "url": r"^http://pylxd.test/1.0/instances/an-instance/snapshots$", # NOQA + "url": r"^http://pylxd.test/1.0/instances/an-instance/snapshots$", }, { "text": json.dumps( @@ -534,7 +534,7 @@ def snapshot_DELETE(request, context): ), "status_code": 202, "method": "POST", - "url": r"^http://pylxd.test/1.0/instances/an-instance/snapshots$", # NOQA + "url": r"^http://pylxd.test/1.0/instances/an-instance/snapshots$", }, { "text": json.dumps( @@ -547,7 +547,7 @@ def snapshot_DELETE(request, context): } ), "method": "GET", - "url": r"^http://pylxd.test/1.0/instances/an-instance/snapshots/an-snapshot$", # NOQA + "url": r"^http://pylxd.test/1.0/instances/an-instance/snapshots/an-snapshot$", }, { "text": json.dumps( @@ -558,31 +558,31 @@ def snapshot_DELETE(request, context): ), "status_code": 202, "method": "POST", - "url": r"^http://pylxd.test/1.0/instances/an-instance/snapshots/an-snapshot$", # NOQA + "url": r"^http://pylxd.test/1.0/instances/an-instance/snapshots/an-snapshot$", }, { "text": snapshot_DELETE, "method": "DELETE", - "url": r"^http://pylxd.test/1.0/instances/an-instance/snapshots/an-snapshot$", # NOQA + "url": r"^http://pylxd.test/1.0/instances/an-instance/snapshots/an-snapshot$", }, # Instance files { "text": "This is a getted file", "method": "GET", - "url": r"^http://pylxd.test/1.0/instances/an-instance/files\?path=%2Ftmp%2Fgetted$", # NOQA + "url": r"^http://pylxd.test/1.0/instances/an-instance/files\?path=%2Ftmp%2Fgetted$", }, { "text": '{"some": "value"}', "method": "GET", - "url": r"^http://pylxd.test/1.0/instances/an-instance/files\?path=%2Ftmp%2Fjson-get$", # NOQA + "url": r"^http://pylxd.test/1.0/instances/an-instance/files\?path=%2Ftmp%2Fjson-get$", }, { "method": "POST", - "url": r"^http://pylxd.test/1.0/instances/an-instance/files\?path=%2Ftmp%2Fputted$", # NOQA + "url": r"^http://pylxd.test/1.0/instances/an-instance/files\?path=%2Ftmp%2Fputted$", }, { "method": "DELETE", - "url": r"^http://pylxd.test/1.0/instances/an-instance/files\?path=%2Ftmp%2Fputted$", # NOQA + "url": r"^http://pylxd.test/1.0/instances/an-instance/files\?path=%2Ftmp%2Fputted$", }, # Images { @@ -590,7 +590,7 @@ def snapshot_DELETE(request, context): { "type": "sync", "metadata": [ - "http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", # NOQA + "http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", ], } ), @@ -615,7 +615,7 @@ def snapshot_DELETE(request, context): "metadata": { "name": "an-alias", "description": "an-alias", - "target": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", # NOQA + "target": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", }, }, "method": "GET", @@ -628,14 +628,14 @@ def snapshot_DELETE(request, context): "metadata": { "aliases": [ { - "name": "an-alias", # NOQA - "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", # NOQA + "name": "an-alias", + "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", } ], "architecture": "x86_64", "cached": False, "filename": "a_image.tar.bz2", - "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", # NOQA + "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "public": False, "properties": {}, "size": 1, @@ -648,7 +648,7 @@ def snapshot_DELETE(request, context): } ), "method": "GET", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", }, { "text": json.dumps( @@ -657,14 +657,14 @@ def snapshot_DELETE(request, context): "metadata": { "aliases": [ { - "name": "an-alias", # NOQA - "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", # NOQA + "name": "an-alias", + "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", } ], "architecture": "x86_64", "cached": False, "filename": "a_image.tar.bz2", - "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", # NOQA + "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "public": False, "properties": {}, "size": 1, @@ -677,7 +677,7 @@ def snapshot_DELETE(request, context): } ), "method": "GET", - "url": r"^http://pylxd2.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", # NOQA + "url": r"^http://pylxd2.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", }, { "text": json.dumps( @@ -688,17 +688,17 @@ def snapshot_DELETE(request, context): ), "status_code": 202, "method": "PUT", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", }, { "text": "0" * 2048, "method": "GET", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/export$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/export$", }, { "text": image_DELETE, "method": "DELETE", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", }, # Image Aliases { @@ -709,7 +709,7 @@ def snapshot_DELETE(request, context): "metadata": { "name": "an-alias", "description": "an-alias", - "target": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", # NOQA + "target": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", }, }, "method": "GET", @@ -749,7 +749,7 @@ def snapshot_DELETE(request, context): "metadata": {"metadata": {"secret": "abcdefg"}}, }, "method": "POST", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/secret$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/secret$", }, # Networks { @@ -989,7 +989,7 @@ def snapshot_DELETE(request, context): { "text": profile_GET, "method": "GET", - "url": r"^http://pylxd.test/1.0/profiles/(an-profile|an-new-profile|an-renamed-profile)$", # NOQA + "url": r"^http://pylxd.test/1.0/profiles/(an-profile|an-new-profile|an-renamed-profile)$", }, { "text": json.dumps({"type": "sync"}), @@ -1052,7 +1052,7 @@ def snapshot_DELETE(request, context): "metadata": { "id": "images-create-operation", "metadata": { - "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" # NOQA + "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }, }, } @@ -1067,7 +1067,7 @@ def snapshot_DELETE(request, context): } ), "method": "GET", - "url": r"^http://pylxd.test/1.0/operations/images-create-operation/wait$", # NOQA + "url": r"^http://pylxd.test/1.0/operations/images-create-operation/wait$", }, { "text": json.dumps( @@ -1086,6 +1086,6 @@ def snapshot_DELETE(request, context): } ), "method": "GET", - "url": r"^http://pylxd2.test/1.0/operations/images-create-operation/wait$", # NOQA + "url": r"^http://pylxd2.test/1.0/operations/images-create-operation/wait$", }, ] diff --git a/pylxd/tests/models/test_image.py b/pylxd/tests/models/test_image.py index ebded064..ff44ed73 100644 --- a/pylxd/tests/models/test_image.py +++ b/pylxd/tests/models/test_image.py @@ -29,7 +29,7 @@ def not_found(request, context): { "text": not_found, "method": "GET", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", } ) @@ -52,7 +52,7 @@ def error(request, context): { "text": error, "method": "GET", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", } ) @@ -92,7 +92,7 @@ def not_found(request, context): { "text": not_found, "method": "GET", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", } ) @@ -162,7 +162,7 @@ def not_found(request, context): { "text": not_found, "method": "GET", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", } ) fingerprint = hashlib.sha256(b"").hexdigest() @@ -184,7 +184,7 @@ def not_found(request, context): { "text": not_found, "method": "GET", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", } ) fingerprint = hashlib.sha256(b"").hexdigest() @@ -204,9 +204,7 @@ def test_delete(self): def test_export(self): """An image is exported.""" - expected = ( - "e2943f8d0b0e7d5835f9533722a6e25f669acb8980daee378b4edb44da212f51" # NOQA - ) + expected = "e2943f8d0b0e7d5835f9533722a6e25f669acb8980daee378b4edb44da212f51" a_image = self.client.images.all()[0] data = a_image.export() @@ -227,7 +225,7 @@ def not_found(request, context): { "text": not_found, "method": "GET", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/export$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/export$", } ) a_image = self.client.images.all()[0] @@ -247,7 +245,7 @@ def error(request, context): { "text": error, "method": "GET", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/export$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/export$", } ) a_image = self.client.images.all()[0] @@ -275,7 +273,7 @@ def error(request, context): { "text": error, "method": "POST", - "url": r"^http://pylxd.test/1.0/images/aliases$", # NOQA + "url": r"^http://pylxd.test/1.0/images/aliases$", } ) @@ -305,7 +303,7 @@ def error(request, context): { "text": error, "method": "DELETE", - "url": r"^http://pylxd.test/1.0/images/aliases/lol$", # NOQA + "url": r"^http://pylxd.test/1.0/images/aliases/lol$", } ) @@ -339,14 +337,14 @@ def image_get(request, context): "metadata": { "aliases": [ { - "name": "an-alias", # NOQA - "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", # NOQA + "name": "an-alias", + "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", } ], "architecture": "x86_64", "cached": False, "filename": "a_image.tar.bz2", - "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", # NOQA + "fingerprint": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "public": True, "properties": {}, "size": 1, @@ -363,7 +361,7 @@ def image_get(request, context): { "text": image_get, "method": "GET", - "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", # NOQA + "url": r"^http://pylxd.test/1.0/images/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855$", } ) diff --git a/pylxd/tests/models/test_operation.py b/pylxd/tests/models/test_operation.py index 31eef32c..781cf330 100644 --- a/pylxd/tests/models/test_operation.py +++ b/pylxd/tests/models/test_operation.py @@ -91,7 +91,7 @@ def error(request, context): { "json": error, "method": "GET", - "url": r"^http://pylxd.test/1.0/operations/operation-abc/wait$", # NOQA + "url": r"^http://pylxd.test/1.0/operations/operation-abc/wait$", } ) diff --git a/pylxd/tests/models/test_storage.py b/pylxd/tests/models/test_storage.py index 4767277f..31b16061 100644 --- a/pylxd/tests/models/test_storage.py +++ b/pylxd/tests/models/test_storage.py @@ -118,7 +118,7 @@ def not_found(request, context): { "text": not_found, "method": "GET", - "url": r"^http://pylxd.test/1.0/storage-pools/an-missing-storage-pool$", # NOQA + "url": r"^http://pylxd.test/1.0/storage-pools/an-missing-storage-pool$", } ) diff --git a/pylxd/tests/test_client.py b/pylxd/tests/test_client.py index 24b64a9f..bb1c0349 100644 --- a/pylxd/tests/test_client.py +++ b/pylxd/tests/test_client.py @@ -159,7 +159,7 @@ def _get(*args, **kwargs): return { "metadata": { "type": "client", - "fingerprint": "eaf55b72fc23aa516d709271df9b0116064bf8cfa009cf34c67c33ad32c2320c", # NOQA + "fingerprint": "eaf55b72fc23aa516d709271df9b0116064bf8cfa009cf34c67c33ad32c2320c", } } else:
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel