diff options
author | David Lord <davidism@gmail.com> | 2020-03-08 08:29:54 -0700 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2020-03-08 08:29:54 -0700 |
commit | f8f02bfc63cb6e63b7a3373384758f7226553408 (patch) | |
tree | f5ad9611416bccfe877664a2a119b06381e50005 /src/click/types.py | |
parent | 30b82bfdebcc155acc1a63716ae8fd79a23f73e5 (diff) | |
download | click-f8f02bfc63cb6e63b7a3373384758f7226553408.tar.gz |
apply pyupgrade
Diffstat (limited to 'src/click/types.py')
-rw-r--r-- | src/click/types.py | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/click/types.py b/src/click/types.py index 0987190..8f4b9d2 100644 --- a/src/click/types.py +++ b/src/click/types.py @@ -194,7 +194,9 @@ class Choice(ParamType): return normed_choices[normed_value] self.fail( - "invalid choice: %s. (choose from %s)" % (value, ", ".join(self.choices)), + "invalid choice: {}. (choose from {})".format( + value, ", ".join(self.choices) + ), param, ctx, ) @@ -299,7 +301,9 @@ class IntRange(IntParamType): ): if self.min is None: self.fail( - "%s is bigger than the maximum valid value %s." % (rv, self.max), + "{} is bigger than the maximum valid value {}.".format( + rv, self.max + ), param, ctx, ) @@ -320,7 +324,7 @@ class IntRange(IntParamType): return rv def __repr__(self): - return "IntRange(%r, %r)" % (self.min, self.max) + return "IntRange({!r}, {!r})".format(self.min, self.max) class FloatParamType(ParamType): @@ -367,7 +371,9 @@ class FloatRange(FloatParamType): ): if self.min is None: self.fail( - "%s is bigger than the maximum valid value %s." % (rv, self.max), + "{} is bigger than the maximum valid value {}.".format( + rv, self.max + ), param, ctx, ) @@ -388,7 +394,7 @@ class FloatRange(FloatParamType): return rv def __repr__(self): - return "FloatRange(%r, %r)" % (self.min, self.max) + return "FloatRange({!r}, {!r})".format(self.min, self.max) class BoolParamType(ParamType): @@ -597,20 +603,24 @@ class Path(ParamType): if not self.exists: return self.coerce_path_result(rv) self.fail( - '%s "%s" does not exist.' % (self.path_type, filename_to_ui(value)), + '{} "{}" does not exist.'.format( + self.path_type, filename_to_ui(value) + ), param, ctx, ) if not self.file_okay and stat.S_ISREG(st.st_mode): self.fail( - '%s "%s" is a file.' % (self.path_type, filename_to_ui(value)), + '{} "{}" is a file.'.format(self.path_type, filename_to_ui(value)), param, ctx, ) if not self.dir_okay and stat.S_ISDIR(st.st_mode): self.fail( - '%s "%s" is a directory.' % (self.path_type, filename_to_ui(value)), + '{} "{}" is a directory.'.format( + self.path_type, filename_to_ui(value) + ), param, ctx, ) |