diff options
author | cpopa <devnull@localhost> | 2013-10-03 17:54:11 +0300 |
---|---|---|
committer | cpopa <devnull@localhost> | 2013-10-03 17:54:11 +0300 |
commit | 14a9934b1d97208cfe9aa404755f0bf5d820b8b6 (patch) | |
tree | 23ccfb71ee60e80d524fb86731a5fc0bb94b413b /checkers/utils.py | |
parent | e191027464f9800fca4e525773a68daf536d372d (diff) | |
download | pylint-14a9934b1d97208cfe9aa404755f0bf5d820b8b6.tar.gz |
Various changes to format checker.
Diffstat (limited to 'checkers/utils.py')
-rw-r--r-- | checkers/utils.py | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/checkers/utils.py b/checkers/utils.py index 119a859..4a39119 100644 --- a/checkers/utils.py +++ b/checkers/utils.py @@ -28,11 +28,6 @@ from logilab.common.compat import builtins BUILTINS_NAME = builtins.__name__ COMP_NODE_TYPES = astroid.ListComp, astroid.SetComp, astroid.DictComp, astroid.GenExpr -if hasattr(string, 'Formatter'): - STRING_FORMATTER = string.Formatter() -else: - STRING_FORMATTER = None - class NoSuchArgumentError(Exception): pass @@ -350,34 +345,6 @@ def parse_format_string(format_string): i += 1 return keys, num_args -def parse_format_method_string(format_string): - """Parses a Python 3 format string, returning a tuple of (keys, num_args), - where keys is the set of mapping keys in the format string, and num_args - is the number of arguments required by the format string. - """ - keys = set() - num_args = 0 - - # TODO: should raise a custom exception? - if not STRING_FORMATTER: - return keys, num_args - - parseiterator = STRING_FORMATTER.parse(format_string) - try: - for result in parseiterator: - if all(item is None for item in result[1:]): - # not a replacement format - continue - name = result[1] - if name: - keys.add(name) - else: - num_args += 1 - except ValueError: - # probably the format string is invalid - # should we check the argument of the ValueError? - raise IncompleteFormatString(format_string) - return keys, num_args def is_attr_protected(attrname): """return True if attribute name is protected (start with _ and some other |