Some assignment statements are redundant
Don't need to initialize with false, only determine true conditional directly. Closes-Bug: 1379149 Change-Id: I8685896b8dd9f7008b8b2311a2ad2a56c95a8bc6
This commit is contained in:
@@ -845,16 +845,9 @@ def validate_device_partition(device, partition):
|
||||
:param partition: partition to validate
|
||||
:raises: ValueError if given an invalid device or partition
|
||||
"""
|
||||
invalid_device = False
|
||||
invalid_partition = False
|
||||
if not device or '/' in device or device in ['.', '..']:
|
||||
invalid_device = True
|
||||
if not partition or '/' in partition or partition in ['.', '..']:
|
||||
invalid_partition = True
|
||||
|
||||
if invalid_device:
|
||||
raise ValueError('Invalid device: %s' % quote(device or ''))
|
||||
elif invalid_partition:
|
||||
if not partition or '/' in partition or partition in ['.', '..']:
|
||||
raise ValueError('Invalid partition: %s' % quote(partition or ''))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user