Code Duplication    Length = 11-12 lines in 3 locations

abydos/distance/_Synoname.py 3 locations

@@ 497-508 (lines=12) @@
494
495
        if tests & self.test_dict['exact'] and fn_equal and ln_equal:
496
            return _fmt_retval(self.match_type_dict['exact'])
497
        if tests & self.test_dict['omission']:
498
            if (
499
                fn_equal
500
                and levenshtein(src_ln, tar_ln, cost=(1, 1, 99, 99)) == 1
501
            ):
502
                if not roman_conflict:
503
                    return _fmt_retval(self.match_type_dict['omission'])
504
            elif (
505
                ln_equal
506
                and levenshtein(src_fn, tar_fn, cost=(1, 1, 99, 99)) == 1
507
            ):
508
                return _fmt_retval(self.match_type_dict['omission'])
509
        if tests & self.test_dict['substitution']:
510
            if (
511
                fn_equal
@@ 520-530 (lines=11) @@
517
                and levenshtein(src_fn, tar_fn, cost=(99, 99, 1, 99)) == 1
518
            ):
519
                return _fmt_retval(self.match_type_dict['substitution'])
520
        if tests & self.test_dict['transposition']:
521
            if fn_equal and (
522
                levenshtein(src_ln, tar_ln, mode='osa', cost=(99, 99, 99, 1))
523
                == 1
524
            ):
525
                return _fmt_retval(self.match_type_dict['transposition'])
526
            elif ln_equal and (
527
                levenshtein(src_fn, tar_fn, mode='osa', cost=(99, 99, 99, 1))
528
                == 1
529
            ):
530
                return _fmt_retval(self.match_type_dict['transposition'])
531
        if tests & self.test_dict['punctuation']:
532
            np_src_fn = self._synoname_strip_punct(src_fn)
533
            np_tar_fn = self._synoname_strip_punct(tar_fn)
@@ 509-519 (lines=11) @@
506
                and levenshtein(src_fn, tar_fn, cost=(1, 1, 99, 99)) == 1
507
            ):
508
                return _fmt_retval(self.match_type_dict['omission'])
509
        if tests & self.test_dict['substitution']:
510
            if (
511
                fn_equal
512
                and levenshtein(src_ln, tar_ln, cost=(99, 99, 1, 99)) == 1
513
            ):
514
                return _fmt_retval(self.match_type_dict['substitution'])
515
            elif (
516
                ln_equal
517
                and levenshtein(src_fn, tar_fn, cost=(99, 99, 1, 99)) == 1
518
            ):
519
                return _fmt_retval(self.match_type_dict['substitution'])
520
        if tests & self.test_dict['transposition']:
521
            if fn_equal and (
522
                levenshtein(src_ln, tar_ln, mode='osa', cost=(99, 99, 99, 1))