Skip to content

Commit 52a61f4

Browse files
inline precomputed repr
1 parent 3ef2ce7 commit 52a61f4

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/apipkg/__init__.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,6 @@ def _py_test_hack(modpath, attrname, importerror_alternative):
191191
return importerror_alternative
192192

193193

194-
def _alias_mod_repr(modname, modpath, attrname):
195-
x = modpath
196-
if attrname:
197-
x += "." + attrname
198-
return "<AliasModule {!r} for {!r}>".format(modname, x)
199-
200-
201194
def AliasModule(modname, modpath, attrname=None):
202195
mod = []
203196

@@ -209,7 +202,8 @@ def getmod():
209202
mod.append(x)
210203
return mod[0]
211204

212-
repr_result = _alias_mod_repr(modname, modpath, attrname)
205+
x = modpath + ("." + attrname) if attrname else ""
206+
repr_result = "<AliasModule {!r} for {!r}>".format(modname, x)
213207

214208
class AliasModule(ModuleType):
215209
def __repr__(self):

0 commit comments

Comments
 (0)