| Total Complexity | 5 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | class IncrementedNamedInt: |
||
| 2 | _last_int = 0 |
||
| 3 | _names = {} |
||
| 4 | |||
| 5 | @classmethod |
||
| 6 | def get(cls, name): |
||
| 7 | cls._last_int += 1 |
||
| 8 | cls._names[cls._last_int] = name |
||
| 9 | return cls._last_int |
||
| 10 | |||
| 11 | @classmethod |
||
| 12 | def name_of(cls, int): |
||
| 13 | return cls._names[int] |
||
| 14 | |||
| 15 | @classmethod |
||
| 16 | def get_for_name(cls, name): |
||
| 17 | for int in cls._names: |
||
| 18 | if cls._names[int] == name: |
||
| 19 | return int |
||
| 20 | raise Exception("Named int not found") |