Browse Source

Add missing docstrings, require them by pylint

Marek Marczykowski-Górecki 7 years ago
parent
commit
3e73b242d1
6 changed files with 34 additions and 4 deletions
  1. 1 2
      ci/pylintrc
  2. 1 0
      qubesmgmt/__init__.py
  3. 16 1
      qubesmgmt/app.py
  4. 9 0
      qubesmgmt/base.py
  5. 4 1
      qubesmgmt/exc.py
  6. 3 0
      qubesmgmt/vm/__init__.py

+ 1 - 2
ci/pylintrc

@@ -7,8 +7,7 @@ ignore=tests
 disable=
   bad-continuation,
   fixme,
-  locally-disabled,
-  missing-docstring
+  locally-disabled
 
 [REPORTS]
 

+ 1 - 0
qubesmgmt/__init__.py

@@ -18,6 +18,7 @@
 # You should have received a copy of the GNU Lesser General Public License along
 # with this program; if not, see <http://www.gnu.org/licenses/>.
 
+'''Qubes OS management client.'''
 
 import os
 import qubesmgmt.base

+ 16 - 1
qubesmgmt/app.py

@@ -18,8 +18,12 @@
 # You should have received a copy of the GNU Lesser General Public License along
 # with this program; if not, see <http://www.gnu.org/licenses/>.
 
-import socket
 
+'''
+Main Qubes() class and related classes.
+'''
+
+import socket
 import subprocess
 
 import qubesmgmt.base
@@ -29,7 +33,9 @@ import qubesmgmt.exc
 QUBESD_SOCK = '/var/run/qubesd.sock'
 BUF_SIZE = 4096
 
+
 class VMCollection(object):
+    '''Collection of VMs objects'''
     def __init__(self, app):
         self.app = app
         self._vm_list = None
@@ -72,6 +78,7 @@ class VMCollection(object):
             yield self[vm]
 
     def keys(self):
+        '''Get list of VM names.'''
         self.refresh_cache()
         return self._vm_list.keys()
 
@@ -88,6 +95,10 @@ class QubesBase(qubesmgmt.base.PropertyHolder):
 
 
 class QubesLocal(QubesBase):
+    '''Application object communicating through local socket.
+
+    Used when running in dom0.
+    '''
     def qubesd_call(self, dest, method, arg=None, payload=None):
         try:
             client_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
@@ -108,6 +119,10 @@ class QubesLocal(QubesBase):
 
 
 class QubesRemote(QubesBase):
+    '''Application object communicating through qrexec services.
+
+    Used when running in VM.
+    '''
     def qubesd_call(self, dest, method, arg=None, payload=None):
         service_name = method
         if arg is not None:

+ 9 - 0
qubesmgmt/base.py

@@ -17,11 +17,15 @@
 #
 # You should have received a copy of the GNU Lesser General Public License along
 # with this program; if not, see <http://www.gnu.org/licenses/>.
+
+'''Base classes for managed objects'''
+
 import ast
 import qubesmgmt.exc
 
 DEFAULT = object()
 
+
 class PropertyHolder(object):
     '''A base class for object having properties retrievable using mgmt API.
 
@@ -60,6 +64,11 @@ class PropertyHolder(object):
 
     @staticmethod
     def _parse_qubesd_response(response_data):
+        '''Parse response from qubesd.
+
+        In case of success, return actual data. In case of error,
+        raise appropriate exception.
+        '''
         if response_data[0:2] == b'\x30\x00':
             return response_data[2:]
         elif response_data[0:2] == b'\x32\x00':

+ 4 - 1
qubesmgmt/exc.py

@@ -18,8 +18,11 @@
 # You should have received a copy of the GNU Lesser General Public License along
 # with this program; if not, see <http://www.gnu.org/licenses/>.
 
-class QubesException(Exception):
+'''Exception hierarchy.'''
+
 
+class QubesException(Exception):
+    '''Base exception for all Qubes-related errors.'''
     def __init__(self, message_format, *args, **kwargs):
         # TODO: handle translations
         super(QubesException, self).__init__(message_format % args, **kwargs)

+ 3 - 0
qubesmgmt/vm/__init__.py

@@ -18,10 +18,13 @@
 # You should have received a copy of the GNU General Public License along
 # with this program; if not, see <http://www.gnu.org/licenses/>.
 
+'''Qubes VM objects.'''
+
 import qubesmgmt.base
 
 
 class QubesVM(qubesmgmt.base.PropertyHolder):
+    '''Qubes domain.'''
     def __init__(self, app, name, vm_class):
         self._class = vm_class
         super(QubesVM, self).__init__(app, 'mgmt.vm.property.', name)