Skip to content

Commit

Permalink
Use ruff instead of flake8 and isort
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Mar 17, 2024
1 parent 6604003 commit b076217
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,4 @@ jobs:
- name: Launch tests
run: python -m pytest -n auto
- name: Check coding style
run: python -m flake8
- name: Check imports order
run: python -m isort . --check --diff
run: python -m ruff check
4 changes: 2 additions & 2 deletions flask_weasyprint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def _wrapper(class_, *args, **kwargs):
return class_(guess, *args, **kwargs)


def HTML(*args, **kwargs):
def HTML(*args, **kwargs): # noqa: N802
"""Like :class:`weasyprint.HTML` but:
* :func:`make_url_fetcher` is used to create an ``url_fetcher``
Expand All @@ -163,7 +163,7 @@ def HTML(*args, **kwargs):
return _wrapper(HTML, *args, **kwargs)


def CSS(*args, **kwargs):
def CSS(*args, **kwargs): # noqa: N802
from weasyprint import CSS # lazy loading
return _wrapper(CSS, *args, **kwargs)

Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Donation = 'https://opencollective.com/courtbouillon'

[project.optional-dependencies]
doc = ['sphinx', 'sphinx_rtd_theme']
test = ['pytest', 'isort', 'flake8']
test = ['pytest', 'ruff']

[tool.flit.sdist]
exclude = ['.*']
Expand All @@ -59,6 +59,6 @@ include = ['tests/*', 'flask_weasyprint/*']
exclude_lines = ['pragma: no cover', 'def __repr__', 'raise NotImplementedError']
omit = ['.*']

[tool.isort]
default_section = 'FIRSTPARTY'
multi_line_output = 4
[tool.ruff.lint]
select = ['E', 'W', 'F', 'I', 'N', 'RUF']
ignore = ['RUF001', 'RUF002', 'RUF003']
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@app.config.from_object
class Config:
GRAPH_COLORS = ['#0C3795', '#752641', '#E47F00']
GRAPH_COLORS = ('#0C3795', '#752641', '#E47F00')


@app.route('/')
Expand Down
3 changes: 2 additions & 1 deletion tests/test_flask_weasyprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import pytest
from flask import Flask, json, jsonify, redirect, request
from flask_weasyprint import CSS, HTML, make_url_fetcher, render_pdf
from weasyprint import __version__ as weasyprint_version
from werkzeug.test import ClientRedirectError

from flask_weasyprint import CSS, HTML, make_url_fetcher, render_pdf

from . import app, document_html


Expand Down

0 comments on commit b076217

Please sign in to comment.