Code Duplication    Length = 14-14 lines in 2 locations

gvm/protocols/gmpv208/types.py 1 location

@@ 904-917 (lines=14) @@
901
    MD5 = 'md5'
902
903
904
def get_snmp_auth_algorithm_from_string(
905
    algorithm: Optional[str],
906
) -> Optional[SnmpAuthAlgorithm]:
907
    """Convert a SNMP auth algorithm string into a SnmpAuthAlgorithm instance"""
908
    if not algorithm:
909
        return None
910
911
    try:
912
        return SnmpAuthAlgorithm[algorithm.upper()]
913
    except KeyError:
914
        raise InvalidArgument(
915
            argument='algorithm',
916
            function=get_snmp_auth_algorithm_from_string.__name__,
917
        ) from None
918
919
920
class SnmpPrivacyAlgorithm(Enum):

gvm/protocols/gmpv7/types.py 1 location

@@ 723-736 (lines=14) @@
720
    MD5 = 'md5'
721
722
723
def get_snmp_auth_algorithm_from_string(
724
    algorithm: Optional[str],
725
) -> Optional[SnmpAuthAlgorithm]:
726
    """Convert a SNMP auth algorithm string into a SnmpAuthAlgorithm instance"""
727
    if not algorithm:
728
        return None
729
730
    try:
731
        return SnmpAuthAlgorithm[algorithm.upper()]
732
    except KeyError:
733
        raise InvalidArgument(
734
            argument='algorithm',
735
            function=get_snmp_auth_algorithm_from_string.__name__,
736
        ) from None
737
738
739
class SnmpPrivacyAlgorithm(Enum):