diff options
author | David Lord <davidism@gmail.com> | 2020-09-01 11:33:02 -0700 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2020-09-01 11:33:02 -0700 |
commit | b2206f805331af0d20bc652c203a8f3784e1fc20 (patch) | |
tree | a4259e09d80caf131c77958354ac1eebec22ca64 /src | |
parent | 6d53383134753ba3b7bff22309a02ecd0afb93c7 (diff) | |
download | markupsafe-b2206f805331af0d20bc652c203a8f3784e1fc20.tar.gz |
remove format spec mapping helper
Diffstat (limited to 'src')
-rw-r--r-- | src/markupsafe/__init__.py | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/markupsafe/__init__.py b/src/markupsafe/__init__.py index 54d32bf..789979f 100644 --- a/src/markupsafe/__init__.py +++ b/src/markupsafe/__init__.py @@ -1,6 +1,5 @@ import re import string -from collections import abc __version__ = "2.0.0a1" @@ -175,7 +174,6 @@ class Markup(str): def format(self, *args, **kwargs): formatter = EscapeFormatter(self.escape) - kwargs = _MagicFormatMapping(args, kwargs) return self.__class__(formatter.vformat(self, args, kwargs)) def __html_format__(self, format_spec): @@ -184,37 +182,6 @@ class Markup(str): return self -class _MagicFormatMapping(abc.Mapping): - """This class implements a dummy wrapper to fix a bug in the Python - standard library for string formatting. - - See http://bugs.python.org/issue13598 for information about why - this is necessary. - """ - - def __init__(self, args, kwargs): - self._args = args - self._kwargs = kwargs - self._last_index = 0 - - def __getitem__(self, key): - if key == "": - idx = self._last_index - self._last_index += 1 - try: - return self._args[idx] - except LookupError: - pass - key = str(idx) - return self._kwargs[key] - - def __iter__(self): - return iter(self._kwargs) - - def __len__(self): - return len(self._kwargs) - - class EscapeFormatter(string.Formatter): def __init__(self, escape): self.escape = escape |