Code Duplication    Length = 16-16 lines in 2 locations

gvm/protocols/gmpv208/types.py 1 location

@@ 927-942 (lines=16) @@
924
    DES = 'des'
925
926
927
def get_snmp_privacy_algorithm_from_string(
928
    algorithm: Optional[str],
929
) -> Optional[SnmpPrivacyAlgorithm]:
930
    """Convert a SNMP privacy algorithm string into a SnmpPrivacyAlgorithm
931
    instance
932
    """
933
    if not algorithm:
934
        return None
935
936
    try:
937
        return SnmpPrivacyAlgorithm[algorithm.upper()]
938
    except KeyError:
939
        raise InvalidArgument(
940
            argument='algorithm',
941
            function=get_snmp_privacy_algorithm_from_string.__name__,
942
        ) from None
943
944
945
class SeverityLevel(Enum):

gvm/protocols/gmpv7/types.py 1 location

@@ 746-761 (lines=16) @@
743
    DES = 'des'
744
745
746
def get_snmp_privacy_algorithm_from_string(
747
    algorithm: Optional[str],
748
) -> Optional[SnmpPrivacyAlgorithm]:
749
    """Convert a SNMP privacy algorithm string into a SnmpPrivacyAlgorithm
750
    instance
751
    """
752
    if not algorithm:
753
        return None
754
755
    try:
756
        return SnmpPrivacyAlgorithm[algorithm.upper()]
757
    except KeyError:
758
        raise InvalidArgument(
759
            argument='algorithm',
760
            function=get_snmp_privacy_algorithm_from_string.__name__,
761
        ) from None
762
763
764
class SeverityLevel(Enum):