summaryrefslogtreecommitdiff
path: root/src/flake8/utils.py
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2021-03-29 20:07:13 -0700
committerAnthony Sottile <asottile@umich.edu>2021-03-30 17:37:13 -0700
commitedadccd8dcf5fc1de86116adb5f9f13ed1b68637 (patch)
tree382ad5e83f6512ff157553c6a8c16b63569cec70 /src/flake8/utils.py
parente9a2a1018349f3eda9811bcadb63d4e2af05fd2f (diff)
downloadflake8-edadccd8dcf5fc1de86116adb5f9f13ed1b68637.tar.gz
audit + string joining
Diffstat (limited to 'src/flake8/utils.py')
-rw-r--r--src/flake8/utils.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/flake8/utils.py b/src/flake8/utils.py
index ee81de7..fe5d907 100644
--- a/src/flake8/utils.py
+++ b/src/flake8/utils.py
@@ -9,6 +9,7 @@ import os
import platform
import re
import sys
+import textwrap
import tokenize
from typing import Callable
from typing import Dict
@@ -122,13 +123,11 @@ def parse_files_to_codes_mapping( # noqa: C901
State.codes = []
def _unexpected_token() -> exceptions.ExecutionError:
- def _indent(s: str) -> str:
- return " " + s.strip().replace("\n", "\n ")
-
return exceptions.ExecutionError(
f"Expected `per-file-ignores` to be a mapping from file exclude "
f"patterns to ignore codes.\n\n"
- f"Configured `per-file-ignores` setting:\n\n{_indent(value)}"
+ f"Configured `per-file-ignores` setting:\n\n"
+ f"{textwrap.indent(value.strip(), ' ')}"
)
for token in _tokenize_files_to_codes_mapping(value):