Code Duplication    Length = 12-12 lines in 2 locations

gvm/protocols/gmpv208/types.py 1 location

@@ 985-996 (lines=12) @@
982
    DECADE = "decade"
983
984
985
def get_time_unit_from_string(time_unit: Optional[str]) -> Optional[TimeUnit]:
986
    """Convert a time unit string into a TimeUnit instance"""
987
    if not time_unit:
988
        return None
989
990
    try:
991
        return TimeUnit[time_unit.upper()]
992
    except KeyError:
993
        raise InvalidArgument(
994
            argument='severity_level',
995
            function=get_severity_level_from_string.__name__,
996
        ) from None
997
998
999
class UserAuthType(Enum):

gvm/protocols/gmpv7/types.py 1 location

@@ 804-815 (lines=12) @@
801
    DECADE = "decade"
802
803
804
def get_time_unit_from_string(time_unit: Optional[str]) -> Optional[TimeUnit]:
805
    """Convert a time unit string into a TimeUnit instance"""
806
    if not time_unit:
807
        return None
808
809
    try:
810
        return TimeUnit[time_unit.upper()]
811
    except KeyError:
812
        raise InvalidArgument(
813
            argument='severity_level',
814
            function=get_severity_level_from_string.__name__,
815
        ) from None
816
817
818
class UserAuthType(Enum):