Skip to content

Commit c536cab

Browse files
authored
Merge pull request #3 from VallinZ/AddAlignmentSpecifierLogic
Remove Print for testing previous Code
2 parents 30665c0 + e3d002e commit c536cab

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

mypy/checkstrformat.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ def check_specs_in_format_call(
337337
338338
The core logic for format checking is implemented in this method.
339339
"""
340-
print("in format call")
341340
assert all(s.key for s in specs), "Keys must be auto-generated first!"
342341
replacements = self.find_replacements_in_call(call, [cast(str, s.key) for s in specs])
343342
assert len(replacements) == len(specs)
@@ -449,7 +448,8 @@ def perform_special_format_checks(
449448
call,
450449
code=codes.STRING_FORMATTING,
451450
)
452-
if isinstance(actual_type, NoneType):
451+
a_type = get_proper_type(actual_type)
452+
if isinstance(a_type, NoneType):
453453
# Perform type check of alignment specifiers on None
454454
if spec.format_spec and any(c in spec.format_spec for c in "<>^"):
455455
specifierIndex = -1
@@ -458,14 +458,14 @@ def perform_special_format_checks(
458458
specifierIndex = i
459459
if specifierIndex > -1:
460460
self.msg.fail(
461-
(
462-
f'Alignment format specifier '
463-
f'"{spec.format_spec[specifierIndex]}" '
464-
f'is not supported for None'
465-
),
466-
call,
467-
code=codes.STRING_FORMATTING,
468-
)
461+
(
462+
f"Alignment format specifier "
463+
f'"{spec.format_spec[specifierIndex]}" '
464+
f"is not supported for None"
465+
),
466+
call,
467+
code=codes.STRING_FORMATTING,
468+
)
469469

470470
def find_replacements_in_call(self, call: CallExpr, keys: list[str]) -> list[Expression]:
471471
"""Find replacement expression for every specifier in str.format() call.

0 commit comments

Comments
 (0)