Disable universal newlines when reading TOML (#2408)
This commit is contained in:
parent
c5b458ef4b
commit
389e9c23a9
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### _Black_
|
### _Black_
|
||||||
|
|
||||||
|
- Do not accept bare carriage return line endings in pyproject.toml (#2408)
|
||||||
- Improve error message for invalid regular expression (#2678)
|
- Improve error message for invalid regular expression (#2678)
|
||||||
- Improve error message when parsing fails during AST safety check by embedding the
|
- Improve error message when parsing fails during AST safety check by embedding the
|
||||||
underlying SyntaxError (#2693)
|
underlying SyntaxError (#2693)
|
||||||
|
2
Pipfile
2
Pipfile
@ -42,7 +42,7 @@ platformdirs= ">=2"
|
|||||||
click = ">=8.0.0"
|
click = ">=8.0.0"
|
||||||
mypy_extensions = ">=0.4.3"
|
mypy_extensions = ">=0.4.3"
|
||||||
pathspec = ">=0.8.1"
|
pathspec = ">=0.8.1"
|
||||||
tomli = ">=0.2.6, <2.0.0"
|
tomli = ">=1.1.0, <3.0.0"
|
||||||
typed-ast = "==1.4.3"
|
typed-ast = "==1.4.3"
|
||||||
typing_extensions = {markers = "python_version < '3.10'", version = ">=3.10.0.0"}
|
typing_extensions = {markers = "python_version < '3.10'", version = ">=3.10.0.0"}
|
||||||
black = {editable = true,extras = ["d"],path = "."}
|
black = {editable = true,extras = ["d"],path = "."}
|
||||||
|
2
setup.py
2
setup.py
@ -99,7 +99,7 @@ def find_python_files(base: Path) -> List[Path]:
|
|||||||
install_requires=[
|
install_requires=[
|
||||||
"click>=7.1.2",
|
"click>=7.1.2",
|
||||||
"platformdirs>=2",
|
"platformdirs>=2",
|
||||||
"tomli>=0.2.6,<2.0.0",
|
"tomli>=1.1.0,<3.0.0",
|
||||||
"typed-ast>=1.4.2; python_version < '3.8' and implementation_name == 'cpython'",
|
"typed-ast>=1.4.2; python_version < '3.8' and implementation_name == 'cpython'",
|
||||||
"pathspec>=0.9.0, <1",
|
"pathspec>=0.9.0, <1",
|
||||||
"dataclasses>=0.6; python_version < '3.7'",
|
"dataclasses>=0.6; python_version < '3.7'",
|
||||||
|
@ -95,8 +95,8 @@ def parse_pyproject_toml(path_config: str) -> Dict[str, Any]:
|
|||||||
|
|
||||||
If parsing fails, will raise a tomli.TOMLDecodeError
|
If parsing fails, will raise a tomli.TOMLDecodeError
|
||||||
"""
|
"""
|
||||||
with open(path_config, encoding="utf8") as f:
|
with open(path_config, "rb") as f:
|
||||||
pyproject_toml = tomli.loads(f.read())
|
pyproject_toml = tomli.load(f)
|
||||||
config = pyproject_toml.get("tool", {}).get("black", {})
|
config = pyproject_toml.get("tool", {}).get("black", {})
|
||||||
return {k.replace("--", "").replace("-", "_"): v for k, v in config.items()}
|
return {k.replace("--", "").replace("-", "_"): v for k, v in config.items()}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user