Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from flake8 + isort + pylint to ruff #550

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .isort.cfg

This file was deleted.

249 changes: 0 additions & 249 deletions .pylintrc

This file was deleted.

3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ clean:
rm -fr *.egg-info

lint:
$(FLAKE8) $(PROJECT_NAME)
$(PYTEST) --isort -m isort $(PROJECT_NAME)
$(RUFF) $(PROJECT_NAME)

fix:
$(VENV)/bin/yapf -p -i pygal/**/*.py
Expand Down
2 changes: 1 addition & 1 deletion Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PROJECT_NAME = pygal
# Python env
PYTHON_VERSION ?= python
VENV = $(PWD)/.env$(if $(filter $(PYTHON_VERSION),python),,-$(PYTHON_VERSION))
FLAKE8 = $(VENV)/bin/flake8
RUFF = $(VENV)/bin/ruff
PIP = $(VENV)/bin/pip
PYTHON = $(VENV)/bin/python
PYTEST = $(VENV)/bin/py.test
Expand Down
2 changes: 1 addition & 1 deletion demo/moulinrouge.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
handler.setLevel(logging.DEBUG)
app.logger.setLevel(logging.DEBUG)
logging.getLogger('werkzeug').setLevel(logging.DEBUG)
except:
except Exception:
pass

try:
Expand Down
19 changes: 10 additions & 9 deletions demo/moulinrouge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with pygal. If not, see <http://www.gnu.org/licenses/>.
from flask import Flask, render_template, Response, request
import pickle
import random
import string
from base64 import urlsafe_b64decode as b64decode
from base64 import urlsafe_b64encode as b64encode

from flask import Flask, Response, render_template, request

import pygal
from pygal.config import Config
from pygal.util import cut
from pygal.etree import etree
from pygal.style import styles, parametric_styles
from base64 import (
urlsafe_b64encode as b64encode, urlsafe_b64decode as b64decode
)
import string
import random
import pickle
from pygal.style import parametric_styles, styles
from pygal.util import cut


def get(type):
Expand Down
33 changes: 26 additions & 7 deletions demo/moulinrouge/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,30 @@
from random import choice, randint

from flask import abort

from pygal import (
CHARTS_BY_NAME, XY, Bar, Box, Config, DateLine, DateTimeLine, Dot, Funnel,
Gauge, Histogram, HorizontalBar, Line, Pie, Pyramid, Radar, SolidGauge,
StackedBar, StackedLine, TimeLine, Treemap, formatters, stats
CHARTS_BY_NAME,
XY,
Bar,
Box,
Config,
DateLine,
DateTimeLine,
Dot,
Funnel,
Gauge,
Histogram,
Line,
Pie,
Pyramid,
Radar,
SolidGauge,
StackedBar,
StackedLine,
TimeLine,
Treemap,
formatters,
stats,
)
from pygal.colors import rotate
from pygal.graph.horizontal import HorizontalGraph
Expand Down Expand Up @@ -706,7 +726,7 @@ def test_swissmap():
smap.add(
'links', [{
'value': ('kt-vs', 10),
'label': '\o/',
'label': r'\o/',
'xlink': 'http://google.com?q=69'
}, {
'value': ('bt', 20),
Expand All @@ -731,7 +751,7 @@ def test_frenchmapregions():
fmap.add(
'links', [{
'value': ('02', 10),
'label': '\o/',
'label': r'\o/',
'xlink': 'http://google.com?q=69'
}, {
'value': ('72', 20),
Expand Down Expand Up @@ -1029,7 +1049,7 @@ def test_rotations_for(chart):
@app.route('/test/datetimeline')
def test_datetimeline():
line = DateTimeLine()
from datetime import timezone, timedelta
from datetime import timedelta, timezone
tz7 = timezone(timedelta(hours=7), 'GMT +7')
tzn4 = timezone(timedelta(hours=-4), 'GMT -4')

Expand Down Expand Up @@ -1069,7 +1089,6 @@ def test_order_min():

@app.route('/test/custom_css_file')
def test_custom_css_file():
from tempfile import NamedTemporaryFile
custom_css = '''
{{ id }}text {
fill: green;
Expand Down
Loading
Loading