(pre, rest, type, orig=None)
| 68 | |
| 69 | |
| 70 | def get_abbr(pre, rest, type, orig=None): |
| 71 | if pre: |
| 72 | for d in APPATTRS, ABBRS: |
| 73 | try: |
| 74 | return d[pre], rest, d |
| 75 | except KeyError: |
| 76 | pass |
| 77 | raise KeyError('Unknown abbreviation: {} ({})'.format( |
| 78 | '.'.join([pre, rest]) if orig is None else orig, type, |
| 79 | )) |
| 80 | else: |
| 81 | for d in APPATTRS, ABBRS: |
| 82 | try: |
| 83 | return d[rest], '', d |
| 84 | except KeyError: |
| 85 | pass |
| 86 | return ABBR_EMPTY.get(type, DEFAULT_EMPTY), rest, ABBR_EMPTY |
| 87 | |
| 88 | |
| 89 | def resolve(S, type): |