Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7/types.py 1 location

@@ 496-508 (lines=13) @@
493
    ALLINFO = "ALLINFO"
494
495
496
def get_info_type_from_string(info_type: Optional[str]) -> Optional[InfoType]:
497
    """Convert a info type string to an actual InfoType instance
498
499
    Arguments:
500
        info_type: Info type string to convert to a InfoType
501
    """
502
    if not info_type:
503
        return None
504
    try:
505
        return InfoType[info_type.upper()]
506
    except KeyError:
507
        raise InvalidArgument(
508
            argument='info_type', function=get_info_type_from_string.__name__
509
        ) from None
510
511

gvm/protocols/gmpv208/types.py 1 location

@@ 248-260 (lines=13) @@
245
    NVT = "NVT"
246
247
248
def get_info_type_from_string(info_type: Optional[str]) -> Optional[InfoType]:
249
    """Convert a info type string to an actual InfoType instance
250
251
    Arguments:
252
        info_type: Info type string to convert to a InfoType
253
    """
254
    if not info_type:
255
        return None
256
    try:
257
        return InfoType[info_type.upper()]
258
    except KeyError:
259
        raise InvalidArgument(
260
            argument='info_type', function=get_info_type_from_string.__name__
261
        ) from None
262
263