]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/black/tests/data/empty_lines.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:

Add '.vim/bundle/black/' from commit '2f3fa1f6d0cbc2a3f31c7440c422da173b068e7b'
[etc/vim.git] / .vim / bundle / black / tests / data / empty_lines.py
diff --git a/.vim/bundle/black/tests/data/empty_lines.py b/.vim/bundle/black/tests/data/empty_lines.py
new file mode 100644 (file)
index 0000000..4c03e43
--- /dev/null
@@ -0,0 +1,187 @@
+"""Docstring."""
+
+
+# leading comment
+def f():
+    NO = ''
+    SPACE = ' '
+    DOUBLESPACE = '  '
+
+    t = leaf.type
+    p = leaf.parent  # trailing comment
+    v = leaf.value
+
+    if t in ALWAYS_NO_SPACE:
+        pass
+    if t == token.COMMENT:  # another trailing comment
+        return DOUBLESPACE
+
+
+    assert p is not None, f"INTERNAL ERROR: hand-made leaf without parent: {leaf!r}"
+
+
+    prev = leaf.prev_sibling
+    if not prev:
+        prevp = preceding_leaf(p)
+        if not prevp or prevp.type in OPENING_BRACKETS:
+
+
+            return NO
+
+
+        if prevp.type == token.EQUAL:
+            if prevp.parent and prevp.parent.type in {
+                syms.typedargslist,
+                syms.varargslist,
+                syms.parameters,
+                syms.arglist,
+                syms.argument,
+            }:
+                return NO
+
+        elif prevp.type == token.DOUBLESTAR:
+            if prevp.parent and prevp.parent.type in {
+                syms.typedargslist,
+                syms.varargslist,
+                syms.parameters,
+                syms.arglist,
+                syms.dictsetmaker,
+            }:
+                return NO
+
+###############################################################################
+# SECTION BECAUSE SECTIONS
+###############################################################################
+
+def g():
+    NO = ''
+    SPACE = ' '
+    DOUBLESPACE = '  '
+
+    t = leaf.type
+    p = leaf.parent
+    v = leaf.value
+
+    # Comment because comments
+
+    if t in ALWAYS_NO_SPACE:
+        pass
+    if t == token.COMMENT:
+        return DOUBLESPACE
+
+    # Another comment because more comments
+    assert p is not None, f'INTERNAL ERROR: hand-made leaf without parent: {leaf!r}'
+
+    prev = leaf.prev_sibling
+    if not prev:
+        prevp = preceding_leaf(p)
+
+        if not prevp or prevp.type in OPENING_BRACKETS:
+            # Start of the line or a bracketed expression.
+            # More than one line for the comment.
+            return NO
+
+        if prevp.type == token.EQUAL:
+            if prevp.parent and prevp.parent.type in {
+                syms.typedargslist,
+                syms.varargslist,
+                syms.parameters,
+                syms.arglist,
+                syms.argument,
+            }:
+                return NO
+
+
+# output
+
+
+"""Docstring."""
+
+
+# leading comment
+def f():
+    NO = ""
+    SPACE = " "
+    DOUBLESPACE = "  "
+
+    t = leaf.type
+    p = leaf.parent  # trailing comment
+    v = leaf.value
+
+    if t in ALWAYS_NO_SPACE:
+        pass
+    if t == token.COMMENT:  # another trailing comment
+        return DOUBLESPACE
+
+    assert p is not None, f"INTERNAL ERROR: hand-made leaf without parent: {leaf!r}"
+
+    prev = leaf.prev_sibling
+    if not prev:
+        prevp = preceding_leaf(p)
+        if not prevp or prevp.type in OPENING_BRACKETS:
+
+            return NO
+
+        if prevp.type == token.EQUAL:
+            if prevp.parent and prevp.parent.type in {
+                syms.typedargslist,
+                syms.varargslist,
+                syms.parameters,
+                syms.arglist,
+                syms.argument,
+            }:
+                return NO
+
+        elif prevp.type == token.DOUBLESTAR:
+            if prevp.parent and prevp.parent.type in {
+                syms.typedargslist,
+                syms.varargslist,
+                syms.parameters,
+                syms.arglist,
+                syms.dictsetmaker,
+            }:
+                return NO
+
+
+###############################################################################
+# SECTION BECAUSE SECTIONS
+###############################################################################
+
+
+def g():
+    NO = ""
+    SPACE = " "
+    DOUBLESPACE = "  "
+
+    t = leaf.type
+    p = leaf.parent
+    v = leaf.value
+
+    # Comment because comments
+
+    if t in ALWAYS_NO_SPACE:
+        pass
+    if t == token.COMMENT:
+        return DOUBLESPACE
+
+    # Another comment because more comments
+    assert p is not None, f"INTERNAL ERROR: hand-made leaf without parent: {leaf!r}"
+
+    prev = leaf.prev_sibling
+    if not prev:
+        prevp = preceding_leaf(p)
+
+        if not prevp or prevp.type in OPENING_BRACKETS:
+            # Start of the line or a bracketed expression.
+            # More than one line for the comment.
+            return NO
+
+        if prevp.type == token.EQUAL:
+            if prevp.parent and prevp.parent.type in {
+                syms.typedargslist,
+                syms.varargslist,
+                syms.parameters,
+                syms.arglist,
+                syms.argument,
+            }:
+                return NO