| Total Complexity | 4 | 
| Total Lines | 22 | 
| Duplicated Lines | 77.27 % | 
| 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 | import typing  | 
            ||
| 2 | from inspect import getmro  | 
            ||
| 3 | |||
| 4 | |||
| 5 | View Code Duplication | def get_mro(cls: type) -> typing.Tuple[type, ...]:  | 
            |
| 
                                                                                                    
                        
                         | 
                |||
| 6 | from typish.functions._get_origin import get_origin  | 
            ||
| 7 | |||
| 8 | # Wrapper around ``getmro`` to allow types from ``Typing``.  | 
            ||
| 9 | if cls is ...:  | 
            ||
| 10 | return Ellipsis, object  | 
            ||
| 11 | elif cls is typing.Union:  | 
            ||
| 12 | # For Python <3.7, we cannot use mro.  | 
            ||
| 13 | super_cls = getattr(typing, '_GenericAlias',  | 
            ||
| 14 | getattr(typing, 'GenericMeta', None))  | 
            ||
| 15 | return (typing.Union, super_cls, object)  | 
            ||
| 16 | |||
| 17 | origin = get_origin(cls)  | 
            ||
| 18 | if origin != cls:  | 
            ||
| 19 | return get_mro(origin)  | 
            ||
| 20 | |||
| 21 | return getmro(cls)  | 
            ||
| 22 |