Browse Source

Import sort order

pull/340/merge
Florian Mounier 7 years ago
parent
commit
4743f4c4ea
  1. 3
      .isort.cfg
  2. 3
      Makefile
  3. 1
      demo/moulinrouge/tests.py
  4. 3
      docs/ext/pygal_sphinx_directives.py
  5. 9
      pygal/graph/graph.py
  6. 3
      pygal/graph/histogram.py
  7. 6
      pygal/graph/line.py
  8. 1
      pygal/table.py
  9. 3
      pygal/test/conftest.py
  10. 3
      pygal/test/test_graph.py
  11. 1
      pygal/test/test_line_log_none_max_solved.py
  12. 3
      pygal/test/test_table.py
  13. 3
      pygal/test/test_util.py

3
.isort.cfg

@ -1,2 +1,3 @@
[settings] [settings]
multi_line_output=4 multi_line_output=5
default_section=THIRDPARTY

3
Makefile

@ -15,6 +15,9 @@ lint:
$(PYTEST) --flake8 -m flake8 $(PROJECT_NAME) $(PYTEST) --flake8 -m flake8 $(PROJECT_NAME)
$(PYTEST) --isort -m isort $(PROJECT_NAME) $(PYTEST) --isort -m isort $(PROJECT_NAME)
fix:
$(VENV)/bin/yapf -p -i pygal/**/*.py
check: check:
$(PYTEST) $(PROJECT_NAME) $(PYTEST_ARGS) --cov-report= --cov=pygal $(PYTEST) $(PROJECT_NAME) $(PYTEST_ARGS) --cov-report= --cov=pygal

1
demo/moulinrouge/tests.py

@ -4,7 +4,6 @@ from datetime import date, datetime
from random import choice, randint from random import choice, randint
from flask import abort from flask import abort
from pygal import ( from pygal import (
CHARTS_BY_NAME, XY, Bar, Box, Config, DateLine, DateTimeLine, Dot, Funnel, CHARTS_BY_NAME, XY, Bar, Box, Config, DateLine, DateTimeLine, Dot, Funnel,
Gauge, Histogram, HorizontalBar, Line, Pie, Pyramid, Radar, SolidGauge, Gauge, Histogram, HorizontalBar, Line, Pie, Pyramid, Radar, SolidGauge,

3
docs/ext/pygal_sphinx_directives.py

@ -20,9 +20,8 @@
from traceback import format_exc, print_exc from traceback import format_exc, print_exc
import docutils.core import docutils.core
from docutils.parsers.rst import Directive
import pygal import pygal
from docutils.parsers.rst import Directive
from sphinx.directives.code import CodeBlock from sphinx.directives.code import CodeBlock
# Patch default style # Patch default style

9
pygal/graph/graph.py

@ -916,8 +916,7 @@ class Graph(PublicApi):
def _compute_x_labels_major(self): def _compute_x_labels_major(self):
if self.x_labels_major_every: if self.x_labels_major_every:
self._x_labels_major = [ self._x_labels_major = [
self._x_labels[i][0] self._x_labels[i][0] for i in
for i in
range(0, len(self._x_labels), self.x_labels_major_every) range(0, len(self._x_labels), self.x_labels_major_every)
] ]
@ -964,8 +963,7 @@ class Graph(PublicApi):
def _compute_y_labels_major(self): def _compute_y_labels_major(self):
if self.y_labels_major_every: if self.y_labels_major_every:
self._y_labels_major = [ self._y_labels_major = [
self._y_labels[i][1] self._y_labels[i][1] for i in
for i in
range(0, len(self._y_labels), self.y_labels_major_every) range(0, len(self._y_labels), self.y_labels_major_every)
] ]
@ -1037,8 +1035,7 @@ class Graph(PublicApi):
"""Check if there is any data""" """Check if there is any data"""
return any([ return any([
len([ len([
v v for a in (s[0] if is_list_like(s) else [s])
for a in (s[0] if is_list_like(s) else [s])
for v in (a if is_list_like(a) else [a]) if v is not None for v in (a if is_list_like(a) else [a]) if v is not None
]) for s in self.raw_series ]) for s in self.raw_series
]) ])

3
pygal/graph/histogram.py

@ -49,8 +49,7 @@ class Histogram(Dual, Bar):
def xvals(self): def xvals(self):
"""All x values""" """All x values"""
return [ return [
val val for serie in self.all_series for dval in serie.values
for serie in self.all_series for dval in serie.values
for val in dval[1:3] if val is not None for val in dval[1:3] if val is not None
] ]

6
pygal/graph/line.py

@ -39,8 +39,7 @@ class Line(Graph):
def _values(self): def _values(self):
"""Getter for series values (flattened)""" """Getter for series values (flattened)"""
return [ return [
val[1] val[1] for serie in self.series for val in
for serie in self.series for val in
(serie.interpolated if self.interpolate else serie.points) (serie.interpolated if self.interpolate else serie.points)
if val[1] is not None and (not self.logarithmic or val[1] > 0) if val[1] is not None and (not self.logarithmic or val[1] > 0)
] ]
@ -49,8 +48,7 @@ class Line(Graph):
def _secondary_values(self): def _secondary_values(self):
"""Getter for secondary series values (flattened)""" """Getter for secondary series values (flattened)"""
return [ return [
val[1] val[1] for serie in self.secondary_series for val in
for serie in self.secondary_series for val in
(serie.interpolated if self.interpolate else serie.points) (serie.interpolated if self.interpolate else serie.points)
if val[1] is not None and (not self.logarithmic or val[1] > 0) if val[1] is not None and (not self.logarithmic or val[1] > 0)
] ]

1
pygal/table.py

@ -25,7 +25,6 @@ This class is used to render an html table from a chart data.
import uuid import uuid
from lxml.html import builder, tostring from lxml.html import builder, tostring
from pygal.util import template from pygal.util import template

3
pygal/test/conftest.py

@ -20,9 +20,8 @@
import sys import sys
import pytest
import pygal import pygal
import pytest
from pygal.etree import etree from pygal.etree import etree
from . import get_data from . import get_data

3
pygal/test/test_graph.py

@ -23,9 +23,8 @@ import os
import sys import sys
import uuid import uuid
import pytest
import pygal import pygal
import pytest
from pygal._compat import u from pygal._compat import u
from pygal.graph.map import BaseMap from pygal.graph.map import BaseMap
from pygal.test import make_data from pygal.test import make_data

1
pygal/test/test_line_log_none_max_solved.py

@ -4,6 +4,7 @@
# in the Log graph will be max or not (issue #309) # in the Log graph will be max or not (issue #309)
from __future__ import division from __future__ import division
from pygal import Line from pygal import Line
chart = Line(title='test', logarithmic=True) chart = Line(title='test', logarithmic=True)

3
pygal/test/test_table.py

@ -18,9 +18,8 @@
# along with pygal. If not, see <http://www.gnu.org/licenses/>. # along with pygal. If not, see <http://www.gnu.org/licenses/>.
"""Box chart related tests""" """Box chart related tests"""
from pyquery import PyQuery as pq
from pygal import Pie from pygal import Pie
from pyquery import PyQuery as pq
def test_pie_table(): def test_pie_table():

3
pygal/test/test_util.py

@ -20,13 +20,12 @@
import sys import sys
from pytest import raises
from pygal._compat import _ellipsis, u from pygal._compat import _ellipsis, u
from pygal.util import ( from pygal.util import (
_swap_curly, majorize, mergextend, minify_css, round_to_float, _swap_curly, majorize, mergextend, minify_css, round_to_float,
round_to_int, template, truncate round_to_int, template, truncate
) )
from pytest import raises
def test_round_to_int(): def test_round_to_int():

Loading…
Cancel
Save