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

Make actions happy #2311

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pip==22.3.1
pip==23.2
virtualenv==20.17.1
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:

- name: Install Poetry
run: |
pipx install --pip-args=--constraint=.github/workflows/poetry-constraints.txt poetry
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
poetry --version

- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions isort/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Defines the public isort interface"""

__all__ = (
"Config",
"ImportKey",
Expand Down
6 changes: 3 additions & 3 deletions isort/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,9 @@ def sort_file(
file_input=source_file.stream.read(),
file_output=output_stream.read(),
file_path=actual_file_path,
output=None
if show_diff is True
else cast(TextIO, show_diff),
output=(
None if show_diff is True else cast(TextIO, show_diff)
),
color_output=config.color_output,
)
if show_diff or (
Expand Down
2 changes: 1 addition & 1 deletion isort/deprecated/finders.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Finders try to find right section for passed module name"""

import importlib.machinery
import inspect
import os
Expand Down Expand Up @@ -232,7 +233,6 @@ def _load_mapping() -> Optional[Dict[str, str]]:
import_name, _, pypi_name = line.strip().partition(":")
mappings[pypi_name] = import_name
return mappings
# return dict(tuple(line.strip().split(":")[::-1]) for line in f)

def _load_names(self) -> List[str]:
"""Return list of thirdparty modules from requirements"""
Expand Down
1 change: 1 addition & 0 deletions isort/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""All isort specific exception classes should be defined here"""

from functools import partial
from pathlib import Path
from typing import Any, Dict, List, Type, Union
Expand Down
1 change: 1 addition & 0 deletions isort/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
usage:
exit_code = git_hook(strict=True|False, modify=True|False)
"""

import os
import subprocess # nosec - Needed for hook
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions isort/identify.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Fast stream based import identification.
Eventually this will likely replace parse.py
"""

from functools import partial
from pathlib import Path
from typing import Iterator, NamedTuple, Optional, TextIO, Tuple
Expand Down
1 change: 1 addition & 0 deletions isort/io.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Defines any IO utilities used by isort"""

import dataclasses
import re
import tokenize
Expand Down
1 change: 1 addition & 0 deletions isort/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tool for sorting imports alphabetically, and automatically separated into sections."""

import argparse
import functools
import json
Expand Down
7 changes: 4 additions & 3 deletions isort/parse.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Defines parsing functions used by isort for parsing import definitions"""

import re
from collections import OrderedDict, defaultdict
from functools import partial
Expand Down Expand Up @@ -475,9 +476,9 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
import_from, {}
)
existing_comment = nested_from_comments.get(just_imports[0], "")
nested_from_comments[
just_imports[0]
] = f"{existing_comment}{'; ' if existing_comment else ''}{'; '.join(comments)}"
nested_from_comments[just_imports[0]] = (
f"{existing_comment}{'; ' if existing_comment else ''}{'; '.join(comments)}"
)
comments = []

if comments and attach_comments_to is None:
Expand Down
1 change: 1 addition & 0 deletions isort/place.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Contains all logic related to placing an import within a certain section."""

import importlib
from fnmatch import fnmatch
from functools import lru_cache
Expand Down
1 change: 1 addition & 0 deletions isort/profiles.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Common profiles are defined here to be easily used within a project using --profile {name}"""

from typing import Any, Dict

black = {
Expand Down
1 change: 1 addition & 0 deletions isort/sections.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Defines all sections isort uses by default"""

from typing import Tuple

FUTURE: str = "FUTURE"
Expand Down
12 changes: 7 additions & 5 deletions isort/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Defines how the default settings for isort should be loaded
"""

import configparser
import fnmatch
import os
Expand Down Expand Up @@ -553,8 +554,7 @@ def is_supported_filetype(self, file_name: str) -> bool:
line = fp.readline(100)
except OSError:
return False
else:
return bool(_SHEBANG_RE.match(line))
return bool(_SHEBANG_RE.match(line))

def _check_folder_git_ls_files(self, folder: str) -> Optional[Path]:
env = {**os.environ, "LANG": "C.UTF-8"}
Expand Down Expand Up @@ -761,9 +761,11 @@ def _as_list(value: str) -> List[str]:

def _abspaths(cwd: str, values: Iterable[str]) -> Set[str]:
paths = {
os.path.join(cwd, value)
if not value.startswith(os.path.sep) and value.endswith(os.path.sep)
else value
(
os.path.join(cwd, value)
if not value.startswith(os.path.sep) and value.endswith(os.path.sep)
else value
)
for value in values
}
return paths
Expand Down
6 changes: 3 additions & 3 deletions isort/wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def line(content: str, line_separator: str, config: Config = DEFAULT_CONFIG) ->
)
else ""
)
line_parts[
-1
] = f"{line_parts[-1].strip()}{_comma_maybe}{config.comment_prefix}{comment}"
line_parts[-1] = (
f"{line_parts[-1].strip()}{_comma_maybe}{config.comment_prefix}{comment}"
)
next_line = []
while (len(content) + 2) > (
config.wrap_length or config.line_length
Expand Down
1 change: 1 addition & 0 deletions isort/wrap_modes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Defines all wrap modes that can be used when outputting formatted imports"""

import enum
from inspect import signature
from typing import Any, Callable, Dict, List
Expand Down
Loading
Loading