"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/tests/hacking/checks.py" between
keystone-16.0.1.tar.gz and keystone-17.0.0.tar.gz

About: OpenStack Keystone (Core Service: Identity) provides an authentication and authorization service for other OpenStack services. Provides a catalog of endpoints for all OpenStack services.
The "Ussuri" series (latest release).

checks.py  (keystone-16.0.1):checks.py  (keystone-17.0.0)
skipping to change at line 29 skipping to change at line 29
There are two types of pep8 extensions. One is a function that takes either There are two types of pep8 extensions. One is a function that takes either
a physical or logical line. The physical or logical line is the first param a physical or logical line. The physical or logical line is the first param
in the function definition and can be followed by other parameters supported in the function definition and can be followed by other parameters supported
by pycodestyle. The second type is a class that parses AST trees. For more info by pycodestyle. The second type is a class that parses AST trees. For more info
please see pycodestyle.py. please see pycodestyle.py.
""" """
import ast import ast
import re import re
import six
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.
Subclasses should also provide a class variable named CHECK_DESC to Subclasses should also provide a class variable named CHECK_DESC to
skipping to change at line 182 skipping to change at line 180
"""Return the fully qualified name or a Name or Attribute.""" """Return the fully qualified name or a Name or Attribute."""
if isinstance(node, ast.Name): if isinstance(node, ast.Name):
return node.id return node.id
elif (isinstance(node, ast.Attribute) elif (isinstance(node, ast.Attribute)
and isinstance(node.value, (ast.Name, ast.Attribute))): and isinstance(node.value, (ast.Name, ast.Attribute))):
method_name = node.attr method_name = node.attr
obj_name = self._find_name(node.value) obj_name = self._find_name(node.value)
if obj_name is None: if obj_name is None:
return None return None
return obj_name + '.' + method_name return obj_name + '.' + method_name
elif isinstance(node, six.string_types): elif isinstance(node, str):
return node return node
else: # could be Subscript, Call or many more else: # could be Subscript, Call or many more
return None return None
def visit_Assign(self, node): def visit_Assign(self, node):
"""Look for 'LOG = logging.getLogger'. """Look for 'LOG = logging.getLogger'.
This handles the simple case: This handles the simple case:
name = [logging_module].getLogger(...) name = [logging_module].getLogger(...)
 End of changes. 2 change blocks. 
3 lines changed or deleted 1 lines changed or added

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