Revert "Use lowercase hex numbers fixes #1692 (#1775)"

This reverts commit 7d032fa848.
This commit is contained in:
Łukasz Langa 2021-04-25 19:04:15 +02:00
parent 368f043f13
commit 773e4a22d5
No known key found for this signature in database
GPG Key ID: B26995E310250568
7 changed files with 16 additions and 22 deletions

3
.gitignore vendored
View File

@ -1,4 +1,3 @@
.venv
.coverage
_build
.DS_Store
@ -16,4 +15,4 @@ src/_black_version.py
.dmypy.json
*.swp
.hypothesis/
venv/
venv/

View File

@ -5351,15 +5351,10 @@ def normalize_numeric_literal(leaf: Leaf) -> None:
def format_hex(text: str) -> str:
"""
Formats a hexadecimal string like "0x12b3"
Uses lowercase because of similarity between "B" and "8", which
can cause security issues.
see: https://github.com/psf/black/issues/1692
Formats a hexadecimal string like "0x12B3"
"""
before, after = text[:2], text[2:]
return f"{before}{after.lower()}"
return f"{before}{after.upper()}"
def format_scientific_notation(text: str) -> str:

View File

@ -10,7 +10,7 @@
},
"attrs": {
"cli_arguments": [],
"expect_formatting_changes": true,
"expect_formatting_changes": false,
"git_clone_url": "https://github.com/python-attrs/attrs.git",
"long_checkout": false,
"py_versions": ["all"]
@ -47,7 +47,7 @@
},
"hypothesis": {
"cli_arguments": [],
"expect_formatting_changes": true,
"expect_formatting_changes": false,
"git_clone_url": "https://github.com/HypothesisWorks/hypothesis.git",
"long_checkout": false,
"py_versions": ["all"]
@ -63,7 +63,7 @@
},
"pillow": {
"cli_arguments": [],
"expect_formatting_changes": true,
"expect_formatting_changes": false,
"git_clone_url": "https://github.com/python-pillow/Pillow.git",
"long_checkout": false,
"py_versions": ["all"]
@ -77,7 +77,7 @@
},
"pyramid": {
"cli_arguments": [],
"expect_formatting_changes": true,
"expect_formatting_changes": false,
"git_clone_url": "https://github.com/Pylons/pyramid.git",
"long_checkout": false,
"py_versions": ["all"]
@ -112,7 +112,7 @@
},
"virtualenv": {
"cli_arguments": [],
"expect_formatting_changes": true,
"expect_formatting_changes": false,
"git_clone_url": "https://github.com/pypa/virtualenv.git",
"long_checkout": false,
"py_versions": ["all"]

View File

@ -33,7 +33,7 @@
import sys
from io import StringIO
HUGE: int = 0x7fffffff # maximum repeat count, default max
HUGE: int = 0x7FFFFFFF # maximum repeat count, default max
_type_reprs: Dict[int, Union[Text, int]] = {}

View File

@ -12,7 +12,7 @@
x = 123456789E123456789
x = 123456789J
x = 123456789.123456789J
x = 0Xb1aCc
x = 0XB1ACC
x = 0B1011
x = 0O777
x = 0.000000006
@ -36,7 +36,7 @@
x = 123456789e123456789
x = 123456789j
x = 123456789.123456789j
x = 0xb1acc
x = 0xB1ACC
x = 0b1011
x = 0o777
x = 0.000000006

View File

@ -3,7 +3,7 @@
x = 123456789L
x = 123456789l
x = 123456789
x = 0xB1aCc
x = 0xb1acc
# output
@ -13,4 +13,4 @@
x = 123456789L
x = 123456789L
x = 123456789
x = 0xb1acc
x = 0xB1ACC

View File

@ -3,7 +3,7 @@
x = 123456789
x = 1_2_3_4_5_6_7
x = 1E+1
x = 0xb1AcC
x = 0xb1acc
x = 0.00_00_006
x = 12_34_567J
x = .1_2
@ -16,8 +16,8 @@
x = 123456789
x = 1_2_3_4_5_6_7
x = 1e1
x = 0xb1acc
x = 0xB1ACC
x = 0.00_00_006
x = 12_34_567j
x = 0.1_2
x = 1_2.0
x = 1_2.0