Mercurial > hg-stable
comparison contrib/import-checker.py @ 44440:4cabeea6d214
hgext: start building a library for simple hooks
Many workflows depend on hooks to enforce certain policies, e.g. to
prevent forced pushes. The Mercurial Guide includes some cases and
Google can help finding others, but it can save users a lot of time
if hg itself has a couple of examples for further customization.
Differential Revision: https://phab.mercurial-scm.org/D6825
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Sat, 07 Sep 2019 14:50:39 +0200 |
parents | 303576116ac1 |
children | c102b704edb5 |
comparison
equal
deleted
inserted
replaced
44439:edc8504bc26b | 44440:4cabeea6d214 |
---|---|
390 if not found: | 390 if not found: |
391 # this should be a function or a property of "node.module" | 391 # this should be a function or a property of "node.module" |
392 modnotfound = True | 392 modnotfound = True |
393 continue | 393 continue |
394 yield found[1] | 394 yield found[1] |
395 if modnotfound: | 395 if modnotfound and dottedpath != modulename: |
396 # "dottedpath" is a package, but imported because of non-module | 396 # "dottedpath" is a package, but imported because of non-module |
397 # lookup | 397 # lookup |
398 # specifically allow "from . import foo" from __init__.py | |
398 yield dottedpath | 399 yield dottedpath |
399 | 400 |
400 | 401 |
401 def verify_import_convention(module, source, localmods): | 402 def verify_import_convention(module, source, localmods): |
402 """Verify imports match our established coding convention. | 403 """Verify imports match our established coding convention. |