# Path: grafana_dashboards/components/base.py
# class ComponentBase(object):
#     def __init__(self, data, registry):
#         """
# 
#         :type registry: ComponentRegistry
#         """
#         super(ComponentBase, self).__init__()
#         self.data = data[get_component_type(type(self))]
#         if self.data is None:
#             self.data = {}
#         self.name = data.get('name')
#         self.registry = registry
# 
# def get_placeholders(component_name):
#     return [v[1] for v in string.Formatter().parse(component_name) if v[1]]
# 
# Path: grafana_dashboards/components/dashboards.py
# class Dashboard(JsonGenerator):
# 
#     # noinspection PySetFunctionToLiteral
#     _copy_fields = set(['sharedCrosshair'])
# 
#     def gen_json_from_data(self, data, context):
#         json_data = super(Dashboard, self).gen_json_from_data(data, context)
#         nav = {
#             'type': 'timepicker'
#         }
#         json_data.update({
#             'title': data.get('title', self.name),
#             'nav': [
#                 nav
#             ]
#         })
#         if 'time' in data:
#             json_data['time'] = {
#                 'from': data['time']['from'],
#                 'to': data['time']['to']
#             }
#         if 'tags' in data:
#             json_data['tags'] = data.get('tags')
#         if 'time_options' in data:
#             nav['time_options'] = data.get('time_options', [])
#         if 'refresh_intervals' in data:
#             nav['refresh_intervals'] = data.get('refresh_intervals', [])
#         if 'refresh' in data:
#             json_data['refresh'] = data.get('refresh')
#         if 'folderId' in data:
#             json_data['folderId'] = data.get('folderId')
#         if get_component_type(Annotations) in data:
#             json_data['annotations'] = {'list': self.registry.create_component(Annotations, data).gen_json()}
#         if get_component_type(Rows) in data:
#             json_data['rows'] = self.registry.create_component(Rows, data).gen_json()
#         if get_component_type(Templates) in data:
#             json_data['templating'] = {
#                 'list': self.registry.create_component(Templates, data).gen_json(),
#                 'enable': True
#             }
#         return json_data
# 
# Path: grafana_dashboards/context.py
# class Context(object):
# 
#     _pattern = re.compile('{.*}')
# 
#     def __init__(self, context=None):
#         super(Context, self).__init__()
#         if not context:
#             self._context = None
#         else:
#             self._context = DictDefaultingToPlaceholder(context)
# 
#     def expand_placeholders(self, to_expand):
#         """
# 
#         :rtype : dict
#         """
#         if not self._context:
#             return to_expand
# 
#         if isinstance(to_expand, basestring):
#             (result, to_expand) = self._expand(to_expand)
#             while result != to_expand:
#                 (result, to_expand) = self._expand(result)
#             if isinstance(result, basestring):
#                 return string.Formatter().vformat(result, (), self._context)
#             else:
#                 return result
#         elif isinstance(to_expand, list):
#             return [self.expand_placeholders(value) for value in to_expand]
#         elif isinstance(to_expand, dict):
#             return dict([(key, self.expand_placeholders(value)) for (key, value) in to_expand.items()])
#         else:
#             return to_expand
# 
#     def _expand(self, to_expand):
#         if not isinstance(to_expand, basestring):
#             return to_expand, to_expand
#         elif self._pattern.match(to_expand) and to_expand[1:-1] in self._context:
#             return self._context[to_expand[1:-1]], to_expand
#         escaped = to_expand.replace('{{', '{{{{').replace('}}', '}}}}')
#         return string.Formatter().vformat(escaped, (), self._context), to_expand
# 
#     def __str__(self):
#         return str(self._context)
# 
#     @staticmethod
#     def create_context(data, keys_to_expand=None):
#         return (Context(Context(context).expand_placeholders(context))
#                 for context in ContextExpander(keys_to_expand).create_context(None, data))


from grafana_dashboards.components.base import ComponentBase, get_placeholders
from grafana_dashboards.components.dashboards import Dashboard
from grafana_dashboards.context import Context
# -*- coding: utf-8 -*-
# Copyright 2015-2019 grafana-dashboard-builder contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import unicode_literals


__author__ = 'Jakub Plichta <jakub.plichta@gmail.com>'


class Project(ComponentBase):
    def __init__(self, data, registry):

# Path: grafana_dashboards/components/base.py
# class ComponentBase(object):
#     def __init__(self, data, registry):
#         """
# 
#         :type registry: ComponentRegistry
#         """
#         super(ComponentBase, self).__init__()
#         self.data = data[get_component_type(type(self))]
#         if self.data is None:
#             self.data = {}
#         self.name = data.get('name')
#         self.registry = registry
# 
# def get_placeholders(component_name):
#     return [v[1] for v in string.Formatter().parse(component_name) if v[1]]
# 
# Path: grafana_dashboards/components/dashboards.py
# class Dashboard(JsonGenerator):
# 
#     # noinspection PySetFunctionToLiteral
#     _copy_fields = set(['sharedCrosshair'])
# 
#     def gen_json_from_data(self, data, context):
#         json_data = super(Dashboard, self).gen_json_from_data(data, context)
#         nav = {
#             'type': 'timepicker'
#         }
#         json_data.update({
#             'title': data.get('title', self.name),
#             'nav': [
#                 nav
#             ]
#         })
#         if 'time' in data:
#             json_data['time'] = {
#                 'from': data['time']['from'],
#                 'to': data['time']['to']
#             }
#         if 'tags' in data:
#             json_data['tags'] = data.get('tags')
#         if 'time_options' in data:
#             nav['time_options'] = data.get('time_options', [])
#         if 'refresh_intervals' in data:
#             nav['refresh_intervals'] = data.get('refresh_intervals', [])
#         if 'refresh' in data:
#             json_data['refresh'] = data.get('refresh')
#         if 'folderId' in data:
#             json_data['folderId'] = data.get('folderId')
#         if get_component_type(Annotations) in data:
#             json_data['annotations'] = {'list': self.registry.create_component(Annotations, data).gen_json()}
#         if get_component_type(Rows) in data:
#             json_data['rows'] = self.registry.create_component(Rows, data).gen_json()
#         if get_component_type(Templates) in data:
#             json_data['templating'] = {
#                 'list': self.registry.create_component(Templates, data).gen_json(),
#                 'enable': True
#             }
#         return json_data
# 
# Path: grafana_dashboards/context.py
# class Context(object):
# 
#     _pattern = re.compile('{.*}')
# 
#     def __init__(self, context=None):
#         super(Context, self).__init__()
#         if not context:
#             self._context = None
#         else:
#             self._context = DictDefaultingToPlaceholder(context)
# 
#     def expand_placeholders(self, to_expand):
#         """
# 
#         :rtype : dict
#         """
#         if not self._context:
#             return to_expand
# 
#         if isinstance(to_expand, basestring):
#             (result, to_expand) = self._expand(to_expand)
#             while result != to_expand:
#                 (result, to_expand) = self._expand(result)
#             if isinstance(result, basestring):
#                 return string.Formatter().vformat(result, (), self._context)
#             else:
#                 return result
#         elif isinstance(to_expand, list):
#             return [self.expand_placeholders(value) for value in to_expand]
#         elif isinstance(to_expand, dict):
#             return dict([(key, self.expand_placeholders(value)) for (key, value) in to_expand.items()])
#         else:
#             return to_expand
# 
#     def _expand(self, to_expand):
#         if not isinstance(to_expand, basestring):
#             return to_expand, to_expand
#         elif self._pattern.match(to_expand) and to_expand[1:-1] in self._context:
#             return self._context[to_expand[1:-1]], to_expand
#         escaped = to_expand.replace('{{', '{{{{').replace('}}', '}}}}')
#         return string.Formatter().vformat(escaped, (), self._context), to_expand
# 
#     def __str__(self):
#         return str(self._context)
# 
#     @staticmethod
#     def create_context(data, keys_to_expand=None):
#         return (Context(Context(context).expand_placeholders(context))
#                 for context in ContextExpander(keys_to_expand).create_context(None, data))


# Path: grafana_dashboards/components/projects.py
from grafana_dashboards.components.base import ComponentBase, get_placeholders
from grafana_dashboards.components.dashboards import Dashboard
from grafana_dashboards.context import Context

# -*- coding: utf-8 -*-
# Copyright 2015-2019 grafana-dashboard-builder contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import unicode_literals


__author__ = 'Jakub Plichta <jakub.plichta@gmail.com>'


class Project(ComponentBase):
    def __init__(self, data, registry):

        super(Project, self).__init__(data, registry)