[PATCH 2 of 2] demandimport: omit default value of "level" at construction of _demandmod

Yuya Nishihara yuya at tcha.org
Sun Aug 7 08:01:06 EDT 2016


On Sat, 06 Aug 2016 22:28:15 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1470489873 -32400
> #      Sat Aug 06 22:24:33 2016 +0900
> # Node ID 6c99f07655feaf18d09e1d5846c54fc8c8223ddc
> # Parent  1881f4a509a31d88a5db583c6db8d186040eba94
> demandimport: omit default value of "level" at construction of _demandmod

The series already ninja queued.

> --- a/mercurial/demandimport.py
> +++ b/mercurial/demandimport.py
> @@ -64,8 +64,12 @@ def _hgextimport(importfunc, name, globa
>          return importfunc(hgextname, globals, *args, **kwargs)
>  
>  class _demandmod(object):
> -    """module demand-loader and proxy"""
> -    def __init__(self, name, globals, locals, level=level):
> +    """module demand-loader and proxy
> +
> +    Specify 1 as 'level' argument at construction, to import module
> +    relatively.
> +    """
> +    def __init__(self, name, globals, locals, level):
>          if '.' in name:
>              head, rest = name.split('.', 1)
>              after = [rest]

> @@ -194,10 +198,9 @@ def _demandimport(name, globals=None, lo
>              if symbol is nothing:
>                  mn = '%s.%s' % (mod.__name__, attr)
>                  if mn in ignore:
> -                    importfunc = _origimport
> +                    symbol = _origimport(attr, mod.__dict__, locals, level=1)
>                  else:
> -                    importfunc = _demandmod
> -                symbol = importfunc(attr, mod.__dict__, locals, level=1)
> +                    symbol = _demandmod(attr, mod.__dict__, locals, 1)

This change is okay, but unrelated?


More information about the Mercurial-devel mailing list