fix: improve Black import error [optional-black-improvement] #1285
Annotations
9 errors and 1 warning
src/darker/formatters/black_formatter.py#L159
Import outside toplevel (darker.formatters.black_wrapper.format_str) (import-outside-toplevel, C0415)
|
src/darker/formatters/black_formatter.py#L186
Import outside toplevel (darker.formatters.black_wrapper.FileMode, darker.formatters.black_wrapper.TargetVersion) (import-outside-toplevel, C0415)
|
src/darker/formatters/black_wrapper.py#L22
Constant name "message" doesn't conform to UPPER_CASE naming style (invalid-name, C0103)
|
src/darker/formatters/black_wrapper.py#L25
Import "from black import FileMode, TargetVersion, format_str, parse_pyproject_toml, re_compile_maybe_verbose" should be placed at the top of the module (wrong-import-position, C0413)
|
src/darker/formatters/black_wrapper.py#L10
Unused import black (unused-import, W0611)
|
pylint
Linting failures detected. See check runs with annotations for details.
|
src/darker/formatters/black_formatter.py#L156
"""
# Local import so Darker can be run without Black installed.
# No need for error handling, already done in `BlackFormatter.read_config`.
- from darker.formatters.black_wrapper import (
+ from darker.formatters.black_wrapper import ( # pylint: disable=import-outside-toplevel
format_str,
- ) # pylint: disable=import-outside-toplevel
+ )
contents_for_black = content.string_with_newline("\n")
if contents_for_black.strip():
|
src/darker/formatters/black_formatter.py#L184
# Local import so Darker can be run without Black installed.
# No need for error handling, already done in `BlackFormatter.read_config`.
from darker.formatters.black_wrapper import (
- FileMode as Mode,
- TargetVersion,
- ) # pylint: disable=import-outside-toplevel
+ FileMode as Mode, # pylint: disable=import-outside-toplevel
+ )
+ from darker.formatters.black_wrapper import TargetVersion
mode = BlackModeAttributes()
if "line_length" in self.config:
|
src/darker/formatters/black_wrapper.py#L30
re_compile_maybe_verbose,
)
-
__all__ = [
"FileMode",
"TargetVersion",
|
pylint
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|