summaryrefslogtreecommitdiff
path: root/linuxnamespaces
diff options
context:
space:
mode:
Diffstat (limited to 'linuxnamespaces')
-rw-r--r--linuxnamespaces/atlocation.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/linuxnamespaces/atlocation.py b/linuxnamespaces/atlocation.py
index 45d2d59..6f0b8d9 100644
--- a/linuxnamespaces/atlocation.py
+++ b/linuxnamespaces/atlocation.py
@@ -352,5 +352,20 @@ class AtLocation:
)
return os.fspath(self.location)
+ def __repr__(self) -> str:
+ """Return a textual representation of the AtLocation object."""
+ cn = self.__class__.__name__
+ if self.fd < 0:
+ if self.flags == AtFlags.NONE:
+ return f"{cn}({self.location!r})"
+ return f"{cn}({self.location!r}, flags={self.flags!r})"
+ if self.location:
+ if self.flags == AtFlags.NONE:
+ return f"{cn}({self.fd}, {self.location!r})"
+ return f"{cn}({self.fd}, {self.location!r}, {self.flags!r})"
+ if self.flags & ~AtFlags.AT_EMPTY_PATH == AtFlags.NONE:
+ return f"{cn}({self.fd})"
+ return f"{cn}({self.fd}, flags={self.flags!r})"
+
AtLocationLike = typing.Union[AtLocation, int, PathConvertible]