Commits

dani84bs committed a70129d

Fixing pylint complaints on conversa.password.osx

Comments (0)

Files changed (1)

conversa/passwords/osx.py

 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 """Conversa osx keyring module."""
 
-from ctypes import *
+from ctypes import (cdll, c_uint32, c_void_p, byref, memmove, 
+                    create_string_buffer)
 from ctypes.util import find_library
 
 _security = cdll.LoadLibrary(find_library('Security'))
 def args_not_none(fn):
     """Decorator that checks for not None parameters."""
     def _fn_call(*args, **kwargs):
+        """Check the arguments than call the function.7"""
         if any(arg is None for arg in args):
             raise ValueError("Arguments can't be None")
         return fn(*args, **kwargs)
         Retrieve the password from the keychain for
         the given service, username.
         """
-        l = c_uint32()
+        p_length = c_uint32()
         tmp = c_void_p()
         res = _security.SecKeychainFindGenericPassword(self.kc, len(service),
                                                        service, len(username),
-                                                       username, byref(l),
+                                                       username, 
+                                                       byref(p_length),
                                                        byref(tmp), None)
         #No entry for service, username
         if res == ErrSecItemNotFound:
         if res == ErrSecUnimplemented:
             raise OSError()
         #Password is present
-        res = create_string_buffer(l.value)
-        memmove(res, tmp.value, l.value)
+        res = create_string_buffer(p_length.value)
+        memmove(res, tmp.value, p_length.value)
         _security.SecKeychainItemFreeContent(None, tmp)
         return res.raw
 
         Set password for service and username in the keychain,
         raise if the password is already set.
         """
-        l = c_uint32()
+        p_length = c_uint32()
         tmp = c_void_p()
         #Check if the password is present
         res = _security.SecKeychainFindGenericPassword(self.kc, len(service),
                                                        service, len(username),
-                                                       username, byref(l),
+                                                       username, 
+                                                       byref(p_length),
                                                        byref(tmp), None)
         #The password is already in the keychain
         if res != ErrSecItemNotFound:
         """
         Delete the entry for service, username and raises if not present.
         """
-        l = c_uint32()
         tmp = c_void_p()
         #Check if the password is present
         res = _security.SecKeychainFindGenericPassword(self.kc, len(service),