flatten and simplify some code
This commit is contained in:
parent
5f2b1a432e
commit
5a82f04f9e
@ -96,7 +96,7 @@ def ctypes_equal(
|
||||
if isinstance(a, (ctypes.Array, ctypes.Structure, ctypes.Union, ctypes._SimpleCData)):
|
||||
if not ctypes_equal(a_attr, b_attr):
|
||||
return False
|
||||
elif not a_attr == b_attr:
|
||||
elif a_attr != b_attr:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
@ -192,10 +192,9 @@ class Process(AbstractProcess):
|
||||
max_path_len,
|
||||
)
|
||||
|
||||
if rval > 0:
|
||||
return name_buffer.value.decode()
|
||||
else:
|
||||
if rval <= 0:
|
||||
return None
|
||||
return name_buffer.value.decode()
|
||||
|
||||
@staticmethod
|
||||
def list_available_pids() -> list[int]:
|
||||
@ -218,11 +217,9 @@ class Process(AbstractProcess):
|
||||
|
||||
num_returned = floor(returned_size.value / ctypes.sizeof(ctypes.wintypes.DWORD))
|
||||
|
||||
if nn == num_returned:
|
||||
nn *= 2
|
||||
continue
|
||||
else:
|
||||
if nn != num_returned:
|
||||
break
|
||||
nn *= 2
|
||||
|
||||
return pids[:num_returned]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user