get the linktype
(cls, key, default=None)
| 21 | |
| 22 | @classmethod |
| 23 | def get(cls, key, default=None): |
| 24 | """get the linktype""" |
| 25 | try: |
| 26 | return key if isinstance(key, cls) else cls[key.upper()] |
| 27 | except KeyError as exc: |
| 28 | if default and isinstance(default, cls): |
| 29 | return default |
| 30 | err = f'bad {cls.__name__} value: "{key}"' |
| 31 | raise ValueError(err) from exc |
| 32 | |
| 33 | def __str__(self): |
| 34 | """linktype to string""" |
no outgoing calls