# -*- coding: utf-8 -*-
"""
This module recieves an ForecastIO object and holds the falgs weather
data. It has one class for this purpose.
"""


class FIOFlags(object):
    """
    This class recieves an ForecastIO object and holds the flags weather
    data. It has one class for this purpose.
    """

    flags = None

    def __init__(self, forecast_io):
        """
        Recieves an ForecastIO object and gets the flags weather data
        if they are available in the object.
        """
        if forecast_io.has_flags():
            self.flags = forecast_io.get_flags()

    def get(self):
        """
        Returns a dictionary with flags weather data
        """
        return self.flags

    def available_flags(self):
        """
        Returns the available flags available in weather data
        """
        return self.get().keys()

    def units(self):
        """
        Returns in what units weather data is
        """
        if 'units' in self.flags:
            return self.flags['units']
        else:
            return None

@@ -575,16 +575,113 @@
 _flags()
+%0A            for item in self.flags.keys():%0A                setattr(self, item, self.flags%5Bitem%5D)
 %0A%0A    de
@@ -951,207 +951,4 @@
 s()%0A
-%0A    def units(self):%0A        %22%22%22%0A        Returns in what units weather data is%0A        %22%22%22%0A        if 'units' in self.flags:%0A            return self.flags%5B'units'%5D%0A        else:%0A            return None%0A

add fields via reflection to flags