]>
git.madduck.net Git - etc/vim.git/commitdiff
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:
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (parent:
ee02ebe )
from asyncio.base_events import BaseEventLoop
from concurrent.futures import Executor, ProcessPoolExecutor
from enum import Enum, Flag
from asyncio.base_events import BaseEventLoop
from concurrent.futures import Executor, ProcessPoolExecutor
from enum import Enum, Flag
from multiprocessing import Manager
import os
from pathlib import Path
from multiprocessing import Manager
import os
from pathlib import Path
from typing import (
Any,
Callable,
from typing import (
Any,
Callable,
# types
FileContent = str
Encoding = str
# types
FileContent = str
Encoding = str
Depth = int
NodeType = int
LeafID = int
Depth = int
NodeType = int
LeafID = int
mode |= FileMode.PYI
with open(src, "rb") as buf:
mode |= FileMode.PYI
with open(src, "rb") as buf:
- newline, encoding, src_contents = prepare_input (buf.read())
+ src_contents, encoding, newline = decode_bytes (buf.read())
try:
dst_contents = format_file_contents(
src_contents, line_length=line_length, fast=fast, mode=mode
try:
dst_contents = format_file_contents(
src_contents, line_length=line_length, fast=fast, mode=mode
`line_length`, `fast`, `is_pyi`, and `force_py36` arguments are passed to
:func:`format_file_contents`.
"""
`line_length`, `fast`, `is_pyi`, and `force_py36` arguments are passed to
:func:`format_file_contents`.
"""
- newline, encoding, src = prepare_input (sys.stdin.buffer.read())
+ src, encoding, newline = decode_bytes (sys.stdin.buffer.read())
dst = src
try:
dst = format_file_contents(src, line_length=line_length, fast=fast, mode=mode)
dst = src
try:
dst = format_file_contents(src, line_length=line_length, fast=fast, mode=mode)
+ f = io.TextIOWrapper(
+ sys.stdout.buffer, encoding=encoding, newline=newline, write_through=True
+ )
if write_back == WriteBack.YES:
if write_back == WriteBack.YES:
- f = io.TextIOWrapper(
- sys.stdout.buffer,
- encoding=encoding,
- newline=newline,
- write_through=True,
- )
elif write_back == WriteBack.DIFF:
src_name = "<stdin> (original)"
dst_name = "<stdin> (formatted)"
elif write_back == WriteBack.DIFF:
src_name = "<stdin> (original)"
dst_name = "<stdin> (formatted)"
- f = io.TextIOWrapper(
- sys.stdout.buffer,
- encoding=encoding,
- newline=newline,
- write_through=True,
- )
f.write(diff(src, dst, src_name, dst_name))
f.write(diff(src, dst, src_name, dst_name))
def format_file_contents(
def format_file_contents(
-def prepare_input(src: bytes) -> Tuple[str, str, str ]:
- """Analyze `src` and return a tuple of (newline, encoding, decoded_contents)
+def decode_bytes(src: bytes) -> Tuple[FileContent, Encoding, NewLine ]:
+ """Return a tuple of (decoded_contents, encoding, newline).
- Where `newline` is either CRLF or LF, and `decoded_contents` is decoded with
- universal newlines (i.e. only LF).
+ `newline` is either CRLF or LF but `decoded_contents` is decoded with
+ universal newlines (i.e. only contains LF).
"""
srcbuf = io.BytesIO(src)
encoding, lines = tokenize.detect_encoding(srcbuf.readline)
newline = "\r\n" if b"\r\n" == lines[0][-2:] else "\n"
srcbuf.seek(0)
"""
srcbuf = io.BytesIO(src)
encoding, lines = tokenize.detect_encoding(srcbuf.readline)
newline = "\r\n" if b"\r\n" == lines[0][-2:] else "\n"
srcbuf.seek(0)
- return newline, encoding, io.TextIOWrapper(srcbuf, encoding).read()
+ with io.TextIOWrapper(srcbuf, encoding) as tiow:
+ return tiow.read(), encoding, newline
.. autofunction:: black.assert_stable
.. autofunction:: black.assert_stable
+.. autofunction:: black.can_omit_invisible_parens
+
.. autofunction:: black.is_empty_tuple
.. autofunction:: black.is_import
.. autofunction:: black.is_line_short_enough
.. autofunction:: black.is_empty_tuple
.. autofunction:: black.is_import
.. autofunction:: black.is_line_short_enough
+.. autofunction:: black.is_multiline_string
+
.. autofunction:: black.is_one_tuple
.. autofunction:: black.is_python36
.. autofunction:: black.is_one_tuple
.. autofunction:: black.is_python36
.. autofunction:: black.is_vararg
.. autofunction:: black.is_vararg
+.. autofunction:: black.is_yield
+
+
+.. autofunction:: black.decode_bytes
+
.. autofunction:: black.lib2to3_parse
.. autofunction:: black.lib2to3_unparse
.. autofunction:: black.lib2to3_parse
.. autofunction:: black.lib2to3_unparse
-.. autofunction:: black.prepare_input
-
Split functions
---------------
Split functions
---------------
.. autofunction:: black.enumerate_reversed
.. autofunction:: black.enumerate_reversed
+.. autofunction:: black.enumerate_with_length
+
.. autofunction:: black.generate_comments
.. autofunction:: black.make_comment
.. autofunction:: black.generate_comments
.. autofunction:: black.make_comment