make pylint happy

This commit is contained in:
Marek Marczykowski-Górecki 2017-02-24 00:42:13 +01:00
parent 745d16a879
commit b4e6089cd5
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -63,11 +63,12 @@ class PropertyHolder(object):
return self.app.qubesd_call(dest, method, arg, payload) return self.app.qubesd_call(dest, method, arg, payload)
raise NotImplementedError raise NotImplementedError
def _parse_qubesd_response(self, response_data): @staticmethod
def _parse_qubesd_response(response_data):
if response_data[0:2] == b'\x30\x00': if response_data[0:2] == b'\x30\x00':
return response_data[2:] return response_data[2:]
elif response_data[0:2] == b'\x32\x00': elif response_data[0:2] == b'\x32\x00':
(_, exc_type, traceback, format_string, args) = \ (_, exc_type, _traceback, format_string, args) = \
response_data.split(b'\x00', 4) response_data.split(b'\x00', 4)
# drop last field because of terminating '\x00' # drop last field because of terminating '\x00'
args = [arg.decode() for arg in args.split(b'\x00')[:-1]] args = [arg.decode() for arg in args.split(b'\x00')[:-1]]
@ -98,7 +99,7 @@ class PropertyHolder(object):
self._method_prefix + 'Get', self._method_prefix + 'Get',
item, item,
None) None)
(default, value) = property_str.split(b' ', 1) (default, _value) = property_str.split(b' ', 1)
assert default.startswith(b'default=') assert default.startswith(b'default=')
is_default_str = default.split(b'=')[1] is_default_str = default.split(b'=')[1]
is_default = ast.literal_eval(is_default_str.decode('ascii')) is_default = ast.literal_eval(is_default_str.decode('ascii'))
@ -113,7 +114,7 @@ class PropertyHolder(object):
self._method_prefix + 'Get', self._method_prefix + 'Get',
item, item,
None) None)
(default, value) = property_str.split(' ', 1) (_default, value) = property_str.split(' ', 1)
if value[0] == '\'': if value[0] == '\'':
return ast.literal_eval('b' + value) return ast.literal_eval('b' + value)
else: else:
@ -130,6 +131,7 @@ class PropertyHolder(object):
None) None)
else: else:
if isinstance(value, qubesmgmt.vm.QubesVM): if isinstance(value, qubesmgmt.vm.QubesVM):
# pylint: disable=protected-access
value = value._name value = value._name
self.qubesd_call( self.qubesd_call(
self._method_dest, self._method_dest,
@ -146,7 +148,7 @@ class PropertyHolder(object):
name name
) )
# pylint: disable=wrong-import-position
import qubesmgmt.app import qubesmgmt.app
if os.path.exists(qubesmgmt.app.QUBESD_SOCK): if os.path.exists(qubesmgmt.app.QUBESD_SOCK):