]>
git.madduck.net Git - etc/vim.git/blobdiff - src/black/__init__.py
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
)
from black.linegen import LN, LineGenerator, transform_line
from black.lines import EmptyLineTracker, LinesBlock
)
from black.linegen import LN, LineGenerator, transform_line
from black.lines import EmptyLineTracker, LinesBlock
-from black.mode import (
- FUTURE_FLAG_TO_FEATURE,
- VERSION_TO_FEATURES,
- Feature,
- Mode,
- TargetVersion,
- supports_feature,
-)
+from black.mode import FUTURE_FLAG_TO_FEATURE, VERSION_TO_FEATURES, Feature
+from black.mode import Mode as Mode # re-exported
+from black.mode import TargetVersion, supports_feature
from black.nodes import (
STARS,
is_number_token,
from black.nodes import (
STARS,
is_number_token,
content=code, fast=fast, write_back=write_back, mode=mode, report=report
)
else:
content=code, fast=fast, write_back=write_back, mode=mode, report=report
)
else:
+ assert root is not None # root is only None if code is not None
try:
sources = get_sources(
try:
sources = get_sources(
src=src,
quiet=quiet,
verbose=verbose,
src=src,
quiet=quiet,
verbose=verbose,
src: Tuple[str, ...],
quiet: bool,
verbose: bool,
src: Tuple[str, ...],
quiet: bool,
verbose: bool,
) -> Set[Path]:
"""Compute the set of files to be formatted."""
sources: Set[Path] = set()
) -> Set[Path]:
"""Compute the set of files to be formatted."""
sources: Set[Path] = set()
using_default_exclude = exclude is None
exclude = re_compile_maybe_verbose(DEFAULT_EXCLUDES) if exclude is None else exclude
using_default_exclude = exclude is None
exclude = re_compile_maybe_verbose(DEFAULT_EXCLUDES) if exclude is None else exclude
if is_stdin or p.is_file():
normalized_path: Optional[str] = normalize_path_maybe_ignore(
if is_stdin or p.is_file():
normalized_path: Optional[str] = normalize_path_maybe_ignore(
- p, ctx.obj["root"] , report
)
if normalized_path is None:
if verbose:
)
if normalized_path is None:
if verbose:
sources.add(p)
elif p.is_dir():
sources.add(p)
elif p.is_dir():
- p = root / normalize_path_maybe_ignore(p, ctx.obj["root"], report)
+ p_relative = normalize_path_maybe_ignore(p, root, report)
+ assert p_relative is not None
+ p = root / p_relative
if verbose:
out(f'Found input source directory: "{p}"', fg="blue")
if verbose:
out(f'Found input source directory: "{p}"', fg="blue")
sources.update(
gen_python_files(
p.iterdir(),
sources.update(
gen_python_files(
p.iterdir(),
include,
exclude,
extend_exclude,
include,
exclude,
extend_exclude,