-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from jakubplichta/py3
Add support for py3
- Loading branch information
Showing
39 changed files
with
215 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ htmlcov/ | |
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.pytest_cache | ||
|
||
# Translations | ||
*.mo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
language: python | ||
python: | ||
- "2.7" | ||
install: | ||
- pip install tox | ||
script: | ||
- tox | ||
- "3.4" | ||
- "3.5" | ||
- "3.6" | ||
- "3.7-dev" | ||
install: pip install tox-travis | ||
script: tox | ||
branches: | ||
only: | ||
- master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
grafana-dashboard-builder | ||
Copyright 2015-2018 grafana-dashboard-builder contributors | ||
Copyright 2015-2019 grafana-dashboard-builder contributors | ||
|
||
This product includes grafana-dashboard-builder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015-2018 grafana-dashboard-builder contributors | ||
# 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. | ||
|
@@ -13,6 +13,8 @@ | |
# 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 | ||
|
||
from grafana_dashboards import cli | ||
|
||
__author__ = 'Jakub Plichta <[email protected]>' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015-2018 grafana-dashboard-builder contributors | ||
# 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. | ||
|
@@ -12,5 +12,5 @@ | |
# 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 <[email protected]>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015-2018 grafana-dashboard-builder contributors | ||
# 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. | ||
|
@@ -13,6 +13,8 @@ | |
# 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 print_function | ||
from __future__ import unicode_literals | ||
|
||
import argparse | ||
import imp | ||
|
@@ -21,20 +23,20 @@ | |
|
||
import yaml | ||
|
||
from grafana_dashboards.client.grafana import GrafanaExporter | ||
from grafana_dashboards.exporter import ProjectProcessor, FileExporter | ||
from grafana_dashboards.client.elastic_search import ElasticSearchExporter | ||
from grafana_dashboards.client.grafana import GrafanaExporter | ||
from grafana_dashboards.common import get_component_type | ||
from grafana_dashboards.config import Config | ||
from grafana_dashboards.exporter import ProjectProcessor, FileExporter | ||
from grafana_dashboards.parser import DefinitionParser | ||
|
||
__author__ = 'Jakub Plichta <[email protected]>' | ||
|
||
|
||
def _initialize_exporters(exporter_names, exporter_types, config): | ||
exporters = dict([(get_component_type(exporter), exporter) for exporter in exporter_types]) | ||
exporters = dict([(name[:-9], exporter) for name, exporter in exporters.iteritems() if name[:-9] in exporter_names]) | ||
return [exporter(**config.get_config(name)) for (name, exporter) in exporters.iteritems()] | ||
exporters = dict([(name[:-9], exporter) for name, exporter in exporters.items() if name[:-9] in exporter_names]) | ||
return [exporter(**config.get_config(name)) for (name, exporter) in exporters.items()] | ||
|
||
|
||
def _process_paths(paths): | ||
|
@@ -75,7 +77,7 @@ def main(): | |
try: | ||
imp.load_source('grafana_dashboards.components.$loaded', plugin) | ||
except Exception as e: | ||
print 'Cannot load plugin %s: %s' % (plugin, str(e)) | ||
print('Cannot load plugin %s: %s' % (plugin, str(e))) | ||
|
||
if args.project: | ||
logging.warn("Using deprecated option '--project'") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015-2018 grafana-dashboard-builder contributors | ||
# 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. | ||
|
@@ -12,5 +12,5 @@ | |
# 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 <[email protected]>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015-2018 grafana-dashboard-builder contributors | ||
# 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. | ||
|
@@ -12,12 +12,14 @@ | |
# 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 | ||
|
||
import json | ||
import logging | ||
import os | ||
|
||
from grafana_dashboards.exporter import DashboardExporter | ||
from grafana_dashboards.client.connection import Connection, KerberosConnection | ||
from grafana_dashboards.exporter import DashboardExporter | ||
|
||
__author__ = 'Jakub Plichta <[email protected]>' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015-2018 grafana-dashboard-builder contributors | ||
# 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. | ||
|
@@ -12,6 +12,8 @@ | |
# 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 | ||
|
||
import re | ||
|
||
__author__ = 'Jakub Plichta <[email protected]>' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015-2018 grafana-dashboard-builder contributors | ||
# 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. | ||
|
@@ -13,12 +13,12 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import base | ||
import dashboards | ||
import panels | ||
import projects | ||
import rows | ||
import templates | ||
from grafana_dashboards.components import base | ||
from grafana_dashboards.components import dashboards | ||
from grafana_dashboards.components import panels | ||
from grafana_dashboards.components import projects | ||
from grafana_dashboards.components import rows | ||
from grafana_dashboards.components import templates | ||
|
||
__author__ = 'Jakub Plichta <[email protected]>' | ||
__all__ = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015-2018 grafana-dashboard-builder contributors | ||
# 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. | ||
|
@@ -12,6 +12,8 @@ | |
# 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 | ||
|
||
from grafana_dashboards.components.base import JsonListGenerator, JsonGenerator | ||
|
||
__author__ = 'Jakub Plichta <[email protected]>' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015-2018 grafana-dashboard-builder contributors | ||
# 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. | ||
|
@@ -12,6 +12,8 @@ | |
# 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 | ||
|
||
from grafana_dashboards.components.base import JsonListGenerator, JsonGenerator | ||
|
||
__author__ = 'Jakub Plichta <[email protected]>' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2015-2018 grafana-dashboard-builder contributors | ||
# 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. | ||
|
@@ -12,13 +12,20 @@ | |
# 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 | ||
|
||
import logging | ||
import string | ||
|
||
from grafana_dashboards import errors | ||
from grafana_dashboards.common import get_component_type | ||
from grafana_dashboards.context import Context | ||
|
||
try: | ||
basestring | ||
except NameError: | ||
basestring = str | ||
|
||
__author__ = 'Jakub Plichta <[email protected]>' | ||
|
||
|
||
|
@@ -55,7 +62,7 @@ def __init__(self): | |
self._components[clazz] = {} | ||
|
||
def _class_for_type(self, component_type): | ||
if isinstance(component_type, str): | ||
if isinstance(component_type, basestring): | ||
component_type = self._types.get(component_type) | ||
if self._components.get(component_type) is None: | ||
raise errors.UnregisteredComponentError("No component of type '%s' found!" % component_type) | ||
|
@@ -159,15 +166,15 @@ def gen_json_from_data(self, data, context): | |
return result_list | ||
|
||
def gen_item_json(self, items, result_list): | ||
if isinstance(items, str): | ||
if isinstance(items, basestring): | ||
# this is component without context | ||
result_list += self.registry.get_component(type(self), items).gen_json() | ||
else: | ||
self._gen_item_json_with_context(items, result_list) | ||
|
||
def _gen_item_json_with_context(self, items, result_list): | ||
# TODO add check for dictionary | ||
for (item_type, item_data) in items.iteritems(): | ||
for (item_type, item_data) in items.items(): | ||
if item_type not in self.component_item_types: | ||
# this is named component with context | ||
for context in Context.create_context(item_data, get_placeholders(item_type)): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.