# Path: pyeapi/utils.py
# class ProxyCall(object):
# 
#     def __init__(self, proxy, method):
#         self.proxy = proxy
#         self.method = method
# 
#     def __call__(self, *args, **kwargs):
#         return self.proxy(self.method, *args, **kwargs)


import re
from pyeapi.api import EntityCollection
from pyeapi.utils import ProxyCall
    def __init__(self, node, *args, **kwargs):
        super(Interfaces, self).__init__(node, *args, **kwargs)
        self._instances = dict()

    def get(self, name):
        return self.get_instance(name)[name]

    def getall(self):
        """Returns all interfaces in a dict object.

        Returns:
            A Python dictionary object containing all interface
            configuration indexed by interface name::

                {
                    "Ethernet1": {...},
                    "Ethernet2": {...}
                }

        """
        interfaces_re = re.compile(r'(?<=^interface\s)(.+)$', re.M)

        response = dict()
        for name in interfaces_re.findall(self.config):
            interface = self.get(name)
            if interface:
                response[name] = interface
        return response

    def __getattr__(self, name):

# Path: pyeapi/utils.py
# class ProxyCall(object):
# 
#     def __init__(self, proxy, method):
#         self.proxy = proxy
#         self.method = method
# 
#     def __call__(self, *args, **kwargs):
#         return self.proxy(self.method, *args, **kwargs)


# Path: pyeapi/api/interfaces.py
import re
from pyeapi.api import EntityCollection
from pyeapi.utils import ProxyCall

    def __init__(self, node, *args, **kwargs):
        super(Interfaces, self).__init__(node, *args, **kwargs)
        self._instances = dict()

    def get(self, name):
        return self.get_instance(name)[name]

    def getall(self):
        """Returns all interfaces in a dict object.

        Returns:
            A Python dictionary object containing all interface
            configuration indexed by interface name::

                {
                    "Ethernet1": {...},
                    "Ethernet2": {...}
                }

        """
        interfaces_re = re.compile(r'(?<=^interface\s)(.+)$', re.M)

        response = dict()
        for name in interfaces_re.findall(self.config):
            interface = self.get(name)
            if interface:
                response[name] = interface
        return response

    def __getattr__(self, name):

        return ProxyCall(self.marshall, name)