modify hacking.py to not choke on the def of _()

recent openstack-common brought in it's own def of _() which trips
up our checking that all _ calls contain a message string.

This explicitly excludes the definition of this in function from
that check.

Fixes LP Bug #1020792.

Change-Id: If647d77a5ae5560935bb2e032331c34b896b8614
This commit is contained in:
Sean Dague 2012-07-05 16:36:34 -04:00
parent 6c1d7989d9
commit 7b43eaa9d8

View File

@ -283,10 +283,12 @@ def check_i18n():
"""
while True:
try:
token_type, text, _, _, _ = yield
token_type, text, _, _, line = yield
except GeneratorExit:
return
if token_type == tokenize.NAME and text == "_":
if (token_type == tokenize.NAME and text == "_" and
not line.startswith('def _(msg):')):
while True:
token_type, text, start, _, _ = yield
if token_type != tokenize.NL: