diff options
author | Matthew Martin <phy1729@gmail.com> | 2022-01-05 21:16:43 -0600 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2022-03-19 11:26:19 -0700 |
commit | e0033315510510acdba14e880a361ccca091fb4b (patch) | |
tree | 17863979ec71e96da227dc9fcdee57e66229638c /src | |
parent | 19be092b6db4e4300e31906498e354ec0adf870c (diff) | |
download | click-e0033315510510acdba14e880a361ccca091fb4b.tar.gz |
fix ParamType.to_info_dict() with no name
Diffstat (limited to 'src')
-rw-r--r-- | src/click/types.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/click/types.py b/src/click/types.py index aab0656..3a78a3a 100644 --- a/src/click/types.py +++ b/src/click/types.py @@ -63,7 +63,14 @@ class ParamType: # The class name without the "ParamType" suffix. param_type = type(self).__name__.partition("ParamType")[0] param_type = param_type.partition("ParameterType")[0] - return {"param_type": param_type, "name": self.name} + + # Custom subclasses might not remember to set a name. + if hasattr(self, "name"): + name = self.name + else: + name = param_type + + return {"param_type": param_type, "name": name} def __call__( self, |