pylint reveals:

************* Module frontend.db.backends.afe.base
E0203: 28:DatabaseWrapper._valid_connection: Access to member
'connection' before its definition line 35
E0203: 29:DatabaseWrapper._valid_connection: Access to member
'connection' before its definition line 35
E0203: 31:DatabaseWrapper._valid_connection: Access to member
'connection' before its definition line 35
E0203: 34:DatabaseWrapper._valid_connection: Access to member
'connection' before its definition line 35

Turns out that we do reference self.connection (in fact
defined on base classes), but for pylint this attribute
is not defined (machines that run pylint checks might
not have mysql-python installed). After checking the
code of the base classes, we verify that during init
self.connection is initialized with None anyway, so with
this change we silence yet another pylint complaint
(and since it's called before the base classes init
method, they'll take care of setting it to something
useful anyway).

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 frontend/db/backends/afe/base.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/frontend/db/backends/afe/base.py b/frontend/db/backends/afe/base.py
index 91f39cd..71c4e09 100644
--- a/frontend/db/backends/afe/base.py
+++ b/frontend/db/backends/afe/base.py
@@ -16,6 +16,7 @@ class DatabaseOperations(MySQLOperations):
 
 class DatabaseWrapper(MySQLDatabaseWrapper):
     def __init__(self, *args, **kwargs):
+        self.connection = None
         super(DatabaseWrapper, self).__init__(*args, **kwargs)
         self.creation = MySQLCreation(self)
         try:
-- 
1.7.11.4

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to