mirror of
https://github.com/munki/munki.git
synced 2026-05-02 02:09:19 -05:00
PyLint cleanups
This commit is contained in:
@@ -760,7 +760,8 @@ def update_acrobatpro(dmgpath):
|
||||
if item['path'].endswith('/' + appname)]
|
||||
|
||||
# hope there's only one!
|
||||
if len(candidates) == 0:
|
||||
if not candidates:
|
||||
# there are no candidates!
|
||||
if status == "optional":
|
||||
continue
|
||||
else:
|
||||
|
||||
@@ -70,7 +70,7 @@ def get_firmware_alert_text(dom):
|
||||
if type_is_firmware:
|
||||
firmware_alert_text = '_DEFAULT_FIRMWARE_ALERT_TEXT_'
|
||||
readmes = dom.getElementsByTagName('readme')
|
||||
if len(readmes):
|
||||
if readmes:
|
||||
html = readmes[0].firstChild.data
|
||||
html_data = buffer(html.encode('utf-8'))
|
||||
attributed_string, _ = NSAttributedString.alloc(
|
||||
|
||||
@@ -73,9 +73,9 @@ def supports_auth_restart():
|
||||
if 'true' in is_supported:
|
||||
display.display_debug1('FileVault supports AuthRestart...')
|
||||
return True
|
||||
else:
|
||||
display.display_warning('FileVault AuthRestart is not supported...')
|
||||
return False
|
||||
|
||||
display.display_warning('FileVault AuthRestart is not supported...')
|
||||
return False
|
||||
|
||||
|
||||
def is_fv_user(username):
|
||||
@@ -178,8 +178,8 @@ def perform_auth_restart(username=None, password=None):
|
||||
if err:
|
||||
display.display_error(err)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
# no error, so I guess we're successful
|
||||
return True
|
||||
|
||||
|
||||
def do_authorized_or_normal_restart(username=None,
|
||||
|
||||
@@ -676,10 +676,7 @@ def is_bundle(pathname):
|
||||
extension = os.path.splitext(basename)[1]
|
||||
if extension in bundle_extensions:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
return False
|
||||
|
||||
|
||||
def inside_bundle(pathname):
|
||||
@@ -805,7 +802,7 @@ def removepackages(pkgnames, forcedeletebundles=False, listfiles=False,
|
||||
return -3
|
||||
|
||||
pkgkeyslist = getpkgkeys(pkgnames)
|
||||
if len(pkgkeyslist) == 0:
|
||||
if not pkgkeyslist:
|
||||
return -4
|
||||
|
||||
if processes.stop_requested():
|
||||
|
||||
@@ -20,9 +20,9 @@ from __future__ import absolute_import
|
||||
from ctypes import *
|
||||
# pylint: enable=unused-wildcard-import
|
||||
# pylint: enable=wildcard-import
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
libc = CDLL("/usr/lib/libc.dylib")
|
||||
# pylint: enable=invalid-name
|
||||
|
||||
|
||||
c_launch_data_t = c_void_p
|
||||
@@ -84,7 +84,7 @@ launch_data_new_string.argtypes = [c_char_p]
|
||||
launch_msg = libc.launch_msg
|
||||
launch_msg.restype = c_launch_data_t
|
||||
launch_msg.argtypes = [c_launch_data_t]
|
||||
|
||||
# pylint: enable=invalid-name
|
||||
|
||||
LAUNCH_KEY_SUBMITJOB = c_char_p("SubmitJob")
|
||||
LAUNCH_KEY_REMOVEJOB = c_char_p("RemoveJob")
|
||||
@@ -218,7 +218,7 @@ def get_launchd_socket_fds():
|
||||
# Return a dictionary with keys pointing to lists of file descriptors.
|
||||
launchd_socket_fds = dict()
|
||||
|
||||
def add_socket(launch_array, name, context=None):
|
||||
def add_socket(launch_array, name, _context=None):
|
||||
'''Callback for dict iterator.'''
|
||||
if launch_data_get_type(launch_array) != LAUNCH_DATA_ARRAY:
|
||||
raise LaunchDCheckInError(
|
||||
@@ -246,7 +246,7 @@ def get_launchd_socket_fds():
|
||||
|
||||
if launch_data_get_type(checkin_response) == LAUNCH_DATA_ERRNO:
|
||||
errno = launch_data_get_errno(checkin_response)
|
||||
raise LaunchDCheckInError("Checkin failed")
|
||||
raise LaunchDCheckInError("Checkin failed. Error: %s" % errno)
|
||||
|
||||
# Get a dictionary of sockets.
|
||||
sockets = launch_data_dict_lookup(
|
||||
|
||||
Reference in New Issue
Block a user