import sys

from ..base_request import BaseRequest
from ..settings import Settings


class Config(object):
    """
    This class implements configuration model for Resin Python SDK.

    Attributes:
        _config (dict): caching configuration.

    """

    def __init__(self):
        self.base_request = BaseRequest()
        self.settings = Settings()
        self._config = None

    def _get_config(self, key):
        if self._config:
            return self._config[key]
        # Load all config again
        self.get_all()
        return self._config[key]

    def get_all(self):
        """
        Get all configuration.

        Returns:
            dict: configuration information.

        Examples:
            >>> resin.models.config.get_all()
            { all configuration details }

        """

        if self._config is None:
            self._config = self.base_request.request(
                'config', 'GET', endpoint=self.settings.get('api_endpoint'))
        return self._config

    def get_device_types(self):
        """
        Get device types configuration.

        Returns:
            list: device types information.

        Examples:
            >>> resin.models.config.get_device_types()
            [ all configuration details ]

        """

        return self._get_config('deviceTypes')

@@ -78,16 +78,484 @@
 tings%0A%0A%0A
+def _normalize_device_type(dev_type):%0A    if dev_type%5B'state'%5D == 'PREVIEW':%0A        dev_type%5B'state'%5D = 'ALPHA'%0A        dev_type%5B'name'%5D = dev_type%5B'name'%5D.replace('(PREVIEW)', '(ALPHA)')%0A    if dev_type%5B'state'%5D == 'EXPERIMENTAL':%0A        dev_type%5B'state'%5D = 'BETA'%0A        dev_type%5B'name'%5D = dev_type%5B'name'%5D.replace('(EXPERIMENTAL)', ('BETA'))%0A    if dev_type%5B'slug'%5D == 'raspberry-pi':%0A        dev_type%5B'name'%5D = 'Raspberry Pi (v1 or Zero)'%0A    return dev_type%0A%0A%0A
 class Co
@@ -1441,24 +1441,123 @@
 endpoint'))%0A
+            self._config%5B'deviceTypes'%5D = map(_normalize_device_type, self._config%5B'deviceTypes'%5D)%0A
         retu

Patch device types to be marked as ALPHA and BETA