summaryrefslogtreecommitdiffstats
path: root/contrib/python/black/patches/01-fixed-import-tests.patch
diff options
context:
space:
mode:
authoralevitskii <[email protected]>2025-09-02 06:57:05 +0300
committeralevitskii <[email protected]>2025-09-02 07:19:27 +0300
commit7e399723cf6d967e20c8f9d2ee975426636242c5 (patch)
treeabd5283daba11c07afc8fc16f02aec2c19e2272a /contrib/python/black/patches/01-fixed-import-tests.patch
parent14e9c865541d5abe545cb496c0143e4905b00c78 (diff)
Drop LINTER param from styling macroses and cleanup deps
Drop LINTER param from styling macroses commit_hash:00dd2e2ee103e509cff38f520d4779974abe39a7
Diffstat (limited to 'contrib/python/black/patches/01-fixed-import-tests.patch')
-rw-r--r--contrib/python/black/patches/01-fixed-import-tests.patch54
1 files changed, 0 insertions, 54 deletions
diff --git a/contrib/python/black/patches/01-fixed-import-tests.patch b/contrib/python/black/patches/01-fixed-import-tests.patch
deleted file mode 100644
index 4f1334c8262..00000000000
--- a/contrib/python/black/patches/01-fixed-import-tests.patch
+++ /dev/null
@@ -1,54 +0,0 @@
---- contrib/python/black/blib2to3/pgen2/conv.py (index)
-+++ contrib/python/black/blib2to3/pgen2/conv.py (working tree)
-@@ -35,1 +35,1 @@ without having to invoke the Python pgen C program.
--from pgen2 import grammar, token
-+from ..pgen2 import grammar, token
---- contrib/python/black/blib2to3/pgen2/driver.py (index)
-+++ contrib/python/black/blib2to3/pgen2/driver.py (working tree)
-@@ -47,6 +47,12 @@ from blib2to3.pgen2.grammar import Grammar
-
- Path = Union[str, "os.PathLike[str]"]
-
-+try:
-+ import __res
-+ IS_ARCADIA = True
-+except ImportError:
-+ IS_ARCADIA = False
-+
-
- @dataclass
- class ReleaseRange:
-@@ -298,7 +304,7 @@ def load_packaged_grammar(
- but preserves load_grammar's automatic regeneration behavior when possible.
-
- """
-- if os.path.isfile(grammar_source):
-+ if os.path.isfile(grammar_source) or IS_ARCADIA:
- gp = _generate_pickle_name(grammar_source, cache_dir) if cache_dir else None
- return load_grammar(grammar_source, gp=gp)
- pickled_name = _generate_pickle_name(os.path.basename(grammar_source), cache_dir)
---- contrib/python/black/blib2to3/pgen2/pgen.py (index)
-+++ contrib/python/black/blib2to3/pgen2/pgen.py (working tree)
-@@ -24,6 +24,9 @@ import os
-
- Path = Union[str, "os.PathLike[str]"]
-
-+import pkgutil
-+import io
-+
-
- class PgenGrammar(grammar.Grammar):
- pass
-@@ -39,7 +42,11 @@ class ParserGenerator(object):
- def __init__(self, filename: Path, stream: Optional[IO[Text]] = None) -> None:
- close_stream = None
- if stream is None:
-- stream = open(filename, encoding="utf-8")
-+ data = pkgutil.get_data("blib2to3", os.path.basename(filename))
-+ if data:
-+ stream = io.StringIO(data.decode("utf-8"))
-+ else:
-+ stream = open(filename, encoding="utf-8")
- close_stream = stream.close
- self.filename = filename
- self.stream = stream