summarylogtreecommitdiffstats
path: root/mgr-dashboard-update-pylint-to-2.6.0.patch
blob: 6fc3551ffbe698dc89f61ea22b6a2d58ec4e0b7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
From e4f179fa960ed18e8f45bc87d26552d720bc819b Mon Sep 17 00:00:00 2001
From: Volker Theile <vtheile@suse.com>
Date: Fri, 25 Sep 2020 13:17:19 +0200
Subject: [PATCH] mgr/dashboard: update pylint to 2.6.0

* Update pylint to 2.6.0.
* Fix pylint issues.

Fixes: https://tracker.ceph.com/issues/47647

(cherry picked from commit 298c91958a41674a928d53f010b20f174f16d68f)
---
 src/pybind/mgr/dashboard/.pylintrc            |  8 ++++++--
 .../mgr/dashboard/controllers/nfsganesha.py   |  2 +-
 src/pybind/mgr/dashboard/controllers/osd.py   |  2 +-
 src/pybind/mgr/dashboard/plugins/__init__.py  |  2 +-
 .../mgr/dashboard/requirements-lint.txt       |  2 +-
 src/pybind/mgr/dashboard/services/auth.py     |  1 -
 .../mgr/dashboard/services/ceph_service.py    |  2 +-
 src/pybind/mgr/dashboard/services/cephx.py    |  2 +-
 src/pybind/mgr/dashboard/services/ganesha.py  | 20 +++++++++----------
 .../mgr/dashboard/services/iscsi_client.py    |  2 +-
 .../mgr/dashboard/services/iscsi_config.py    |  2 +-
 src/pybind/mgr/dashboard/services/progress.py |  2 +-
 .../mgr/dashboard/services/rgw_client.py      |  3 ++-
 src/pybind/mgr/dashboard/tests/__init__.py    |  2 +-
 src/pybind/mgr/dashboard/tests/helper.py      |  2 +-
 .../dashboard/tests/test_access_control.py    |  2 +-
 .../mgr/dashboard/tests/test_api_auditing.py  |  2 +-
 src/pybind/mgr/dashboard/tests/test_cephfs.py |  2 +-
 .../mgr/dashboard/tests/test_controllers.py   |  2 +-
 src/pybind/mgr/dashboard/tests/test_docs.py   |  2 +-
 .../tests/test_erasure_code_profile.py        |  2 +-
 .../mgr/dashboard/tests/test_exceptions.py    |  2 +-
 .../dashboard/tests/test_feature_toggles.py   |  2 +-
 .../mgr/dashboard/tests/test_ganesha.py       |  2 +-
 .../mgr/dashboard/tests/test_grafana.py       |  2 +-
 src/pybind/mgr/dashboard/tests/test_home.py   |  2 +-
 src/pybind/mgr/dashboard/tests/test_host.py   |  2 +-
 src/pybind/mgr/dashboard/tests/test_iscsi.py  |  3 ++-
 .../mgr/dashboard/tests/test_orchestrator.py  |  2 +-
 src/pybind/mgr/dashboard/tests/test_osd.py    |  4 ++--
 .../mgr/dashboard/tests/test_plugin_debug.py  |  2 +-
 src/pybind/mgr/dashboard/tests/test_pool.py   |  2 +-
 .../mgr/dashboard/tests/test_prometheus.py    |  2 +-
 .../mgr/dashboard/tests/test_rbd_mirroring.py |  2 +-
 .../mgr/dashboard/tests/test_rest_tasks.py    |  2 +-
 src/pybind/mgr/dashboard/tests/test_rgw.py    |  2 +-
 .../mgr/dashboard/tests/test_rgw_client.py    |  2 +-
 .../mgr/dashboard/tests/test_settings.py      |  2 +-
 src/pybind/mgr/dashboard/tests/test_sso.py    |  3 ++-
 src/pybind/mgr/dashboard/tests/test_tools.py  |  2 +-
 src/pybind/mgr/dashboard/tools.py             |  2 +-
 41 files changed, 58 insertions(+), 52 deletions(-)

diff --git a/src/pybind/mgr/dashboard/.pylintrc b/src/pybind/mgr/dashboard/.pylintrc
index 404a16a2e6..c4bf033cda 100644
--- a/src/pybind/mgr/dashboard/.pylintrc
+++ b/src/pybind/mgr/dashboard/.pylintrc
@@ -15,7 +15,7 @@ ignore-patterns=
 
 # Python code to execute, usually for sys.path manipulation such as
 # pygtk.require().
-#init-hook=
+init-hook='import sys; sys.path.append("./")'
 
 # Use multiple processes to speed up Pylint.
 jobs=1
@@ -118,7 +118,11 @@ disable=import-star-module-level,
         too-many-arguments,
         too-many-locals,
         too-many-statements,
-        useless-object-inheritance
+        useless-object-inheritance,
+        relative-beyond-top-level,
+        raise-missing-from,
+        super-with-arguments,
+        import-outside-toplevel
 
 
 # Enable the message, report, category or checker with the given id(s). You can
diff --git a/src/pybind/mgr/dashboard/controllers/nfsganesha.py b/src/pybind/mgr/dashboard/controllers/nfsganesha.py
index 1219f78b95..510b37a712 100644
--- a/src/pybind/mgr/dashboard/controllers/nfsganesha.py
+++ b/src/pybind/mgr/dashboard/controllers/nfsganesha.py
@@ -272,7 +272,7 @@ class NFSGaneshaService(RESTController):
 class NFSGaneshaUi(BaseController):
     @Endpoint('GET', '/cephx/clients')
     def cephx_clients(self):
-        return [client for client in CephX.list_clients()]
+        return list(CephX.list_clients())
 
     @Endpoint('GET', '/fsals')
     def fsals(self):
diff --git a/src/pybind/mgr/dashboard/controllers/osd.py b/src/pybind/mgr/dashboard/controllers/osd.py
index 2731ad0ffc..f95951cba2 100644
--- a/src/pybind/mgr/dashboard/controllers/osd.py
+++ b/src/pybind/mgr/dashboard/controllers/osd.py
@@ -272,7 +272,7 @@ class Osd(RESTController):
 
     @CreatePermission
     @osd_task('create', {'tracking_id': '{tracking_id}'})
-    def create(self, method, data, tracking_id):  # pylint: disable=W0622
+    def create(self, method, data, tracking_id):  # pylint: disable=unused-argument
         if method == 'bare':
             return self._create_bare(data)
         if method == 'drive_groups':
diff --git a/src/pybind/mgr/dashboard/plugins/__init__.py b/src/pybind/mgr/dashboard/plugins/__init__.py
index 8973654770..3e3aca4001 100644
--- a/src/pybind/mgr/dashboard/plugins/__init__.py
+++ b/src/pybind/mgr/dashboard/plugins/__init__.py
@@ -71,4 +71,4 @@ class DashboardPluginManager(object):
 PLUGIN_MANAGER = DashboardPluginManager("ceph-mgr.dashboard")
 
 # Load all interfaces and their hooks
-from . import interfaces  # noqa: F401 pylint: disable=wrong-import-position,cyclic-import
+from . import interfaces  # noqa pylint: disable=C0413,W0406
diff --git a/src/pybind/mgr/dashboard/requirements-lint.txt b/src/pybind/mgr/dashboard/requirements-lint.txt
index 8f68ad3856..f01fa54e6e 100644
--- a/src/pybind/mgr/dashboard/requirements-lint.txt
+++ b/src/pybind/mgr/dashboard/requirements-lint.txt
@@ -1,4 +1,4 @@
-pylint==2.3.1; python_version >= '3'
+pylint==2.6.0
 flake8==3.7.8; python_version >= '3'
 flake8-colors==0.1.6; python_version >= '3'
 #TODO: Fix docstring issues: https://tracker.ceph.com/issues/41224
diff --git a/src/pybind/mgr/dashboard/services/auth.py b/src/pybind/mgr/dashboard/services/auth.py
index d829362e63..475d501263 100644
--- a/src/pybind/mgr/dashboard/services/auth.py
+++ b/src/pybind/mgr/dashboard/services/auth.py
@@ -177,7 +177,6 @@ class AuthManagerTool(cherrypy.Tool):
 
     def _check_authorization(self, username):
         self.logger.debug("checking authorization...")
-        username = username
         handler = cherrypy.request.handler.callable
         controller = handler.__self__
         sec_scope = getattr(controller, '_security_scope', None)
diff --git a/src/pybind/mgr/dashboard/services/ceph_service.py b/src/pybind/mgr/dashboard/services/ceph_service.py
index a6eee2957e..89582e3f73 100644
--- a/src/pybind/mgr/dashboard/services/ceph_service.py
+++ b/src/pybind/mgr/dashboard/services/ceph_service.py
@@ -12,7 +12,7 @@ from .. import mgr
 from ..exceptions import DashboardException
 
 try:
-    from typing import Dict, Any, Union  # pylint: disable=unused-import
+    from typing import Dict, Any, Union
 except ImportError:
     pass  # For typing only
 
diff --git a/src/pybind/mgr/dashboard/services/cephx.py b/src/pybind/mgr/dashboard/services/cephx.py
index ccda387961..60303ad85f 100644
--- a/src/pybind/mgr/dashboard/services/cephx.py
+++ b/src/pybind/mgr/dashboard/services/cephx.py
@@ -22,7 +22,7 @@ class CephX(object):
 
     @classmethod
     def list_clients(cls):
-        return [client for client in cls._clients_map()]
+        return list(cls._clients_map())
 
     @classmethod
     def get_client_key(cls, client_id):
diff --git a/src/pybind/mgr/dashboard/services/ganesha.py b/src/pybind/mgr/dashboard/services/ganesha.py
index e9144db406..764ebb3739 100644
--- a/src/pybind/mgr/dashboard/services/ganesha.py
+++ b/src/pybind/mgr/dashboard/services/ganesha.py
@@ -69,7 +69,7 @@ class Ganesha(object):
 
     @classmethod
     def get_ganesha_clusters(cls):
-        return [cluster_id for cluster_id in cls._get_clusters_locations()]
+        return list(cls._get_clusters_locations())
 
     @staticmethod
     def _get_orch_nfs_instances():
@@ -325,7 +325,7 @@ class GaneshaConfParser(object):
         for key, val in block.items():
             if key == 'block_name':
                 continue
-            elif key == '_blocks_':
+            if key == '_blocks_':
                 for blo in val:
                     conf_str += GaneshaConfParser.write_block(blo, depth)
             elif val:
@@ -693,21 +693,21 @@ class Export(object):
             result['attr_expiration_time'] = self.attr_expiration_time
             result['security_label'] = self.security_label
         if 'protocols' not in defaults:
-            result['protocols'] = [p for p in self.protocols]
+            result['protocols'] = list(self.protocols)
         else:
             def_proto = defaults['protocols']
             if not isinstance(def_proto, list):
                 def_proto = set([def_proto])
             if self.protocols != def_proto:
-                result['protocols'] = [p for p in self.protocols]
+                result['protocols'] = list(self.protocols)
         if 'transports' not in defaults:
-            result['transports'] = [t for t in self.transports]
+            result['transports'] = list(self.transports)
         else:
             def_transp = defaults['transports']
             if not isinstance(def_transp, list):
                 def_transp = set([def_transp])
             if self.transports != def_transp:
-                result['transports'] = [t for t in self.transports]
+                result['transports'] = list(self.transports)
 
         result['_blocks_'] = [self.fsal.to_fsal_block()]
         result['_blocks_'].extend([client.to_client_block()
@@ -737,14 +737,14 @@ class Export(object):
             'path': self.path,
             'fsal': self.fsal.to_dict(),
             'cluster_id': self.cluster_id,
-            'daemons': sorted([d for d in self.daemons]),
+            'daemons': sorted(list(self.daemons)),
             'pseudo': self.pseudo,
             'tag': self.tag,
             'access_type': self.access_type,
             'squash': self.squash,
             'security_label': self.security_label,
-            'protocols': sorted([p for p in self.protocols]),
-            'transports': sorted([t for t in self.transports]),
+            'protocols': sorted(list(self.protocols)),
+            'transports': sorted(list(self.transports)),
             'clients': [client.to_dict() for client in self.clients]
         }
 
@@ -992,7 +992,7 @@ class GaneshaConf(object):
         return None
 
     def list_daemons(self):
-        return [daemon_id for daemon_id in self.daemons_conf_blocks]
+        return list(self.daemons_conf_blocks)
 
     def reload_daemons(self, daemons):
         with mgr.rados.open_ioctx(self.rados_pool) as ioctx:
diff --git a/src/pybind/mgr/dashboard/services/iscsi_client.py b/src/pybind/mgr/dashboard/services/iscsi_client.py
index b82a51a3d4..c5a6dfa0e7 100644
--- a/src/pybind/mgr/dashboard/services/iscsi_client.py
+++ b/src/pybind/mgr/dashboard/services/iscsi_client.py
@@ -12,7 +12,7 @@ try:
 except ImportError:
     from urllib.parse import urlparse
 
-from .iscsi_config import IscsiGatewaysConfig  # pylint: disable=cyclic-import
+from .iscsi_config import IscsiGatewaysConfig
 from ..settings import Settings
 from ..rest_client import RestClient
 
diff --git a/src/pybind/mgr/dashboard/services/iscsi_config.py b/src/pybind/mgr/dashboard/services/iscsi_config.py
index ab90048500..86bdfc770d 100644
--- a/src/pybind/mgr/dashboard/services/iscsi_config.py
+++ b/src/pybind/mgr/dashboard/services/iscsi_config.py
@@ -57,7 +57,7 @@ class IscsiGatewaysConfig(object):
         """
         for gateway_name, gateway_config in config['gateways'].items():
             if '.' not in gateway_name:
-                from .iscsi_client import IscsiClient
+                from .iscsi_client import IscsiClient  # pylint: disable=cyclic-import
                 from ..rest_client import RequestException
                 try:
                     service_url = gateway_config['service_url']
diff --git a/src/pybind/mgr/dashboard/services/progress.py b/src/pybind/mgr/dashboard/services/progress.py
index d8cf7521fa..d7b9ed973b 100644
--- a/src/pybind/mgr/dashboard/services/progress.py
+++ b/src/pybind/mgr/dashboard/services/progress.py
@@ -12,7 +12,7 @@ from __future__ import absolute_import
 from datetime import datetime
 import logging
 
-from . import rbd
+from . import rbd  # pylint: disable=no-name-in-module
 from .. import mgr
 
 
diff --git a/src/pybind/mgr/dashboard/services/rgw_client.py b/src/pybind/mgr/dashboard/services/rgw_client.py
index 5507eb6800..aee18acc54 100644
--- a/src/pybind/mgr/dashboard/services/rgw_client.py
+++ b/src/pybind/mgr/dashboard/services/rgw_client.py
@@ -16,7 +16,7 @@ from ..tools import build_url, dict_contains_path, json_str_to_object,\
 from .. import mgr
 
 try:
-    from typing import Dict, List, Optional  # pylint: disable=unused-import
+    from typing import Dict, List, Optional
 except ImportError:
     pass  # For typing only
 
@@ -303,6 +303,7 @@ class RgwClient(RestClient):
         if self.userid != RgwClient._SYSTEM_USERID:
             logger.info("Fetching new keys for user: %s", self.userid)
             keys = RgwClient.admin_instance().get_user_keys(self.userid)
+            # pylint: disable=attribute-defined-outside-init
             self.auth = S3Auth(keys['access_key'], keys['secret_key'],
                                service_url=self.service_url)
         else:
diff --git a/src/pybind/mgr/dashboard/tests/__init__.py b/src/pybind/mgr/dashboard/tests/__init__.py
index 421378a155..8eb5bb8af1 100644
--- a/src/pybind/mgr/dashboard/tests/__init__.py
+++ b/src/pybind/mgr/dashboard/tests/__init__.py
@@ -21,7 +21,7 @@ from ..services.auth import AuthManagerTool
 from ..services.exception import dashboard_exception_handler
 
 from ..plugins import PLUGIN_MANAGER
-from ..plugins import feature_toggles, debug  # noqa # pylint: disable=unused-import
+from ..plugins import feature_toggles, debug  # noqa
 
 
 PLUGIN_MANAGER.hook.init()
diff --git a/src/pybind/mgr/dashboard/tests/helper.py b/src/pybind/mgr/dashboard/tests/helper.py
index 9ec043d6be..06b83d42a8 100644
--- a/src/pybind/mgr/dashboard/tests/helper.py
+++ b/src/pybind/mgr/dashboard/tests/helper.py
@@ -2,7 +2,7 @@
 from __future__ import absolute_import
 
 try:
-    from typing import Dict, Any  # pylint: disable=unused-import
+    from typing import Dict, Any
 except ImportError:
     pass
 
diff --git a/src/pybind/mgr/dashboard/tests/test_access_control.py b/src/pybind/mgr/dashboard/tests/test_access_control.py
index 0039efc167..81604a161e 100644
--- a/src/pybind/mgr/dashboard/tests/test_access_control.py
+++ b/src/pybind/mgr/dashboard/tests/test_access_control.py
@@ -9,7 +9,7 @@ import unittest
 
 from datetime import datetime, timedelta
 
-from . import CmdException, CLICommandTestMixin
+from . import CmdException, CLICommandTestMixin  # pylint: disable=no-name-in-module
 from .. import mgr
 from ..security import Scope, Permission
 from ..services.access_control import load_access_control_db, \
diff --git a/src/pybind/mgr/dashboard/tests/test_api_auditing.py b/src/pybind/mgr/dashboard/tests/test_api_auditing.py
index 0416c03638..023ea7992a 100644
--- a/src/pybind/mgr/dashboard/tests/test_api_auditing.py
+++ b/src/pybind/mgr/dashboard/tests/test_api_auditing.py
@@ -9,7 +9,7 @@ try:
 except ImportError:
     import unittest.mock as mock
 
-from . import ControllerTestCase, KVStoreMockMixin
+from . import ControllerTestCase, KVStoreMockMixin  # pylint: disable=no-name-in-module
 from ..controllers import RESTController, Controller
 from ..tools import RequestLoggingTool
 from .. import mgr
diff --git a/src/pybind/mgr/dashboard/tests/test_cephfs.py b/src/pybind/mgr/dashboard/tests/test_cephfs.py
index e9abda5380..778b0aa275 100644
--- a/src/pybind/mgr/dashboard/tests/test_cephfs.py
+++ b/src/pybind/mgr/dashboard/tests/test_cephfs.py
@@ -6,7 +6,7 @@ except ImportError:
     from unittest.mock import Mock
 
 from .. import mgr
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from ..controllers.cephfs import CephFS
 
 
diff --git a/src/pybind/mgr/dashboard/tests/test_controllers.py b/src/pybind/mgr/dashboard/tests/test_controllers.py
index 0e88047061..b14878ff2e 100644
--- a/src/pybind/mgr/dashboard/tests/test_controllers.py
+++ b/src/pybind/mgr/dashboard/tests/test_controllers.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import
 
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from ..controllers import BaseController, RESTController, Controller, \
                           ApiController, Endpoint
 
diff --git a/src/pybind/mgr/dashboard/tests/test_docs.py b/src/pybind/mgr/dashboard/tests/test_docs.py
index a6e03b5267..ccb777aca5 100644
--- a/src/pybind/mgr/dashboard/tests/test_docs.py
+++ b/src/pybind/mgr/dashboard/tests/test_docs.py
@@ -1,7 +1,7 @@
 # # -*- coding: utf-8 -*-
 from __future__ import absolute_import
 
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from ..controllers import RESTController, ApiController, Endpoint, EndpointDoc, ControllerDoc
 from ..controllers.docs import Docs
 
diff --git a/src/pybind/mgr/dashboard/tests/test_erasure_code_profile.py b/src/pybind/mgr/dashboard/tests/test_erasure_code_profile.py
index 557b7c1061..d266735e8f 100644
--- a/src/pybind/mgr/dashboard/tests/test_erasure_code_profile.py
+++ b/src/pybind/mgr/dashboard/tests/test_erasure_code_profile.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 from .. import mgr
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from ..controllers.erasure_code_profile import ErasureCodeProfile
 
 
diff --git a/src/pybind/mgr/dashboard/tests/test_exceptions.py b/src/pybind/mgr/dashboard/tests/test_exceptions.py
index 2bb25da1bf..b42c356479 100644
--- a/src/pybind/mgr/dashboard/tests/test_exceptions.py
+++ b/src/pybind/mgr/dashboard/tests/test_exceptions.py
@@ -5,7 +5,7 @@ import time
 
 import rados
 
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from ..services.ceph_service import SendCommandError
 from ..controllers import RESTController, Controller, Task, Endpoint
 from ..services.exception import handle_rados_error, handle_send_command_error, \
diff --git a/src/pybind/mgr/dashboard/tests/test_feature_toggles.py b/src/pybind/mgr/dashboard/tests/test_feature_toggles.py
index 031d0ef839..23068c5eda 100644
--- a/src/pybind/mgr/dashboard/tests/test_feature_toggles.py
+++ b/src/pybind/mgr/dashboard/tests/test_feature_toggles.py
@@ -7,7 +7,7 @@ try:
 except ImportError:
     from unittest.mock import Mock, patch
 
-from . import KVStoreMockMixin
+from . import KVStoreMockMixin  # pylint: disable=no-name-in-module
 from ..plugins.feature_toggles import FeatureToggles, Features
 
 
diff --git a/src/pybind/mgr/dashboard/tests/test_ganesha.py b/src/pybind/mgr/dashboard/tests/test_ganesha.py
index 03f1f5b551..44498ac40c 100644
--- a/src/pybind/mgr/dashboard/tests/test_ganesha.py
+++ b/src/pybind/mgr/dashboard/tests/test_ganesha.py
@@ -9,7 +9,7 @@ except ImportError:
     from unittest.mock import MagicMock, Mock
 
 import orchestrator
-from . import KVStoreMockMixin
+from . import KVStoreMockMixin  # pylint: disable=no-name-in-module
 from .. import mgr
 from ..settings import Settings
 from ..services import ganesha
diff --git a/src/pybind/mgr/dashboard/tests/test_grafana.py b/src/pybind/mgr/dashboard/tests/test_grafana.py
index 0eb46bf0f0..a5456905f2 100644
--- a/src/pybind/mgr/dashboard/tests/test_grafana.py
+++ b/src/pybind/mgr/dashboard/tests/test_grafana.py
@@ -8,7 +8,7 @@ except ImportError:
 
 from requests import RequestException
 
-from . import ControllerTestCase, KVStoreMockMixin
+from . import ControllerTestCase, KVStoreMockMixin  # pylint: disable=no-name-in-module
 from ..controllers.grafana import Grafana
 from ..grafana import GrafanaRestClient
 from ..settings import Settings
diff --git a/src/pybind/mgr/dashboard/tests/test_home.py b/src/pybind/mgr/dashboard/tests/test_home.py
index c3088b7a65..c942eed9be 100644
--- a/src/pybind/mgr/dashboard/tests/test_home.py
+++ b/src/pybind/mgr/dashboard/tests/test_home.py
@@ -8,7 +8,7 @@ try:
 except ImportError:
     import unittest.mock as mock
 
-from . import ControllerTestCase, FakeFsMixin
+from . import ControllerTestCase, FakeFsMixin  # pylint: disable=no-name-in-module
 from .. import mgr
 
 from ..controllers.home import HomeController, LanguageMixin
diff --git a/src/pybind/mgr/dashboard/tests/test_host.py b/src/pybind/mgr/dashboard/tests/test_host.py
index ab7286074b..191c3f1245 100644
--- a/src/pybind/mgr/dashboard/tests/test_host.py
+++ b/src/pybind/mgr/dashboard/tests/test_host.py
@@ -7,7 +7,7 @@ except ImportError:
 
 from orchestrator import HostSpec
 
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from ..controllers.host import get_hosts, Host, HostUi
 from .. import mgr
 
diff --git a/src/pybind/mgr/dashboard/tests/test_iscsi.py b/src/pybind/mgr/dashboard/tests/test_iscsi.py
index 962ffeb684..72d64453ac 100644
--- a/src/pybind/mgr/dashboard/tests/test_iscsi.py
+++ b/src/pybind/mgr/dashboard/tests/test_iscsi.py
@@ -10,7 +10,8 @@ try:
 except ImportError:
     import unittest.mock as mock
 
-from . import CmdException, ControllerTestCase, CLICommandTestMixin, KVStoreMockMixin
+from . import CmdException, ControllerTestCase, CLICommandTestMixin, \
+    KVStoreMockMixin  # pylint: disable=no-name-in-module
 from .. import mgr
 from ..controllers.iscsi import Iscsi, IscsiTarget
 from ..services.iscsi_client import IscsiClient
diff --git a/src/pybind/mgr/dashboard/tests/test_orchestrator.py b/src/pybind/mgr/dashboard/tests/test_orchestrator.py
index 714d59c085..9a9d179bbc 100644
--- a/src/pybind/mgr/dashboard/tests/test_orchestrator.py
+++ b/src/pybind/mgr/dashboard/tests/test_orchestrator.py
@@ -6,7 +6,7 @@ except ImportError:
 
 from orchestrator import InventoryHost
 
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from .. import mgr
 from ..controllers.orchestrator import get_device_osd_map
 from ..controllers.orchestrator import Orchestrator
diff --git a/src/pybind/mgr/dashboard/tests/test_osd.py b/src/pybind/mgr/dashboard/tests/test_osd.py
index aeb32ed576..063705ddbb 100644
--- a/src/pybind/mgr/dashboard/tests/test_osd.py
+++ b/src/pybind/mgr/dashboard/tests/test_osd.py
@@ -11,11 +11,11 @@ except ImportError:
 from ceph.deployment.drive_group import DeviceSelection, DriveGroupSpec
 from ceph.deployment.service_spec import PlacementSpec
 
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from ..controllers.osd import Osd
 from ..tools import NotificationQueue, TaskManager
 from .. import mgr
-from .helper import update_dict
+from .helper import update_dict  # pylint: disable=import-error
 
 try:
     from typing import List, Dict, Any  # pylint: disable=unused-import
diff --git a/src/pybind/mgr/dashboard/tests/test_plugin_debug.py b/src/pybind/mgr/dashboard/tests/test_plugin_debug.py
index 4985540046..cb4d1afc21 100644
--- a/src/pybind/mgr/dashboard/tests/test_plugin_debug.py
+++ b/src/pybind/mgr/dashboard/tests/test_plugin_debug.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import
 
-from . import CLICommandTestMixin, ControllerTestCase
+from . import CLICommandTestMixin, ControllerTestCase  # pylint: disable=no-name-in-module
 
 
 class TestPluginDebug(ControllerTestCase, CLICommandTestMixin):
diff --git a/src/pybind/mgr/dashboard/tests/test_pool.py b/src/pybind/mgr/dashboard/tests/test_pool.py
index e33e436540..179a8feeed 100644
--- a/src/pybind/mgr/dashboard/tests/test_pool.py
+++ b/src/pybind/mgr/dashboard/tests/test_pool.py
@@ -6,7 +6,7 @@ try:
 except ImportError:
     import unittest.mock as mock
 
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from ..controllers.pool import Pool
 from ..controllers.task import Task
 from ..tools import NotificationQueue, TaskManager
diff --git a/src/pybind/mgr/dashboard/tests/test_prometheus.py b/src/pybind/mgr/dashboard/tests/test_prometheus.py
index 3385d66a97..ef669a6203 100644
--- a/src/pybind/mgr/dashboard/tests/test_prometheus.py
+++ b/src/pybind/mgr/dashboard/tests/test_prometheus.py
@@ -5,7 +5,7 @@ try:
 except ImportError:
     from unittest.mock import patch
 
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from .. import mgr
 from ..controllers.prometheus import Prometheus, PrometheusReceiver, PrometheusNotifications
 
diff --git a/src/pybind/mgr/dashboard/tests/test_rbd_mirroring.py b/src/pybind/mgr/dashboard/tests/test_rbd_mirroring.py
index ecb4856dc1..d7e0c7dd1e 100644
--- a/src/pybind/mgr/dashboard/tests/test_rbd_mirroring.py
+++ b/src/pybind/mgr/dashboard/tests/test_rbd_mirroring.py
@@ -6,7 +6,7 @@ try:
 except ImportError:
     import unittest.mock as mock
 
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from .. import mgr
 from ..controllers.summary import Summary
 from ..controllers.rbd_mirroring import RbdMirroring, RbdMirroringSummary, \
diff --git a/src/pybind/mgr/dashboard/tests/test_rest_tasks.py b/src/pybind/mgr/dashboard/tests/test_rest_tasks.py
index e9d7907f05..aa158cd288 100644
--- a/src/pybind/mgr/dashboard/tests/test_rest_tasks.py
+++ b/src/pybind/mgr/dashboard/tests/test_rest_tasks.py
@@ -8,7 +8,7 @@ try:
 except ImportError:
     import unittest.mock as mock
 
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from ..controllers import Controller, RESTController, Task
 from ..controllers.task import Task as TaskController
 from ..services import progress
diff --git a/src/pybind/mgr/dashboard/tests/test_rgw.py b/src/pybind/mgr/dashboard/tests/test_rgw.py
index 2c90e7d11b..11818ca2b7 100644
--- a/src/pybind/mgr/dashboard/tests/test_rgw.py
+++ b/src/pybind/mgr/dashboard/tests/test_rgw.py
@@ -3,7 +3,7 @@ try:
 except ImportError:
     import unittest.mock as mock
 
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from ..controllers.rgw import RgwUser
 
 
diff --git a/src/pybind/mgr/dashboard/tests/test_rgw_client.py b/src/pybind/mgr/dashboard/tests/test_rgw_client.py
index d69ab2f48d..fa711b45ca 100644
--- a/src/pybind/mgr/dashboard/tests/test_rgw_client.py
+++ b/src/pybind/mgr/dashboard/tests/test_rgw_client.py
@@ -9,7 +9,7 @@ except ImportError:
 
 from ..services.rgw_client import RgwClient, _parse_frontend_config
 from ..settings import Settings
-from . import KVStoreMockMixin
+from . import KVStoreMockMixin  # pylint: disable=no-name-in-module
 
 
 class RgwClientTest(unittest.TestCase, KVStoreMockMixin):
diff --git a/src/pybind/mgr/dashboard/tests/test_settings.py b/src/pybind/mgr/dashboard/tests/test_settings.py
index da54a20655..abdb059c1d 100644
--- a/src/pybind/mgr/dashboard/tests/test_settings.py
+++ b/src/pybind/mgr/dashboard/tests/test_settings.py
@@ -3,7 +3,7 @@ from __future__ import absolute_import
 
 import errno
 import unittest
-from . import KVStoreMockMixin, ControllerTestCase
+from . import KVStoreMockMixin, ControllerTestCase  # pylint: disable=no-name-in-module
 from .. import settings
 from ..controllers.settings import Settings as SettingsController
 from ..settings import Settings, handle_option_command
diff --git a/src/pybind/mgr/dashboard/tests/test_sso.py b/src/pybind/mgr/dashboard/tests/test_sso.py
index f8681b89ed..e8141a09cc 100644
--- a/src/pybind/mgr/dashboard/tests/test_sso.py
+++ b/src/pybind/mgr/dashboard/tests/test_sso.py
@@ -5,7 +5,8 @@ from __future__ import absolute_import
 import errno
 import unittest
 
-from . import CmdException, exec_dashboard_cmd, KVStoreMockMixin
+from . import CmdException, exec_dashboard_cmd, \
+    KVStoreMockMixin  # pylint: disable=no-name-in-module
 from ..services.sso import handle_sso_command, load_sso_db
 
 
diff --git a/src/pybind/mgr/dashboard/tests/test_tools.py b/src/pybind/mgr/dashboard/tests/test_tools.py
index 0f27ec8e63..340ff8c41d 100644
--- a/src/pybind/mgr/dashboard/tests/test_tools.py
+++ b/src/pybind/mgr/dashboard/tests/test_tools.py
@@ -10,7 +10,7 @@ try:
 except ImportError:
     from unittest.mock import patch
 
-from . import ControllerTestCase
+from . import ControllerTestCase  # pylint: disable=no-name-in-module
 from ..services.exception import handle_rados_error
 from ..controllers import RESTController, ApiController, Controller, \
                           BaseController, Proxy
diff --git a/src/pybind/mgr/dashboard/tools.py b/src/pybind/mgr/dashboard/tools.py
index 2b6d92ca55..d9a2d813c0 100644
--- a/src/pybind/mgr/dashboard/tools.py
+++ b/src/pybind/mgr/dashboard/tools.py
@@ -30,7 +30,7 @@ from .services.auth import JwtManager
 
 try:
     from typing import Any, AnyStr, Callable, DefaultDict, Deque,\
-        Dict, List, Set, Tuple, Union  # noqa pylint: disable=unused-import
+        Dict, List, Set, Tuple, Union  # noqa
 except ImportError:
     pass  # For typing only