from collections import OrderedDict


class AttrDict(OrderedDict):
    def __init__(self, *args, **kwargs):
        super(AttrDict, self).__init__(*args, **kwargs)

    def __getattr__(self, attr):
        if attr not in self:
            raise AttributeError(attr)
        else:
            return self[attr]

    def __setattr__(self, attr, value):
        self[attr] = value

from collections import OrderedDict


class AttrDict(OrderedDict):
    def __init__(self, *args, **kwargs):
        super(OrderedDict, self).__init__(*args, **kwargs)

    def __getattribute__(self, attr):
        if attr in self:
            return self[attr]
        else:
            return super(OrderedDict, self).__getattribute__(attr)

    def __setattr__(self, attr, value):
        self[attr] = value

Switch use of getattr to getattribute.
Switch use of getattr to getattribute.

  from collections import OrderedDict
  
  
  class AttrDict(OrderedDict):
      def __init__(self, *args, **kwargs):
-         super(AttrDict, self).__init__(*args, **kwargs)
+         super(OrderedDict, self).__init__(*args, **kwargs)
  
-     def __getattr__(self, attr):
+     def __getattribute__(self, attr):
-         if attr not in self:
+         if attr in self:
-             raise AttributeError(attr)
+             return self[attr]
          else:
-             return self[attr]
+             return super(OrderedDict, self).__getattribute__(attr)
  
      def __setattr__(self, attr, value):
          self[attr] = value
  
Switch use of getattr to getattribute.
## Code Before:
from collections import OrderedDict


class AttrDict(OrderedDict):
    def __init__(self, *args, **kwargs):
        super(AttrDict, self).__init__(*args, **kwargs)

    def __getattr__(self, attr):
        if attr not in self:
            raise AttributeError(attr)
        else:
            return self[attr]

    def __setattr__(self, attr, value):
        self[attr] = value

## Instruction:
Switch use of getattr to getattribute.
## Code After:
from collections import OrderedDict


class AttrDict(OrderedDict):
    def __init__(self, *args, **kwargs):
        super(OrderedDict, self).__init__(*args, **kwargs)

    def __getattribute__(self, attr):
        if attr in self:
            return self[attr]
        else:
            return super(OrderedDict, self).__getattribute__(attr)

    def __setattr__(self, attr, value):
        self[attr] = value
