mercurial/pycompat.py
changeset 31566 c6df6a23dfe5
parent 31501 a1e40ceee640
child 31568 6c9772867344
equal deleted inserted replaced
31565:553ad16b274f 31566:c6df6a23dfe5
   265         """Add items that will be populated at the first access"""
   265         """Add items that will be populated at the first access"""
   266         items = map(sysstr, items)
   266         items = map(sysstr, items)
   267         self._aliases.update(
   267         self._aliases.update(
   268             (item.replace(sysstr('_'), sysstr('')).lower(), (origin, item))
   268             (item.replace(sysstr('_'), sysstr('')).lower(), (origin, item))
   269             for item in items)
   269             for item in items)
       
   270 
       
   271     def _registeralias(self, origin, attr, name):
       
   272         """Alias ``origin``.``attr`` as ``name``"""
       
   273         self._aliases[sysstr(name)] = (origin, sysstr(attr))
   270 
   274 
   271     def __getattr__(self, name):
   275     def __getattr__(self, name):
   272         try:
   276         try:
   273             origin, item = self._aliases[name]
   277             origin, item = self._aliases[name]
   274         except KeyError:
   278         except KeyError:
   335     urlreq._registeraliases(urllib.parse, (
   339     urlreq._registeraliases(urllib.parse, (
   336         "splitattr",
   340         "splitattr",
   337         "splitpasswd",
   341         "splitpasswd",
   338         "splitport",
   342         "splitport",
   339         "splituser",
   343         "splituser",
   340         "unquote",
   344     ))
   341     ))
   345     urlreq._registeralias(urllib.parse, "unquote_to_bytes", "unquote")
   342     import urllib.request
   346     import urllib.request
   343     urlreq._registeraliases(urllib.request, (
   347     urlreq._registeraliases(urllib.request, (
   344         "AbstractHTTPHandler",
   348         "AbstractHTTPHandler",
   345         "BaseHandler",
   349         "BaseHandler",
   346         "build_opener",
   350         "build_opener",