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