diff --git a/src/rpcclient/rpcclient/darwin/ioregistry.py b/src/rpcclient/rpcclient/darwin/ioregistry.py index 8a7e1dd0..380aebf6 100644 --- a/src/rpcclient/rpcclient/darwin/ioregistry.py +++ b/src/rpcclient/rpcclient/darwin/ioregistry.py @@ -53,7 +53,7 @@ def _deallocate(self): self._client.symbols.IOObjectRelease(self._service) def __repr__(self): - return f'' + return f'<{self.__class__.__name__} NAME:{self.name}>' class BacklightControlService(IOService): diff --git a/src/rpcclient/rpcclient/darwin/scpreferences.py b/src/rpcclient/rpcclient/darwin/scpreferences.py index 3e1bb1eb..0096b6ab 100644 --- a/src/rpcclient/rpcclient/darwin/scpreferences.py +++ b/src/rpcclient/rpcclient/darwin/scpreferences.py @@ -5,10 +5,11 @@ class SCPreference(Allocated): - def __init__(self, client, ref): + def __init__(self, client, preferences_id: str, ref): super().__init__() self._client = client self._ref = ref + self._preferences_id = preferences_id @property def keys(self) -> typing.List[str]: @@ -82,6 +83,9 @@ def _commit(self): raise RpcClientException('SCPreferencesCommitChanges failed') self._client.symbols.SCPreferencesSynchronize(self._ref) + def __repr__(self): + return f'<{self.__class__.__name__} NAME:{self._preferences_id}>' + class SCPreferences: """ @@ -100,7 +104,7 @@ def open(self, preferences_id: str) -> SCPreference: ref = self._client.symbols.SCPreferencesCreate(0, self._client.cf('rpcserver'), self._client.cf(preferences_id)) if not ref: raise RpcClientException(f'SCPreferencesCreate failed for: {preferences_id}') - return SCPreference(self._client, ref) + return SCPreference(self._client, preferences_id, ref) def get_keys(self, preferences_id: str) -> typing.List[str]: """ get all keys from given preferences_id """ diff --git a/src/rpcclient/rpcclient/fs.py b/src/rpcclient/rpcclient/fs.py index 8d926bad..f3d51b54 100644 --- a/src/rpcclient/rpcclient/fs.py +++ b/src/rpcclient/rpcclient/fs.py @@ -87,6 +87,9 @@ def __init__(self, path, dirp, client): def __iter__(self) -> Iterator[DirEntry]: raise NotImplementedError() + def __repr__(self): + return f'<{self.__class__.__name__} PATH:{self.path} DIRP:{self._dirp}>' + class File(Allocated): CHUNK_SIZE = 1024 @@ -151,6 +154,9 @@ def readall(self, chunk_size: int = CHUNK_SIZE) -> bytes: buf += chunk.peek(err) return buf + def __repr__(self): + return f'<{self.__class__.__name__} FD:{self.fd}>' + class Fs: """ filesystem utils """ diff --git a/src/rpcclient/rpcclient/network.py b/src/rpcclient/rpcclient/network.py index 4dd8aa9f..0eac9ddc 100644 --- a/src/rpcclient/rpcclient/network.py +++ b/src/rpcclient/rpcclient/network.py @@ -61,6 +61,9 @@ def recvall(self, size: int) -> bytes: buf += chunk.peek(err) return buf + def __repr__(self): + return f'<{self.__class__.__name__} FD:{self.fd}>' + class Network: def __init__(self, client):