"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cloudkitty/hacking/checks.py" between
cloudkitty-16.0.0.tar.gz and cloudkitty-17.0.0.tar.gz

About: OpenStack CloudKitty provides Rating-as-a-Service for OpenStack.
The "Zed" series (latest release).

checks.py  (cloudkitty-16.0.0):checks.py  (cloudkitty-17.0.0)
skipping to change at line 54 skipping to change at line 54
underscore_import_check = re.compile(r"(.)*import _$") underscore_import_check = re.compile(r"(.)*import _$")
underscore_import_check_multi = re.compile(r"(.)*import (.)*_, (.)*") underscore_import_check_multi = re.compile(r"(.)*import (.)*_, (.)*")
# We need this for cases where they have created their own _ function. # We need this for cases where they have created their own _ function.
custom_underscore_check = re.compile(r"(.)*_\s*=\s*(.)*") custom_underscore_check = re.compile(r"(.)*_\s*=\s*(.)*")
oslo_namespace_imports = re.compile(r"from[\s]*oslo[.](.*)") oslo_namespace_imports = re.compile(r"from[\s]*oslo[.](.*)")
dict_constructor_with_list_copy_re = re.compile(r".*\bdict\((\[)?(\(|\[)") dict_constructor_with_list_copy_re = re.compile(r".*\bdict\((\[)?(\(|\[)")
assert_no_xrange_re = re.compile(r"\s*xrange\s*\(") assert_no_xrange_re = re.compile(r"\s*xrange\s*\(")
assert_True = re.compile(r".*assertEqual\(True, .*\)") assert_True = re.compile(r".*assertEqual\(True, .*\)")
assert_None = re.compile(r".*assertEqual\(None, .*\)") assert_None = re.compile(r".*assertEqual\(None, .*\)")
no_log_warn = re.compile(r".*LOG.warn\(.*\)") no_log_warn = re.compile(r".*LOG.warn\(.*\)")
asse_raises_regexp = re.compile(r"assertRaisesRegexp\(")
class BaseASTChecker(ast.NodeVisitor): class BaseASTChecker(ast.NodeVisitor):
"""Provides a simple framework for writing AST-based checks. """Provides a simple framework for writing AST-based checks.
Subclasses should implement visit_* methods like any other AST visitor Subclasses should implement visit_* methods like any other AST visitor
implementation. When they detect an error for a particular node the implementation. When they detect an error for a particular node the
method should call ``self.add_error(offending_node)``. Details about method should call ``self.add_error(offending_node)``. Details about
where in the code the error occurred will be pulled from the node where in the code the error occurred will be pulled from the node
object. object.
skipping to change at line 342 skipping to change at line 343
@core.flake8ext @core.flake8ext
def no_log_warn_check(logical_line): def no_log_warn_check(logical_line):
"""Disallow 'LOG.warn' """Disallow 'LOG.warn'
C320 C320
""" """
msg = ("C320: LOG.warn is deprecated, please use LOG.warning!") msg = ("C320: LOG.warn is deprecated, please use LOG.warning!")
if re.match(no_log_warn, logical_line): if re.match(no_log_warn, logical_line):
yield(0, msg) yield(0, msg)
@core.flake8ext
def assert_raises_regexp(logical_line):
"""Check for usage of deprecated assertRaisesRegexp
C322
"""
res = asse_raises_regexp.search(logical_line)
if res:
yield (0, "C322: assertRaisesRegex must be used instead "
"of assertRaisesRegexp")
 End of changes. 2 change blocks. 
0 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)