Esempio n. 1
0
from web.server.util.util import (
    assert_boolean,
    assert_enum,
    assert_float,
    assert_mapping,
    assert_one_of,
    assert_non_string_iterable,
    assert_string,
    assert_type,
    string_type_validator,
    try_parse_enum,
    key_value_element_validator,
)

# pylint:disable=C0103
SettingsGroupProperty = PropertyRegistry()
TitleProperty = PropertyRegistry()
AxisProperty = PropertyRegistry()
XAxisProperty = PropertyRegistry()
YAxisProperty = PropertyRegistry()
SeriesProperty = PropertyRegistry()
SeriesObjectProperty = PropertyRegistry()
LegendProperty = PropertyRegistry()

COLOR_PATTERN = re.compile(r'^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$')
HEX_COLOR_CHARACTERS = '0123456789ABCDEF'
VIEW_SPECIFIC_TYPES_OR_DICT = list(VIEW_SPECIFIC_TYPES) + [dict]


def generate_random_colour():
    colour = "#" + ''.join([random.choice(HEX_COLOR_CHARACTERS) for _ in range(6)])
Esempio n. 2
0
    assert_enum,
    assert_equals,
    assert_in,
    assert_integer,
    assert_non_string_iterable,
    assert_mapping,
    assert_string,
    assert_type,
    string_type_validator,
    stringify_datetime,
    convert_datetime,
    try_parse_enum,
)

# pylint:disable=C0103
DashboardProperty = PropertyRegistry()
OptionsProperty = PropertyRegistry()
FilterProperty = PropertyRegistry()
QueryProperty = PropertyRegistry()
LayoutItemProperty = PropertyRegistry()
LayoutSizeProperty = PropertyRegistry()
VisualizationSettingsProperty = PropertyRegistry()
DateRangeProperty = PropertyRegistry()
CustomFieldProperty = PropertyRegistry()
AdvancedFieldProperty = PropertyRegistry()


class DateRangeType(Enum):
    '''
    An enumeration for defining different types of date ranges
    '''
    assert_enum,
    assert_float,
    assert_in,
    assert_integer,
    assert_non_string_iterable,
    assert_mapping,
    assert_number,
    assert_string,
    key_value_element_validator,
    string_type_validator,
)

BASE_LAYERS = set(['Satellite', 'Streets', 'Light', 'Blank'])

# pylint:disable=C0103
AnimatedMapProperty = PropertyRegistry()
BarChartProperty = PropertyRegistry()
BoxPlotProperty = PropertyRegistry()
BubbleChartProperty = PropertyRegistry()
BumpChartProperty = PropertyRegistry()
ExpandoTreeProperty = PropertyRegistry()
HeatMapProperty = PropertyRegistry()
HeatTileProperty = PropertyRegistry()
MapProperty = PropertyRegistry()
SunburstProperty = PropertyRegistry()
TableProperty = PropertyRegistry()
TimeSeriesProperty = PropertyRegistry()


def map_coordinate_validator(value, index, argument_name=None):
    value_suffix = ('for argument \'{0}\' with value \'{1}\''.format(