diff --git a/ci/pylintrc b/ci/pylintrc index 0ac8194..dbc2e21 100644 --- a/ci/pylintrc +++ b/ci/pylintrc @@ -7,8 +7,7 @@ ignore=tests disable= bad-continuation, fixme, - locally-disabled, - missing-docstring + locally-disabled [REPORTS] diff --git a/qubesmgmt/__init__.py b/qubesmgmt/__init__.py index ffab4ce..2ecfcf6 100644 --- a/qubesmgmt/__init__.py +++ b/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 . +'''Qubes OS management client.''' import os import qubesmgmt.base diff --git a/qubesmgmt/app.py b/qubesmgmt/app.py index 89f980c..588f8c2 100644 --- a/qubesmgmt/app.py +++ b/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 . -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: diff --git a/qubesmgmt/base.py b/qubesmgmt/base.py index f05cca3..aa3a3af 100644 --- a/qubesmgmt/base.py +++ b/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 . + +'''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': diff --git a/qubesmgmt/exc.py b/qubesmgmt/exc.py index 86dc55e..347c5f0 100644 --- a/qubesmgmt/exc.py +++ b/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 . -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) diff --git a/qubesmgmt/vm/__init__.py b/qubesmgmt/vm/__init__.py index 95891db..498858a 100644 --- a/qubesmgmt/vm/__init__.py +++ b/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 . +'''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)