(cls, raw)
| 32 | |
| 33 | @classonly |
| 34 | def _from_raw(cls, raw): |
| 35 | if raw is None: |
| 36 | return None |
| 37 | elif isinstance(raw, cls): |
| 38 | return raw |
| 39 | elif type(raw) is str: |
| 40 | # We could use cls[raw] for the upper-case form, |
| 41 | # but there's no need to go to the trouble. |
| 42 | return cls(raw.lower()) |
| 43 | else: |
| 44 | raise NotImplementedError(raw) |
| 45 | |
| 46 | @classonly |
| 47 | def by_priority(cls, group=None): |