Skip to content

Commit 764d8d0

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent e10dec5 commit 764d8d0

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

mypyc/irbuild/specialize.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@
8989
dict_values_op,
9090
)
9191
from mypyc.primitives.list_ops import new_list_set_item_op
92-
from mypyc.primitives.tuple_ops import new_tuple_set_item_op
9392
from mypyc.primitives.str_ops import (
94-
str_encode_utf8_strict,
9593
str_encode_ascii_strict,
9694
str_encode_latin1_strict,
95+
str_encode_utf8_strict,
9796
)
97+
from mypyc.primitives.tuple_ops import new_tuple_set_item_op
9898

9999
# Specializers are attempted before compiling the arguments to the
100100
# function. Specializers can return None to indicate that they failed
@@ -716,11 +716,20 @@ def str_encode_fast_path(builder: IRBuilder, expr: CallExpr, callee: RefExpr) ->
716716
encoding = expr.args[0].value.lower().replace("-", "_")
717717

718718
# Specialized encodings and their accepted aliases
719-
if encoding in ['u8', 'utf', 'utf8', 'utf_8', 'cp65001']:
719+
if encoding in ["u8", "utf", "utf8", "utf_8", "cp65001"]:
720720
return builder.call_c(str_encode_utf8_strict, [builder.accept(callee.expr)], expr.line)
721721
elif encoding in ["ascii", "646", "us_ascii"]:
722722
return builder.call_c(str_encode_ascii_strict, [builder.accept(callee.expr)], expr.line)
723-
elif encoding in ['iso_8859_1', 'iso8859_1', '8859', 'cp819', 'latin', 'latin1', 'latin_1', 'l1']:
723+
elif encoding in [
724+
"iso_8859_1",
725+
"iso8859_1",
726+
"8859",
727+
"cp819",
728+
"latin",
729+
"latin1",
730+
"latin_1",
731+
"l1",
732+
]:
724733
return builder.call_c(str_encode_latin1_strict, [builder.accept(callee.expr)], expr.line)
725734

726735
return None

mypyc/test-data/irbuild-str.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,4 +319,3 @@ L0:
319319
r9 = 'backslashreplace'
320320
r10 = CPy_Encode(s, r8, r9)
321321
return 1
322-

0 commit comments

Comments
 (0)