from __future__ import unicode_literals, print_function

import re

import astroid

from . import tools, test_mark_tokens


class TestAstroid(test_mark_tokens.TestMarkTokens):

  is_astroid_test = True
  module = astroid

  nodes_classes = astroid.ALL_NODE_CLASSES
  context_classes = [
    (astroid.Name, astroid.DelName, astroid.AssignName),
    (astroid.Attribute, astroid.DelAttr, astroid.AssignAttr),
  ]

  @staticmethod
  def iter_fields(node):
    """
    Yield a tuple of ``(fieldname, value)`` for each field
    that is present on *node*.

    Similar to ast.iter_fields, but for astroid and ignores context
    """
    for field in node._astroid_fields + node._other_fields:
      if field == 'ctx':
        continue
      yield field, getattr(node, field)

  @classmethod
  def create_mark_checker(cls, source):
    builder = astroid.builder.AstroidBuilder()
    tree = builder.string_build(source)
    return tools.MarkChecker(source, tree=tree)

from __future__ import unicode_literals, print_function

import astroid
from astroid.node_classes import NodeNG

from . import tools, test_mark_tokens


class TestAstroid(test_mark_tokens.TestMarkTokens):

  is_astroid_test = True
  module = astroid

  nodes_classes = NodeNG
  context_classes = [
    (astroid.Name, astroid.DelName, astroid.AssignName),
    (astroid.Attribute, astroid.DelAttr, astroid.AssignAttr),
  ]

  @staticmethod
  def iter_fields(node):
    """
    Yield a tuple of ``(fieldname, value)`` for each field
    that is present on *node*.

    Similar to ast.iter_fields, but for astroid and ignores context
    """
    for field in node._astroid_fields + node._other_fields:
      if field == 'ctx':
        continue
      yield field, getattr(node, field)

  @classmethod
  def create_mark_checker(cls, source):
    builder = astroid.builder.AstroidBuilder()
    tree = builder.string_build(source)
    return tools.MarkChecker(source, tree=tree)

Use NodeNG instead of astroid.ALL_NODE_CLASSES
Use NodeNG instead of astroid.ALL_NODE_CLASSES

  from __future__ import unicode_literals, print_function
  
- import re
- 
  import astroid
+ from astroid.node_classes import NodeNG
  
  from . import tools, test_mark_tokens
  
  
  class TestAstroid(test_mark_tokens.TestMarkTokens):
  
    is_astroid_test = True
    module = astroid
  
-   nodes_classes = astroid.ALL_NODE_CLASSES
+   nodes_classes = NodeNG
    context_classes = [
      (astroid.Name, astroid.DelName, astroid.AssignName),
      (astroid.Attribute, astroid.DelAttr, astroid.AssignAttr),
    ]
  
    @staticmethod
    def iter_fields(node):
      """
      Yield a tuple of ``(fieldname, value)`` for each field
      that is present on *node*.
  
      Similar to ast.iter_fields, but for astroid and ignores context
      """
      for field in node._astroid_fields + node._other_fields:
        if field == 'ctx':
          continue
        yield field, getattr(node, field)
  
    @classmethod
    def create_mark_checker(cls, source):
      builder = astroid.builder.AstroidBuilder()
      tree = builder.string_build(source)
      return tools.MarkChecker(source, tree=tree)
  
Use NodeNG instead of astroid.ALL_NODE_CLASSES
## Code Before:
from __future__ import unicode_literals, print_function

import re

import astroid

from . import tools, test_mark_tokens


class TestAstroid(test_mark_tokens.TestMarkTokens):

  is_astroid_test = True
  module = astroid

  nodes_classes = astroid.ALL_NODE_CLASSES
  context_classes = [
    (astroid.Name, astroid.DelName, astroid.AssignName),
    (astroid.Attribute, astroid.DelAttr, astroid.AssignAttr),
  ]

  @staticmethod
  def iter_fields(node):
    """
    Yield a tuple of ``(fieldname, value)`` for each field
    that is present on *node*.

    Similar to ast.iter_fields, but for astroid and ignores context
    """
    for field in node._astroid_fields + node._other_fields:
      if field == 'ctx':
        continue
      yield field, getattr(node, field)

  @classmethod
  def create_mark_checker(cls, source):
    builder = astroid.builder.AstroidBuilder()
    tree = builder.string_build(source)
    return tools.MarkChecker(source, tree=tree)

## Instruction:
Use NodeNG instead of astroid.ALL_NODE_CLASSES
## Code After:
from __future__ import unicode_literals, print_function

import astroid
from astroid.node_classes import NodeNG

from . import tools, test_mark_tokens


class TestAstroid(test_mark_tokens.TestMarkTokens):

  is_astroid_test = True
  module = astroid

  nodes_classes = NodeNG
  context_classes = [
    (astroid.Name, astroid.DelName, astroid.AssignName),
    (astroid.Attribute, astroid.DelAttr, astroid.AssignAttr),
  ]

  @staticmethod
  def iter_fields(node):
    """
    Yield a tuple of ``(fieldname, value)`` for each field
    that is present on *node*.

    Similar to ast.iter_fields, but for astroid and ignores context
    """
    for field in node._astroid_fields + node._other_fields:
      if field == 'ctx':
        continue
      yield field, getattr(node, field)

  @classmethod
  def create_mark_checker(cls, source):
    builder = astroid.builder.AstroidBuilder()
    tree = builder.string_build(source)
    return tools.MarkChecker(source, tree=tree)
