neutron_lib.hacking package

neutron_lib.hacking package

Submodules

neutron_lib.hacking.checks module

neutron_lib.hacking.checks.assert_equal_none(logical_line)

N536 - Use assertIsNone.

neutron_lib.hacking.checks.check_neutron_namespace_imports(logical_line)

N530 - Direct neutron imports not allowed.

Parameters:logical_line – The logical line to check.
Returns:None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.
neutron_lib.hacking.checks.check_no_basestring(logical_line)

N526 - basestring is not Python3-compatible.

Parameters:logical_line – The logical line to check.
Returns:None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.
neutron_lib.hacking.checks.check_no_contextlib_nested(logical_line, filename)

N524 - Use of contextlib.nested is deprecated.

Parameters:
  • logical_line – The logical line to check.
  • filename – The file name where the logical line exists.
Returns:

None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.

neutron_lib.hacking.checks.check_no_eventlet_imports(logical_line)

N535 - Usage of Python eventlet module not allowed.

Parameters:logical_line – The logical line to check.
Returns:None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.
neutron_lib.hacking.checks.check_python3_no_iteritems(logical_line)

N527 - Use dict.items() instead of dict.iteritems().

Parameters:logical_line – The logical line to check.
Returns:None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.
neutron_lib.hacking.checks.check_python3_xrange(logical_line)

N525 - Do not use xrange.

Parameters:logical_line – The logical line to check.
Returns:None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.
neutron_lib.hacking.checks.factory(register)

Hacking check factory for neutron-lib adopter compliant checks.

Hacking check factory for use with tox.ini. This factory registers all neutron-lib adopter checks consumers should seek to comply with.

Parameters:register – The function to register the check functions with.
Returns:None.
neutron_lib.hacking.checks.no_mutable_default_args(logical_line)

N529 - Method’s default argument shouldn’t be mutable.

Parameters:logical_line – The logical line to check.
Returns:None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.
neutron_lib.hacking.checks.use_jsonutils(logical_line, filename)

N521 - jsonutils must be used instead of json.

Parameters:
  • logical_line – The logical line to check.
  • filename – The file name where the logical line exists.
Returns:

None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.

neutron_lib.hacking.translation_checks module

neutron_lib.hacking.translation_checks.check_log_warn_deprecated(logical_line, filename)

N532 - Use LOG.warning due to compatibility with py3.

Parameters:
  • logical_line – The logical line to check.
  • filename – The file name where the logical line exists.
Returns:

None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.

neutron_lib.hacking.translation_checks.check_raised_localized_exceptions(logical_line, filename)

N534 - Untranslated exception message.

Parameters:
  • logical_line – The logical line to check.
  • filename – The file name where the logical line exists.
Returns:

None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.

neutron_lib.hacking.translation_checks.no_translate_logs(logical_line, filename)

N537 - Don’t translate logs.

Check for ‘LOG.*(_(‘ and ‘LOG.*(_Lx(‘

Translators don’t provide translations for log messages, and operators asked not to translate them.

  • This check assumes that ‘LOG’ is a logger.
Parameters:
  • logical_line – The logical line to check.
  • filename – The file name where the logical line exists.
Returns:

None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure.

Module contents

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.