| 1024 | return str(v) |
| 1025 | |
| 1026 | def description(self): |
| 1027 | desc = """\ |
| 1028 | The '{plotly_name}' property is a string and must be specified as:""".format( |
| 1029 | plotly_name=self.plotly_name |
| 1030 | ) |
| 1031 | |
| 1032 | if self.no_blank: |
| 1033 | desc = ( |
| 1034 | desc |
| 1035 | + """ |
| 1036 | - A non-empty string""" |
| 1037 | ) |
| 1038 | elif self.values: |
| 1039 | valid_str = "\n".join( |
| 1040 | textwrap.wrap( |
| 1041 | repr(self.values), |
| 1042 | initial_indent=" " * 12, |
| 1043 | subsequent_indent=" " * 12, |
| 1044 | break_on_hyphens=False, |
| 1045 | ) |
| 1046 | ) |
| 1047 | |
| 1048 | desc = ( |
| 1049 | desc |
| 1050 | + """ |
| 1051 | - One of the following strings: |
| 1052 | {valid_str}""".format(valid_str=valid_str) |
| 1053 | ) |
| 1054 | else: |
| 1055 | desc = ( |
| 1056 | desc |
| 1057 | + """ |
| 1058 | - A string""" |
| 1059 | ) |
| 1060 | |
| 1061 | if not self.strict: |
| 1062 | desc = ( |
| 1063 | desc |
| 1064 | + """ |
| 1065 | - A number that will be converted to a string""" |
| 1066 | ) |
| 1067 | |
| 1068 | if self.array_ok: |
| 1069 | desc = ( |
| 1070 | desc |
| 1071 | + """ |
| 1072 | - A tuple, list, or one-dimensional numpy array of the above""" |
| 1073 | ) |
| 1074 | |
| 1075 | return desc |
| 1076 | |
| 1077 | def validate_coerce(self, v): |
| 1078 | if is_none_or_typed_array_spec(v): |