Skip to content

Commit

Permalink
Move some utils.py helpers to Darkgraylib
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Mar 7, 2024
1 parent 6627c74 commit 27e92ba
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 450 deletions.
4 changes: 2 additions & 2 deletions src/darker/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)
from darker.help import get_extra_instruction
from darker.import_sorting import apply_isort, isort
from darker.utils import GIT_DATEFORMAT, DiffChunk, debug_dump, glob_any
from darker.utils import debug_dump, glob_any
from darker.verification import ASTVerifier, BinarySearch, NotEquivalentError
from darkgraylib.black_compat import find_project_root
from darkgraylib.config import show_config_if_debug
Expand All @@ -46,7 +46,7 @@
from darkgraylib.highlighting import colorize, should_use_color
from darkgraylib.log import setup_logging
from darkgraylib.main import resolve_paths
from darkgraylib.utils import TextDocument
from darkgraylib.utils import GIT_DATEFORMAT, DiffChunk, TextDocument
from graylint.linting import run_linters

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/darker/chooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import logging
from typing import Generator, Iterable, List

from darker.utils import DiffChunk
from darkgraylib.utils import DiffChunk

logger = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions src/darker/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@
from typing import Generator, List, Sequence, Tuple

from darker.multiline_strings import find_overlap
from darker.utils import DiffChunk
from darkgraylib.diff import diff_and_get_opcodes, validate_opcodes
from darkgraylib.utils import TextDocument
from darkgraylib.utils import DiffChunk, TextDocument

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions src/darker/import_sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from darker.diff import diff_chunks
from darker.exceptions import IncompatiblePackageError, MissingPackageError
from darker.git import EditedLinenumsDiffer
from darker.utils import DiffChunk, glob_any
from darker.utils import glob_any
from darkgraylib.black_compat import find_project_root
from darkgraylib.utils import TextDocument
from darkgraylib.utils import DiffChunk, TextDocument

try:
import isort
Expand Down
3 changes: 1 addition & 2 deletions src/darker/tests/test_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
from darker.command_line import make_argument_parser, parse_command_line
from darker.config import Exclusions
from darker.tests.helpers import flynt_present, isort_present
from darker.utils import joinlines
from darkgraylib.config import ConfigurationError
from darkgraylib.git import RevisionRange
from darkgraylib.testtools.helpers import raises_if_exception
from darkgraylib.utils import TextDocument
from darkgraylib.utils import TextDocument, joinlines

pytestmark = pytest.mark.usefixtures("find_project_root_cache_clear")

Expand Down
3 changes: 1 addition & 2 deletions src/darker/tests/test_fstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
import darker.fstring
from darker.git import EditedLinenumsDiffer
from darker.tests.helpers import flynt_present
from darker.utils import joinlines
from darkgraylib.git import RevisionRange
from darkgraylib.utils import TextDocument
from darkgraylib.utils import TextDocument, joinlines

ORIGINAL_SOURCE = ("'{}'.format(x)", "#", "'{0}'.format(42)")
MODIFIED_SOURCE = ("'{}'.format( x)", "#", "'{0}'.format( 42)")
Expand Down
3 changes: 1 addition & 2 deletions src/darker/tests/test_import_sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
import darker.import_sorting
from darker.git import EditedLinenumsDiffer
from darker.tests.helpers import isort_present
from darker.utils import joinlines
from darkgraylib.git import RevisionRange
from darkgraylib.utils import TextDocument
from darkgraylib.utils import TextDocument, joinlines

ORIGINAL_SOURCE = ("import sys", "import os", "", "print(42)")
ISORTED_SOURCE = ("import os", "import sys", "", "print(42)")
Expand Down
3 changes: 1 addition & 2 deletions src/darker/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
from darker.git import EditedLinenumsDiffer
from darker.tests.helpers import isort_present
from darker.tests.test_fstring import FLYNTED_SOURCE, MODIFIED_SOURCE, ORIGINAL_SOURCE
from darker.utils import joinlines
from darker.verification import NotEquivalentError
from darkgraylib.git import WORKTREE, RevisionRange
from darkgraylib.testtools.highlighting_helpers import BLUE, CYAN, RESET, WHITE, YELLOW
from darkgraylib.utils import TextDocument
from darkgraylib.utils import TextDocument, joinlines

pytestmark = pytest.mark.usefixtures("find_project_root_cache_clear")

Expand Down
Loading

0 comments on commit 27e92ba

Please sign in to comment.