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

Add isort module to checks script and Github CI #120

Merged
merged 6 commits into from
Nov 18, 2022
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
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,17 @@ jobs:
python -m pip install pyproject-flake8
- name: Check
run: pflake8 -v src
isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install isort
- name: Check
run: python -m isort -v src
1 change: 1 addition & 0 deletions checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ set -eoux pipefail
python -m pytest src -vv
python -m black --check src
python -m pflake8 src
python -m isort -v src
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ dev = [
"pyproject-flake8>=5.0",
"pytest>=7.1",
"twine>=4.0",
"isort>=5.10",
]

[project.urls]
Expand Down
2 changes: 1 addition & 1 deletion src/integration_tests/regression_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from __future__ import annotations

from collections.abc import Callable
import math
from collections.abc import Callable
from typing import Any

from latexify import frontend
Expand Down
3 changes: 1 addition & 2 deletions src/latexify/ast_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

import pytest

from latexify import ast_utils
from latexify import test_utils
from latexify import ast_utils, test_utils


@test_utils.require_at_most(7)
Expand Down
8 changes: 2 additions & 6 deletions src/latexify/codegen/function_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
from __future__ import annotations

import ast
import sys
import dataclasses
import sys
from typing import Any

from latexify import analyzers
from latexify import constants
from latexify import math_symbols
from latexify import exceptions

from latexify import analyzers, constants, exceptions, math_symbols

# Precedences of operators for BoolOp, BinOp, UnaryOp, and Compare nodes.
# Note that this value affects only the appearance of surrounding parentheses for each
Expand Down
3 changes: 1 addition & 2 deletions src/latexify/codegen/function_codegen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
from __future__ import annotations

import ast
from latexify import exceptions
from latexify import test_utils

import pytest

from latexify import exceptions, test_utils
from latexify.codegen import FunctionCodegen, function_codegen


Expand Down
7 changes: 2 additions & 5 deletions src/latexify/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

from __future__ import annotations

import warnings
from collections.abc import Callable
from typing import Any
import warnings

from latexify import codegen
from latexify import exceptions
from latexify import parser
from latexify import transformers
from latexify import codegen, exceptions, parser, transformers


def get_latex(
Expand Down
2 changes: 1 addition & 1 deletion src/latexify/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from __future__ import annotations

from collections.abc import Callable
import ast
import inspect
import textwrap
from collections.abc import Callable
from typing import Any

import dill
Expand Down
3 changes: 1 addition & 2 deletions src/latexify/parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

import pytest

from latexify import exceptions, parser
from latexify import test_utils
from latexify import exceptions, parser, test_utils


def test_parse_function_with_posonlyargs() -> None:
Expand Down
2 changes: 1 addition & 1 deletion src/latexify/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from __future__ import annotations

import ast
from collections.abc import Callable
import functools
import sys
from collections.abc import Callable
from typing import cast


Expand Down
4 changes: 1 addition & 3 deletions src/latexify/transformers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""Package latexify.transformers."""

from latexify.transformers import assignment_reducer
from latexify.transformers import identifier_replacer

from latexify.transformers import assignment_reducer, identifier_replacer

AssignmentReducer = assignment_reducer.AssignmentReducer
IdentifierReplacer = identifier_replacer.IdentifierReplacer
2 changes: 1 addition & 1 deletion src/latexify/transformers/assignment_reducer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from __future__ import annotations

import ast
from latexify import ast_utils, parser, test_utils

from latexify import ast_utils, parser, test_utils
from latexify.transformers.assignment_reducer import AssignmentReducer


Expand Down