| Total Complexity | 3 | 
| Total Lines | 18 | 
| Duplicated Lines | 66.67 % | 
| Changes | 0 | ||
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | from functools import lru_cache  | 
            ||
| 2 | |||
| 3 | from typish._types import NoneType  | 
            ||
| 4 | |||
| 5 | |||
| 6 | View Code Duplication | @lru_cache()  | 
            |
| 
                                                                                                    
                        
                         | 
                |||
| 7 | def get_simple_name(cls: type) -> str:  | 
            ||
| 8 | cls = cls or NoneType  | 
            ||
| 9 | cls_name = getattr(cls, '__name__', None)  | 
            ||
| 10 | if not cls_name:  | 
            ||
| 11 | cls_name = getattr(cls, '_name', None)  | 
            ||
| 12 | if not cls_name:  | 
            ||
| 13 | cls_name = repr(cls)  | 
            ||
| 14 |         cls_name = cls_name.split('[')[0]  # Remove generic types. | 
            ||
| 15 |         cls_name = cls_name.split('.')[-1]  # Remove any . caused by repr. | 
            ||
| 16 | cls_name = cls_name.split(r"'>")[0] # Remove any '>.  | 
            ||
| 17 | return cls_name  | 
            ||
| 18 |