]> git.madduck.net Git - etc/vim.git/blobdiff - blackd.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:

Switch from versioneer to setuptools-scm (#1008)
[etc/vim.git] / blackd.py
index 25a9a1589ac9102212fde79aed690a2afad2a153..37fcec31ec10b092a8a273dc03a5d59921d3464c 100644 (file)
--- a/blackd.py
+++ b/blackd.py
@@ -129,7 +129,11 @@ def parse_python_variant_header(value: str) -> Tuple[bool, Set[black.TargetVersi
         for version in value.split(","):
             if version.startswith("py"):
                 version = version[len("py") :]
-            major_str, *rest = version.split(".")
+            if "." in version:
+                major_str, *rest = version.split(".")
+            else:
+                major_str = version[0]
+                rest = [version[1:]] if len(version) > 1 else []
             try:
                 major = int(major_str)
                 if major not in (2, 3):