Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Code contributions:
- Michał Górny (mgorny)
- Serge Lu (Serge45)
- Eric Prestat (ericpre)
- Gabriel Mitelman Tkacz (gtkacz)



Expand Down
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

Version 7.1.2
-------------

* Fixing #261 altering all `__repr__` methods so that subclassing will output the correct class name

Version 7.1.1
-------------

Expand Down
2 changes: 1 addition & 1 deletion box/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ def popitem(self):
return key, self.pop(key)

def __repr__(self) -> str:
return f"Box({self})"
return f"{self.__class__.__name__}({self})"

def __str__(self) -> str:
return str(self.to_dict())
Expand Down
2 changes: 1 addition & 1 deletion box/box_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def _dotted_helper(self) -> List[str]:
return keys

def __repr__(self):
return f"BoxList({self.to_list()})"
return f"{self.__class__.__name__}({self.to_list()})"

def __str__(self):
return str(self.to_list())
Expand Down
2 changes: 1 addition & 1 deletion box/config_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def getfloat(self, item, default=None):
return self.float(item, default)

def __repr__(self):
return "ConfigBox({0})".format(str(self.to_dict()))
return f"{self.__class__.__name__}({str(self.to_dict())})"

def copy(self):
return ConfigBox(super().copy())
Expand Down
4 changes: 2 additions & 2 deletions box/shorthand_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def toml(self) -> str:
return self.to_toml()

def __repr__(self):
return f"SBox({self})"
return f"{self.__class__.__name__}({self})"

def copy(self) -> "SBox":
return SBox(super(SBox, self).copy())
Expand All @@ -66,4 +66,4 @@ def __new__(cls, *args, **kwargs):
return obj

def __repr__(self) -> str:
return f"DDBox({self})"
return f"{self.__class__.__name__}({self})"