diff --git a/pygal/__init__.py b/pygal/__init__.py index 4eb6fd9..30e48e7 100644 --- a/pygal/__init__.py +++ b/pygal/__init__.py @@ -26,6 +26,11 @@ and the maps extensions namespace module. __version__ = '1.9.9' +import pkg_resources +import sys +import traceback +import warnings + from pygal.graph.bar import Bar from pygal.graph.box import Box from pygal.graph.dot import Dot @@ -46,10 +51,6 @@ from pygal.graph.xy import XY from pygal.graph.graph import Graph from pygal.config import Config from pygal import maps -import pkg_resources -import sys -import traceback -import warnings CHARTS_BY_NAME = dict( diff --git a/pygal/config.py b/pygal/config.py index ce56616..324e0a1 100644 --- a/pygal/config.py +++ b/pygal/config.py @@ -19,8 +19,9 @@ """Config module holding all options and their default values.""" from copy import deepcopy -from pygal.style import Style, DefaultStyle + from pygal.interpolate import INTERPOLATIONS +from pygal.style import DefaultStyle, Style CONFIG_ITEMS = [] diff --git a/pygal/graph/bar.py b/pygal/graph/bar.py index 8e56719..0126d0e 100644 --- a/pygal/graph/bar.py +++ b/pygal/graph/bar.py @@ -23,8 +23,9 @@ proportional to the values that they represent. """ from __future__ import division + from pygal.graph.graph import Graph -from pygal.util import swap, ident, decorate, alter +from pygal.util import alter, decorate, ident, swap class Bar(Graph): diff --git a/pygal/graph/base.py b/pygal/graph/base.py index 7848fb3..edbc025 100644 --- a/pygal/graph/base.py +++ b/pygal/graph/base.py @@ -20,19 +20,19 @@ """Base for pygal charts""" from __future__ import division + +import os +from functools import reduce +from uuid import uuid4 + from pygal._compat import is_list_like -from pygal.view import Margin, Box -from pygal.config import Config +from pygal.adapters import decimal_to_float, not_zero, positive +from pygal.config import Config, SerieConfig +from pygal.serie import Serie from pygal.state import State -from pygal.util import compose, ident from pygal.svg import Svg -from pygal.serie import Serie -from pygal.config import SerieConfig -from pygal.adapters import ( - not_zero, positive, decimal_to_float) -from functools import reduce -from uuid import uuid4 -import os +from pygal.util import compose, ident +from pygal.view import Box, Margin class BaseGraph(object): diff --git a/pygal/graph/box.py b/pygal/graph/box.py index 2629f4e..5ccda59 100644 --- a/pygal/graph/box.py +++ b/pygal/graph/box.py @@ -23,11 +23,13 @@ Different types are available throught the box_mode option """ from __future__ import division -from pygal.graph.graph import Graph -from pygal.util import compute_scale, decorate, alter -from pygal._compat import is_list_like + from bisect import bisect_left, bisect_right +from pygal._compat import is_list_like +from pygal.graph.graph import Graph +from pygal.util import alter, decorate + class Box(Graph): diff --git a/pygal/graph/dual.py b/pygal/graph/dual.py index 6ed3be0..5c50292 100644 --- a/pygal/graph/dual.py +++ b/pygal/graph/dual.py @@ -19,9 +19,9 @@ """Dual chart base. Dual means a chart with 2 scaled axis like xy""" -from pygal.util import cut, compute_scale from pygal._compat import is_str from pygal.graph.graph import Graph +from pygal.util import compute_scale, cut class Dual(Graph): diff --git a/pygal/graph/funnel.py b/pygal/graph/funnel.py index 73b47d8..82f4074 100644 --- a/pygal/graph/funnel.py +++ b/pygal/graph/funnel.py @@ -19,9 +19,10 @@ """Funnel chart: Represent values as a funnel""" from __future__ import division -from pygal.util import decorate, cut, compute_scale, alter -from pygal.adapters import positive, none_to_zero + +from pygal.adapters import none_to_zero, positive from pygal.graph.graph import Graph +from pygal.util import alter, cut, decorate class Funnel(Graph): diff --git a/pygal/graph/gauge.py b/pygal/graph/gauge.py index 01a3060..325cc17 100644 --- a/pygal/graph/gauge.py +++ b/pygal/graph/gauge.py @@ -20,10 +20,11 @@ """Gauge chart representing values as needles on a polar scale""" from __future__ import division + from pygal._compat import is_str -from pygal.util import decorate, compute_scale, alter, cut -from pygal.view import PolarThetaView, PolarThetaLogView from pygal.graph.graph import Graph +from pygal.util import alter, compute_scale, cut, decorate +from pygal.view import PolarThetaLogView, PolarThetaView class Gauge(Graph): diff --git a/pygal/graph/graph.py b/pygal/graph/graph.py index 53b7ca7..0b114d1 100644 --- a/pygal/graph/graph.py +++ b/pygal/graph/graph.py @@ -19,16 +19,19 @@ """Chart properties and drawing""" from __future__ import division + +from itertools import chain, repeat + +from math import ceil, cos, sin, sqrt + from pygal._compat import is_list_like, is_str -from pygal.interpolate import INTERPOLATIONS from pygal.graph.public import PublicApi -from pygal.view import View, LogView, XYLogView, ReverseView +from pygal.interpolate import INTERPOLATIONS from pygal.util import ( - cached_property, majorize, humanize, split_title, compute_scale, - truncate, reverse_text_len, get_text_box, get_texts_box, cut, rad, - decorate) -from math import sqrt, ceil, cos, sin -from itertools import repeat, chain + cached_property, compute_scale, cut, decorate, + get_text_box, get_texts_box, humanize, majorize, rad, reverse_text_len, + split_title, truncate) +from pygal.view import LogView, ReverseView, View, XYLogView class Graph(PublicApi): diff --git a/pygal/graph/horizontal.py b/pygal/graph/horizontal.py index 74694a4..76b6bbc 100644 --- a/pygal/graph/horizontal.py +++ b/pygal/graph/horizontal.py @@ -17,8 +17,9 @@ # You should have received a copy of the GNU Lesser General Public License # along with pygal. If not, see . """Horizontal graph mixin""" + from pygal.graph.graph import Graph -from pygal.view import HorizontalView, HorizontalLogView +from pygal.view import HorizontalLogView, HorizontalView class HorizontalGraph(Graph): diff --git a/pygal/graph/horizontalbar.py b/pygal/graph/horizontalbar.py index 56ffeec..13068b3 100644 --- a/pygal/graph/horizontalbar.py +++ b/pygal/graph/horizontalbar.py @@ -19,8 +19,8 @@ """Horizontal bar graph""" -from pygal.graph.horizontal import HorizontalGraph from pygal.graph.bar import Bar +from pygal.graph.horizontal import HorizontalGraph class HorizontalBar(HorizontalGraph, Bar): diff --git a/pygal/graph/pie.py b/pygal/graph/pie.py index edd8fc7..980c46f 100644 --- a/pygal/graph/pie.py +++ b/pygal/graph/pie.py @@ -22,11 +22,13 @@ It can be made as a donut or a half pie. """ from __future__ import division -from pygal.util import decorate, alter -from pygal.graph.graph import Graph -from pygal.adapters import positive, none_to_zero + from math import pi +from pygal.adapters import none_to_zero, positive +from pygal.graph.graph import Graph +from pygal.util import alter, decorate + class Pie(Graph): diff --git a/pygal/graph/public.py b/pygal/graph/public.py index 165ecc6..b5100db 100644 --- a/pygal/graph/public.py +++ b/pygal/graph/public.py @@ -18,10 +18,11 @@ # along with pygal. If not, see . """pygal public api functions""" +import base64 import io -from pygal._compat import u, is_list_like + +from pygal._compat import is_list_like, u from pygal.graph.base import BaseGraph -import base64 class PublicApi(BaseGraph): diff --git a/pygal/graph/radar.py b/pygal/graph/radar.py index 0815e85..b7bce51 100644 --- a/pygal/graph/radar.py +++ b/pygal/graph/radar.py @@ -23,13 +23,15 @@ useful for multivariate observation. """ from __future__ import division -from pygal.graph.line import Line -from pygal.adapters import positive, none_to_zero -from pygal.view import PolarView, PolarLogView -from pygal.util import deg, cached_property, compute_scale, majorize, cut -from pygal._compat import is_str + from math import cos, pi +from pygal._compat import is_str +from pygal.adapters import none_to_zero, positive +from pygal.graph.line import Line +from pygal.util import cached_property, compute_scale, cut, deg, majorize +from pygal.view import PolarLogView, PolarView + class Radar(Line): diff --git a/pygal/graph/stackedline.py b/pygal/graph/stackedline.py index d48b233..3083628 100644 --- a/pygal/graph/stackedline.py +++ b/pygal/graph/stackedline.py @@ -23,8 +23,9 @@ on top of the others. Used along fill=True option. """ from __future__ import division -from pygal.graph.line import Line + from pygal.adapters import none_to_zero +from pygal.graph.line import Line class StackedLine(Line): diff --git a/pygal/graph/time.py b/pygal/graph/time.py index 1ad22f8..e6f4d21 100644 --- a/pygal/graph/time.py +++ b/pygal/graph/time.py @@ -22,10 +22,11 @@ XY time extensions: handle convertion of date, time, datetime, timedelta into float for xy plot and back to their type for display """ +from datetime import date, datetime, time, timedelta + +from pygal._compat import is_str, timestamp, total_seconds from pygal.adapters import positive from pygal.graph.xy import XY -from datetime import datetime, date, time, timedelta -from pygal._compat import timestamp, total_seconds, is_str def datetime_to_timestamp(x): diff --git a/pygal/graph/treemap.py b/pygal/graph/treemap.py index 81ee7b1..60f746a 100644 --- a/pygal/graph/treemap.py +++ b/pygal/graph/treemap.py @@ -20,9 +20,10 @@ """Treemap chart: Visualize data using nested recangles""" from __future__ import division -from pygal.util import decorate, cut, alter + +from pygal.adapters import none_to_zero, positive from pygal.graph.graph import Graph -from pygal.adapters import positive, none_to_zero +from pygal.util import alter, cut, decorate class Treemap(Graph): diff --git a/pygal/interpolate.py b/pygal/interpolate.py index 241f0b9..830acb7 100644 --- a/pygal/interpolate.py +++ b/pygal/interpolate.py @@ -25,6 +25,7 @@ with `precision` interpolated points between each of them """ from __future__ import division + from math import sin diff --git a/pygal/serie.py b/pygal/serie.py index e5b105c..9405802 100644 --- a/pygal/serie.py +++ b/pygal/serie.py @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with pygal. If not, see . """Serie property holder""" + from pygal.util import cached_property diff --git a/pygal/style.py b/pygal/style.py index fa08f36..c5a7d46 100644 --- a/pygal/style.py +++ b/pygal/style.py @@ -19,9 +19,11 @@ """Charts styling classes""" from __future__ import division + from itertools import chain + from pygal import colors -from pygal.colors import darken, lighten, is_foreground_light +from pygal.colors import darken, is_foreground_light, lighten class Style(object): diff --git a/pygal/table.py b/pygal/table.py index c32168d..84cf692 100644 --- a/pygal/table.py +++ b/pygal/table.py @@ -22,9 +22,10 @@ HTML Table maker. This class is used to render an html table from a chart data. """ -from pygal.util import template -from lxml.html import builder, tostring import uuid +from lxml.html import builder, tostring + +from pygal.util import template class HTML(object): diff --git a/pygal/util.py b/pygal/util.py index 8a1d86a..4b92012 100644 --- a/pygal/util.py +++ b/pygal/util.py @@ -20,10 +20,15 @@ """Various utility functions""" from __future__ import division -from pygal._compat import u, is_list_like, to_unicode + import re from decimal import Decimal -from math import floor, pi, log, log10, ceil + +from math import ceil, floor, log, log10, pi + +from pygal._compat import is_list_like, to_unicode, u + + ORDERS = u("yzafpnµm kMGTPEZY") diff --git a/pygal/view.py b/pygal/view.py index a1c74b8..7a0688e 100644 --- a/pygal/view.py +++ b/pygal/view.py @@ -20,7 +20,8 @@ """Projection and bounding helpers""" from __future__ import division -from math import sin, cos, log10, pi + +from math import cos, log10, pi, sin class Margin(object):