Module Import alias Import alias Import alias Import alias FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Str Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam NameParam defaults body Return BinOpMod Str Dict Str Str NameLoad Call AttributeLoad Str attr BinOpSub NameLoad Call NameLoad ListLoad NameLoad decorator_list Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad Str attr GeneratorExp BinOpMod Str Call NameLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam NameParam NameParam defaults body If CompareIn Str NameLoad body Return If Call AttributeLoad NameLoad attr NameLoad body Return Assign NameStore Str If Call AttributeLoad NameLoad attr NameLoad body Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Str Assign NameStore ListLoad Str For NameStore NameLoad body If CompareIn NameLoad NameLoad body Return If CompareIn Str NameLoad body Assign NameStore ListLoad Str Str Str Str For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr BinOpMod Str NameLoad If CompareNotEq NameLoad Num body Expr Yield TupleLoad NameLoad BinOpMod NameLoad Dict Str SubscriptLoad NameLoad Slice Num decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str For NameStore NameLoad body If Call AttributeLoad NameLoad attr BinOpMod Str NameLoad body Expr Yield TupleLoad Num Str decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If CompareIn Str NameLoad body If CompareIn Str NameLoad body Return Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr Str Str Assign NameStore ListLoad Str Str If Call NameLoad GeneratorExp NameLoad comprehension NameStore NameLoad CompareIn NameLoad NameLoad body Assign NameStore Str Expr Yield TupleLoad Num NameLoad If CompareIn Str NameLoad body Assign NameStore Str Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Str If Call AttributeLoad NameLoad attr NameLoad body Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body If Call AttributeLoad NameLoad attr Str NameLoad body Expr Yield TupleLoad Num Str decorator_list NameLoad FunctionDef arguments args NameParam defaults body If Call AttributeLoad NameLoad attr Str NameLoad body Assign NameStore Str Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body If Call AttributeLoad NameLoad attr Str NameLoad body Assign NameStore Str Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If CompareIn Str NameLoad body If Call AttributeLoad NameLoad attr Str NameLoad body Assign NameStore Str Expr Yield TupleLoad Num NameLoad If Call AttributeLoad NameLoad attr Str NameLoad body Assign NameStore Str Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Assign NameStore Str If Call AttributeLoad NameLoad attr NameLoad body Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If CompareIn Str NameLoad body If Call AttributeLoad NameLoad attr Str NameLoad body Assign NameStore Str Expr Yield TupleLoad Num NameLoad If Call AttributeLoad NameLoad attr Str NameLoad body Assign NameStore Str Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If CompareIn Str NameLoad body Assign NameStore Str Assign NameStore Str Assign NameStore BinOpMod Str NameLoad If Call AttributeLoad NameLoad attr NameLoad NameLoad body Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If CompareIn Str NameLoad body If Call AttributeLoad NameLoad attr Str NameLoad body Assign NameStore Str Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Str If CompareIn Str NameLoad body If Call AttributeLoad NameLoad attr Str NameLoad body Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Str If Call AttributeLoad NameLoad attr NameLoad body Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If NameLoad body Return Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore SubscriptLoad Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad attr Str Index Num Assign NameStore BinOpMod Str NameLoad If BoolOpAnd CompareGt Call NameLoad NameLoad Num CompareIn SubscriptLoad NameLoad Index Num TupleLoad Str Str body If BoolOpOr CompareEq SubscriptLoad NameLoad Index Num NameLoad BoolOpAnd CompareNotEq NameLoad Str CompareIn SubscriptLoad NameLoad Index Num TupleLoad Str Str body Assign NameStore BinOpMod Str Dict Str Str SubscriptLoad NameLoad Index Num NameLoad Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str If NameLoad body Return Assign NameStore SubscriptLoad Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad attr Str Index Num If CompareIn BinOpMod Str NameLoad NameLoad body Return If CompareIn Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad TupleLoad Str Str body Return Assign NameStore ListComp SubscriptLoad NameLoad Index Num comprehension NameStore NameLoad Assign NameStore BinOpMod Str NameLoad If CompareIn Str NameLoad body Assign NameStore NameLoad For NameStore NameLoad body Assign NameStore ListComp Call AttributeLoad NameLoad attr Str comprehension NameStore Call AttributeLoad NameLoad attr If BoolOpAnd CompareGt Call NameLoad NameLoad Num CompareEq SubscriptLoad NameLoad Index Num Str CompareEq SubscriptLoad NameLoad Index Num NameLoad CompareIn Str NameLoad body Assign NameStore NameLoad Break If UnaryOpNot NameLoad body Assign NameStore BinOpMod Str NameLoad Expr Yield TupleLoad Num NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad decorator_list
N/A N/A os N/A re N/A pep8 N/A six flake8ext N/A N/A f N/A N/A N/A Decorator to indicate flake8 extension.

    This is borrowed from hacking.core.flake8ext(), but at now it is used
    only for unit tests to know which are neutron flake8 extensions.
     N/A N/A f name __name__ N/A f N/A N/A _all_log_levels N/A reserved error info warning critical exception _ _LE _LI _LW _LC _LE N/A _all_hints N/A set N/A N/A _all_log_levels values N/A mutable_default_args N/A N/A re compile ^\s*def .+\((.+=\{\}|.+=\[\]) _regex_for_level N/A N/A level hint N/A N/A N/A N/A .*LOG\.%(level)s\(\s*((%(wrong_hints)s)\(|'|\") N/A level wrong_hints level N/A N/A | join N/A _all_hints N/A set N/A hint N/A N/A log_translation_hint N/A N/A re compile N/A N/A | join N/A N/A (?:%s) N/A _regex_for_level level hint N/A N/A level hint N/A N/A six iteritems _all_log_levels N/A log_warn N/A N/A re compile (.)*LOG\.(warn)\(\s*('|\"|_) N/A contextlib_nested N/A N/A re compile ^with (contextlib\.)?nested\( validate_log_translations N/A N/A logical_line physical_line filename N/A N/A N/A N/A neutron/tests filename N/A N/A N/A N/A N/A pep8 noqa physical_line N/A N/A N/A msg N320: Log messages require translation hints! N/A N/A N/A log_translation_hint match logical_line N/A N/A N/A N/A 0 msg N/A flake8ext use_jsonutils N/A N/A logical_line filename N/A N/A N/A msg N321: jsonutils.%(fun)s must be used instead of json.%(fun)s N/A json_check_skipped_patterns N/A neutron/plugins/ml2/drivers/openvswitch/agent/xenapi/etc/xapi.d/plugins/netwrap N/A pattern json_check_skipped_patterns N/A N/A N/A pattern filename N/A N/A N/A N/A json. logical_line N/A N/A json_funcs N/A dumps( dump( loads( load( N/A f json_funcs N/A N/A pos N/A N/A logical_line find N/A json.%s f N/A N/A pos -1 N/A N/A N/A N/A pos N/A msg N/A fun N/A f N/A -1 N/A flake8ext no_translate_debug_logs N/A N/A logical_line filename N/A N/A N/A Check for 'LOG.debug(_(' and 'LOG.debug(_Lx('

    As per our translation policy,
    https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation
    we shouldn't translate debug level logs.

    * This check assumes that 'LOG' is a logger.
    N319
     N/A hint _all_hints N/A N/A N/A N/A logical_line startswith N/A LOG.debug(%s( hint N/A N/A N/A N/A 0 N319 Don't translate debug level logs N/A flake8ext check_assert_called_once_with N/A N/A logical_line filename N/A N/A N/A N/A neutron/tests/ filename N/A N/A N/A .assert_called_once_with( logical_line N/A N/A N/A uncased_line N/A N/A N/A N/A logical_line lower replace _ N/A check_calls N/A .assertcalledonce .calledoncewith N/A N/A any N/A x N/A x check_calls N/A x uncased_line N/A N/A msg N322: Possible use of no-op mock method. please use assert_called_once_with. N/A N/A N/A 0 msg N/A N/A .asserthascalled uncased_line N/A N/A msg N322: Possible use of no-op mock method. please use assert_has_calls. N/A N/A N/A 0 msg N/A flake8ext check_no_contextlib_nested N/A N/A logical_line filename N/A N/A N/A msg N324: contextlib.nested is deprecated. With Python 2.7 and later the with-statement supports multiple nested objects. See https://docs.python.org/2/library/contextlib.html#contextlib.nested for more information. N/A N/A N/A contextlib_nested match logical_line N/A N/A N/A N/A 0 msg N/A flake8ext check_python3_xrange N/A N/A logical_line N/A N/A N/A N/A N/A re search \bxrange\s*\( logical_line N/A N/A N/A N/A 0 N325: Do not use xrange. Use range, or six.moves.range for large loops. N/A flake8ext check_no_basestring N/A N/A logical_line N/A N/A N/A N/A N/A re search \bbasestring\b logical_line N/A N/A msg N326: basestring is not Python3-compatible, use six.string_types instead. N/A N/A N/A 0 msg N/A flake8ext check_python3_no_iteritems N/A N/A logical_line N/A N/A N/A N/A N/A re search .*\.iteritems\(\) logical_line N/A N/A msg N327: Use six.iteritems() instead of dict.iteritems(). N/A N/A N/A 0 msg N/A flake8ext check_asserttrue N/A N/A logical_line filename N/A N/A N/A N/A neutron/tests/ filename N/A N/A N/A N/A re search assertEqual\(\s*True,[^,]*(,[^,]*)?\) logical_line N/A N/A msg N328: Use assertTrue(observed) instead of assertEqual(True, observed) N/A N/A N/A 0 msg N/A N/A N/A re search assertEqual\([^,]*,\s*True(,[^,]*)?\) logical_line N/A N/A msg N328: Use assertTrue(observed) instead of assertEqual(True, observed) N/A N/A N/A 0 msg N/A flake8ext no_mutable_default_args N/A N/A logical_line N/A N/A N/A msg N329: Method's default argument shouldn't be mutable! N/A N/A N/A mutable_default_args match logical_line N/A N/A N/A N/A 0 msg N/A flake8ext check_assertfalse N/A N/A logical_line filename N/A N/A N/A N/A neutron/tests/ filename N/A N/A N/A N/A re search assertEqual\(\s*False,[^,]*(,[^,]*)?\) logical_line N/A N/A msg N328: Use assertFalse(observed) instead of assertEqual(False, observed) N/A N/A N/A 0 msg N/A N/A N/A re search assertEqual\([^,]*,\s*False(,[^,]*)?\) logical_line N/A N/A msg N328: Use assertFalse(observed) instead of assertEqual(False, observed) N/A N/A N/A 0 msg N/A flake8ext check_assertempty N/A N/A logical_line filename N/A N/A N/A N/A neutron/tests/ filename N/A N/A msg N330: Use assertEqual(*empty*, observed) instead of assertEqual(observed, *empty*). *empty* contains {}, [], (), set(), '', "" N/A empties (\[\s*\]|\{\s*\}|\(\s*\)|set\(\s*\)|'\s*'|\"\s*\") N/A reg N/A assertEqual\(([^,]*,\s*)+?%s\)\s*$ empties N/A N/A N/A re search reg logical_line N/A N/A N/A N/A 0 msg N/A flake8ext check_assertisinstance N/A N/A logical_line filename N/A N/A N/A N/A neutron/tests/ filename N/A N/A N/A N/A re search assertTrue\(\s*isinstance\(\s*[^,]*,\s*[^,]*\)\) logical_line N/A N/A msg N331: Use assertIsInstance(observed, type) instead of assertTrue(isinstance(observed, type)) N/A N/A N/A 0 msg N/A flake8ext check_assertequal_for_httpcode N/A N/A logical_line filename N/A N/A N/A msg N332: Use assertEqual(expected_http_code, observed_http_code) instead of assertEqual(observed_http_code, expected_http_code) N/A N/A neutron/tests/ filename N/A N/A N/A N/A re search assertEqual\(\s*[^,]*,[^,]*HTTP[^\.]*\.code\s*\) logical_line N/A N/A N/A N/A 0 msg N/A flake8ext check_log_warn_deprecated N/A N/A logical_line filename N/A N/A N/A msg N333: Use LOG.warning due to compatibility with py3 N/A N/A N/A log_warn match logical_line N/A N/A N/A N/A 0 msg N/A flake8ext check_oslo_i18n_wrapper N/A N/A logical_line filename noqa N/A N/A N/A Check for neutron.i18n usage.

    Okay(neutron/foo/bar.py): from neutron._i18n import _
    Okay(neutron_lbaas/foo/bar.py): from neutron_lbaas._i18n import _
    N340(neutron/foo/bar.py): from neutron.i18n import _
    N340(neutron_lbaas/foo/bar.py): from neutron_lbaas.i18n import _
    N340(neutron_lbaas/foo/bar.py): from neutron.i18n import _
    N340(neutron_lbaas/foo/bar.py): from neutron._i18n import _
    Okay(neutron/foo/bar.py): from neutron.i18n import _  # noqa
     N/A noqa N/A N/A N/A split_line N/A N/A logical_line split N/A modulename N/A N/A N/A N/A N/A N/A os path normpath filename split / N/A 0 N/A bad_i18n_module N/A %s.i18n modulename N/A N/A N/A N/A len split_line 1 N/A N/A split_line N/A 0 N/A import from N/A N/A N/A N/A N/A split_line N/A 1 bad_i18n_module N/A N/A modulename neutron N/A N/A split_line N/A 1 N/A neutron.i18n neutron._i18n N/A N/A msg N/A N340: %(found)s is found. Use %(module)s._i18n instead. N/A found module N/A split_line N/A 1 modulename N/A N/A N/A 0 msg N/A flake8ext check_builtins_gettext N/A N/A logical_line tokens filename lines noqa N/A N/A N/A Check usage of builtins gettext _().

    Okay(neutron/foo.py): from neutron._i18n import _
_('foo')
    N341(neutron/foo.py): _('foo')
    Okay(neutron/_i18n.py): _('foo')
    Okay(neutron/i18n.py): _('foo')
    Okay(neutron/foo.py): _('foo')  # noqa
     N/A noqa N/A N/A N/A modulename N/A N/A N/A N/A N/A N/A os path normpath filename split / N/A 0 N/A N/A N/A %s/tests modulename filename N/A N/A N/A N/A N/A N/A N/A os path basename filename N/A i18n.py _i18n.py N/A N/A N/A token_values N/A N/A t N/A 1 N/A t tokens N/A i18n_wrapper N/A %s._i18n modulename N/A N/A _ token_values N/A N/A i18n_import_line_found False N/A line lines N/A N/A split_line N/A N/A N/A elm rstrip , N/A elm N/A N/A line split N/A N/A N/A N/A len split_line 1 N/A N/A split_line N/A 0 from N/A N/A split_line N/A 1 i18n_wrapper N/A _ split_line N/A N/A i18n_import_line_found True N/A N/A N/A i18n_import_line_found N/A N/A msg N/A N341: _ from python builtins module is used. Use _ from %s instead. i18n_wrapper N/A N/A N/A 0 msg N/A flake8ext factory N/A N/A register N/A N/A N/A N/A register validate_log_translations N/A N/A register use_jsonutils N/A N/A register check_assert_called_once_with N/A N/A register no_translate_debug_logs N/A N/A register check_no_contextlib_nested N/A N/A register check_python3_xrange N/A N/A register check_no_basestring N/A N/A register check_python3_no_iteritems N/A N/A register check_asserttrue N/A N/A register no_mutable_default_args N/A N/A register check_assertfalse N/A N/A register check_assertempty N/A N/A register check_assertisinstance N/A N/A register check_assertequal_for_httpcode N/A N/A register check_log_warn_deprecated N/A N/A register check_oslo_i18n_wrapper N/A N/A register check_builtins_gettext N/A