Skip to content

Commit 138896b

Browse files
simplify apimodule repr
1 parent 2f0e135 commit 138896b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/apipkg/__init__.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,13 @@ def __init__(
161161
self.__map__[name] = (modpath, attrname)
162162

163163
def __repr__(self):
164-
repr_list = []
164+
repr_list = [f"<ApiModule {self.__name__!r}"]
165165
if hasattr(self, "__version__"):
166-
repr_list.append("version=" + repr(self.__version__))
166+
repr_list.append(f" version={self.__version__!r}")
167167
if hasattr(self, "__file__"):
168-
repr_list.append("from " + repr(self.__file__))
169-
if repr_list:
170-
return "<ApiModule {!r} {}>".format(self.__name__, " ".join(repr_list))
171-
return f"<ApiModule {self.__name__!r}>"
168+
repr_list.append(f" from {self.__file__!r}")
169+
repr_list.append(">")
170+
return "".join(repr_list)
172171

173172
@_synchronized
174173
def __makeattr(self, name, isgetattr=False):

0 commit comments

Comments
 (0)