summaryrefslogtreecommitdiff
path: root/pyflakes/messages.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyflakes/messages.py')
-rw-r--r--pyflakes/messages.py96
1 files changed, 96 insertions, 0 deletions
diff --git a/pyflakes/messages.py b/pyflakes/messages.py
index 8ae545f..cf67cf8 100644
--- a/pyflakes/messages.py
+++ b/pyflakes/messages.py
@@ -266,3 +266,99 @@ class InvalidPrintSyntax(Message):
class IsLiteral(Message):
message = 'use ==/!= to compare str, bytes, and int literals'
+
+
+class FStringMissingPlaceholders(Message):
+ message = 'f-string is missing placeholders'
+
+
+class StringDotFormatExtraPositionalArguments(Message):
+ message = "'...'.format(...) has unused arguments at position(s): %s"
+
+ def __init__(self, filename, loc, extra_positions):
+ Message.__init__(self, filename, loc)
+ self.message_args = (extra_positions,)
+
+
+class StringDotFormatExtraNamedArguments(Message):
+ message = "'...'.format(...) has unused named argument(s): %s"
+
+ def __init__(self, filename, loc, extra_keywords):
+ Message.__init__(self, filename, loc)
+ self.message_args = (extra_keywords,)
+
+
+class StringDotFormatMissingArgument(Message):
+ message = "'...'.format(...) is missing argument(s) for placeholder(s): %s"
+
+ def __init__(self, filename, loc, missing_arguments):
+ Message.__init__(self, filename, loc)
+ self.message_args = (missing_arguments,)
+
+
+class StringDotFormatMixingAutomatic(Message):
+ message = "'...'.format(...) mixes automatic and manual numbering"
+
+
+class StringDotFormatInvalidFormat(Message):
+ message = "'...'.format(...) has invalid format string: %s"
+
+ def __init__(self, filename, loc, error):
+ Message.__init__(self, filename, loc)
+ self.message_args = (error,)
+
+
+class PercentFormatInvalidFormat(Message):
+ message = "'...' %% ... has invalid format string: %s"
+
+ def __init__(self, filename, loc, error):
+ Message.__init__(self, filename, loc)
+ self.message_args = (error,)
+
+
+class PercentFormatMixedPositionalAndNamed(Message):
+ message = "'...' %% ... has mixed positional and named placeholders"
+
+
+class PercentFormatUnsupportedFormatCharacter(Message):
+ message = "'...' %% ... has unsupported format character %r"
+
+ def __init__(self, filename, loc, c):
+ Message.__init__(self, filename, loc)
+ self.message_args = (c,)
+
+
+class PercentFormatPositionalCountMismatch(Message):
+ message = "'...' %% ... has %d placeholder(s) but %d substitution(s)"
+
+ def __init__(self, filename, loc, n_placeholders, n_substitutions):
+ Message.__init__(self, filename, loc)
+ self.message_args = (n_placeholders, n_substitutions)
+
+
+class PercentFormatExtraNamedArguments(Message):
+ message = "'...' %% ... has unused named argument(s): %s"
+
+ def __init__(self, filename, loc, extra_keywords):
+ Message.__init__(self, filename, loc)
+ self.message_args = (extra_keywords,)
+
+
+class PercentFormatMissingArgument(Message):
+ message = "'...' %% ... is missing argument(s) for placeholder(s): %s"
+
+ def __init__(self, filename, loc, missing_arguments):
+ Message.__init__(self, filename, loc)
+ self.message_args = (missing_arguments,)
+
+
+class PercentFormatExpectedMapping(Message):
+ message = "'...' %% ... expected mapping but got sequence"
+
+
+class PercentFormatExpectedSequence(Message):
+ message = "'...' %% ... expected sequence but got mapping"
+
+
+class PercentFormatStarRequiresSequence(Message):
+ message = "'...' %% ... `*` specifier requires sequence"