Code Duplication    Length = 14-14 lines in 2 locations

gvm/protocols/gmpv208/types.py 1 location

@@ 1007-1020 (lines=14) @@
1004
    RADIUS_CONNECT = 'radius_connect'
1005
1006
1007
def get_user_auth_type_from_string(
1008
    user_auth_type: Optional[str],
1009
) -> Optional[UserAuthType]:
1010
    """Convert a user auth type string into a UserAuthType instance"""
1011
    if not user_auth_type:
1012
        return None
1013
1014
    try:
1015
        return UserAuthType[user_auth_type.upper()]
1016
    except KeyError:
1017
        raise InvalidArgument(
1018
            argument='user_auth_type',
1019
            function=get_user_auth_type_from_string.__name__,
1020
        ) from None
1021

gvm/protocols/gmpv7/types.py 1 location

@@ 826-839 (lines=14) @@
823
    RADIUS_CONNECT = 'radius_connect'
824
825
826
def get_user_auth_type_from_string(
827
    user_auth_type: Optional[str],
828
) -> Optional[UserAuthType]:
829
    """Convert a user auth type string into a UserAuthType instance"""
830
    if not user_auth_type:
831
        return None
832
833
    try:
834
        return UserAuthType[user_auth_type.upper()]
835
    except KeyError:
836
        raise InvalidArgument(
837
            argument='user_auth_type',
838
            function=get_user_auth_type_from_string.__name__,
839
        ) from None
840